[83] | 1 | package genius.gui.tree;
|
---|
| 2 |
|
---|
| 3 | import javax.swing.SpinnerModel;
|
---|
| 4 | import javax.swing.SpinnerNumberModel;
|
---|
| 5 |
|
---|
[84] | 6 | import genius.core.utility.UncertainAdditiveUtilitySpace;
|
---|
| 7 | import genius.core.utility.UtilitySpace;
|
---|
[83] | 8 | import genius.gui.panels.BooleanModel;
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * Holds the uncertainty settings (while editing a profile)
|
---|
| 12 | */
|
---|
| 13 | public 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 | */
|
---|
[84] | 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.);
|
---|
[83] | 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 | }
|
---|