source: anac2020/ShineAgent/src/main/java/shineagent/IssueCounter.java@ 34

Last change on this file since 34 was 1, checked in by wouter, 4 years ago

#1910 added anac2020 parties

File size: 917 bytes
RevLine 
[1]1package shineagent;
2
3import java.util.HashMap;
4import java.util.Map;
5
6import geniusweb.issuevalue.Value;
7import geniusweb.issuevalue.ValueSet;
8import geniusweb.issuevalue.Bid;
9import geniusweb.issuevalue.Domain;
10
11public class IssueCounter extends HashMap<String, HashMap<Value, Integer>> {
12 private Domain domain;
13 public IssueCounter(Domain domain) {
14 super();
15 this.domain = domain;
16 for (String issue : domain.getIssues()) {
17 ValueSet vs = domain.getValues(issue);
18 HashMap<Value, Integer> issueMap = new HashMap<>();
19 for(Value value : vs)
20 {
21 issueMap.put(value, 0);
22 }
23 this.put(issue, issueMap);
24 }
25 }
26
27 public void addElement(Bid inputBid) {
28 for (String issue : domain.getIssues()) {
29 Value value = inputBid.getValue(issue);
30 if(value == null)
31 continue;
32 int newCount = this.get(issue).get(value) + 1;
33 this.get(issue).put(value, newCount);
34 }
35 }
36}
Note: See TracBrowser for help on using the repository browser.