source: src/main/java/genius/core/utility/ExclusiveZeroConstraint.java

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

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 823 bytes
Line 
1package genius.core.utility;
2
3import java.util.HashMap;
4
5import genius.core.Bid;
6
7public class ExclusiveZeroConstraint extends RConstraint {
8
9 Integer issueIndex;
10 private HashMap<Integer, String> checkList;
11
12 public ExclusiveZeroConstraint(Integer index) {
13 this.issueIndex = index;
14 this.checkList = new HashMap<Integer, String>();
15 }
16
17 @Override
18 public void addContraint(Integer issueIndex, String conditionToBeCheck) {
19 this.checkList.put(issueIndex, conditionToBeCheck);
20 }
21
22 @Override
23 public boolean willZeroUtility(Bid bid) {
24
25 for (Integer index : this.checkList.keySet()) {
26 if (!bid.getValue(index).toString()
27 .equals(this.checkList.get(index)))
28 return true;
29 }
30 return false;
31 }
32
33 @Override
34 public Integer getIssueIndex() {
35 return this.issueIndex;
36 }
37}
Note: See TracBrowser for help on using the repository browser.