source: src/main/java/genius/gui/tree/UncertaintySettingsModel.java@ 88

Last change on this file since 88 was 88, checked in by Wouter Pasman, 6 years ago

#28 SpinnerModel restricted to Integer because of lacking type checking in lower layers and because sliders don't suport Doubles

File size: 1.4 KB
Line 
1package genius.gui.tree;
2
3import genius.core.utility.UncertainAdditiveUtilitySpace;
4import genius.core.utility.UtilitySpace;
5import genius.gui.panels.BooleanModel;
6import genius.gui.panels.SpinnerModel;
7
8/**
9 * Holds the uncertainty settings (while editing a profile)
10 */
11public class UncertaintySettingsModel {
12 private BooleanModel isEnabled;
13 private SpinnerModel comparisons;
14 private SpinnerModel errors;
15 private BooleanModel isExperimental = new BooleanModel(false);
16 private long totalBids;
17
18 /**
19 * @oaran nbids the number of bids in the space.
20 * @param enable
21 * the default value for enabledness of Uncertainty.
22 */
23 public UncertaintySettingsModel(UtilitySpace space, boolean enable) {
24 isEnabled = new BooleanModel(enable);
25 totalBids = space.getDomain().getNumberOfPossibleBids();
26 UncertainAdditiveUtilitySpace uspace = (space instanceof UncertainAdditiveUtilitySpace)
27 ? (UncertainAdditiveUtilitySpace) space : null;
28 comparisons = new SpinnerModel(
29 uspace != null ? uspace.getComparisons() : 0, 0,
30 (int) totalBids, 1);
31 errors = new SpinnerModel(uspace != null ? uspace.getErrors() : 0, 0,
32 (int) totalBids, 1);
33 }
34
35 public SpinnerModel getComparisons() {
36 return comparisons;
37 }
38
39 public SpinnerModel getErrors() {
40 return errors;
41 }
42
43 public BooleanModel getIsExperimental() {
44 return isExperimental;
45 }
46
47 public BooleanModel getIsEnabled() {
48 return isEnabled;
49 }
50
51 public long getTotalBids() {
52 return totalBids;
53 }
54
55}
Note: See TracBrowser for help on using the repository browser.