source: src/main/java/genius/core/utility/ExclusiveZeroOutcomeConstraint.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: 1.2 KB
Line 
1package genius.core.utility;
2
3import java.util.HashMap;
4
5import genius.core.Bid;
6
7public class ExclusiveZeroOutcomeConstraint implements ZeroOutcomeContraint {
8
9 private HashMap<Integer, String> checkList;
10
11 public ExclusiveZeroOutcomeConstraint() {
12 this.checkList = new HashMap<Integer, String>();
13 }
14
15 @Override
16 public void addContraint(Integer issueIndex, String conditionToBeCheck) {
17 this.checkList.put(issueIndex, conditionToBeCheck);
18 }
19
20 @Override
21 public boolean willGetZeroOutcomeUtility(Bid bid) {
22
23 for (Integer issueIndex : this.checkList.keySet()) {
24
25 if (checkList.get(issueIndex).contains("numeric")) {
26
27 if (((checkList.get(issueIndex).contains("positive"))
28 && (Integer.valueOf(
29 bid.getValue(issueIndex).toString()) > 0))) {
30
31 return true;
32 } else if ((checkList.get(issueIndex).contains("negative"))
33 && (Integer.valueOf(
34 bid.getValue(issueIndex).toString()) > 0)) {
35 return true;
36 }
37
38 } else // check it involves "condition" keyword
39 {
40 if (!bid.getValue(issueIndex).toString()
41 .contains(this.checkList.get(issueIndex))) {
42 return true;
43 }
44
45 }
46
47 }
48 return false;
49 }
50
51}
Note: See TracBrowser for help on using the repository browser.