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

Last change on this file since 84 was 84, checked in by Wouter Pasman, 7 years ago

#30 Use existing values in uncertain profile. Use "errors" instead of "error".

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