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

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

#28 rename SpinnerModel to IntegerModel

File size: 1.4 KB
RevLine 
[83]1package genius.gui.tree;
2
[84]3import genius.core.utility.UncertainAdditiveUtilitySpace;
4import genius.core.utility.UtilitySpace;
[83]5import genius.gui.panels.BooleanModel;
[91]6import genius.gui.panels.IntegerModel;
[83]7
8/**
9 * Holds the uncertainty settings (while editing a profile)
10 */
11public class UncertaintySettingsModel {
[86]12 private BooleanModel isEnabled;
[91]13 private IntegerModel comparisons;
14 private IntegerModel errors;
[83]15 private BooleanModel isExperimental = new BooleanModel(false);
16 private long totalBids;
17
18 /**
19 * @oaran nbids the number of bids in the space.
[86]20 * @param enable
21 * the default value for enabledness of Uncertainty.
[83]22 */
[86]23 public UncertaintySettingsModel(UtilitySpace space, boolean enable) {
24 isEnabled = new BooleanModel(enable);
[84]25 totalBids = space.getDomain().getNumberOfPossibleBids();
26 UncertainAdditiveUtilitySpace uspace = (space instanceof UncertainAdditiveUtilitySpace)
27 ? (UncertainAdditiveUtilitySpace) space : null;
[91]28 comparisons = new IntegerModel(
[87]29 uspace != null ? uspace.getComparisons() : 0, 0,
30 (int) totalBids, 1);
[91]31 errors = new IntegerModel(uspace != null ? uspace.getErrors() : 0, 0,
[88]32 (int) totalBids, 1);
[83]33 }
34
[91]35 public IntegerModel getComparisons() {
[83]36 return comparisons;
37 }
38
[91]39 public IntegerModel getErrors() {
[83]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.