source: src/main/java/genius/core/utility/SumZeroNotConstraint.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.3 KB
Line 
1package genius.core.utility;
2
3import java.util.ArrayList;
4
5import genius.core.Bid;
6
7public class SumZeroNotConstraint extends SumZeroConstraint {
8
9 public SumZeroNotConstraint(int index) {
10 super(index);
11 }
12
13 @Override
14 public Integer getIssueIndex() {
15 return index;
16 }
17
18 @Override
19 public boolean willZeroUtility(Bid bid) {
20
21 int total = 0;
22 for (int i = 0; i < relatedIssues.size(); i++) {
23 total += Integer.valueOf(bid.getValue(relatedIssues.get(i))
24 .toString());
25 }
26
27 if ((min <= total) && (total <= max)) {
28 if (!bid.getValue(index).toString().contains(valueToBeChecked))
29 return true;
30 }
31 return false;
32 }
33
34 @Override
35 public void addContraint(Integer issueIndex, String conditionToBeCheck) {
36
37 }
38
39 public void addRelatedIssues(ArrayList<Integer> relatedIssueIndices) {
40 this.relatedIssues = relatedIssueIndices;
41 }
42
43 public void addRelatedIssue(Integer relatedIndex) {
44 this.relatedIssues.add(relatedIndex);
45 }
46
47 public String getValueToBeChecked() {
48 return valueToBeChecked;
49 }
50
51 public void setValueToBeChecked(String valueToBeChecked) {
52 this.valueToBeChecked = valueToBeChecked;
53 }
54
55 public int getMax() {
56 return max;
57 }
58
59 public void setMax(int max) {
60 this.max = max;
61 }
62
63 public int getMin() {
64 return min;
65 }
66
67 public void setMin(int min) {
68 this.min = min;
69 }
70
71}
Note: See TracBrowser for help on using the repository browser.