source: ai2020/group7/src/main/java/geniusweb/exampleparties/nataliaparty/ValueOption.java

Last change on this file was 7, checked in by wouter, 4 years ago

#1925 added group7 and heavy fixes

File size: 788 bytes
Line 
1package geniusweb.exampleparties.nataliaparty;
2
3import geniusweb.issuevalue.Value;
4
5public class ValueOption implements Comparable<ValueOption> {
6
7 private String issue;
8 private Value value;
9 private double penalty;
10
11 public ValueOption(String issue, Value value, double penalty) {
12 this.issue = issue;
13 this.value = value;
14 this.penalty = penalty;
15 }
16
17 public String getIssue() {
18 return issue;
19 }
20
21 public Value getValue() {
22 return value;
23 }
24
25 public double getPenalty() {
26 return penalty;
27 }
28
29 @Override
30 public int compareTo(ValueOption o) {
31 if (penalty == o.penalty) {
32 return value.toString().compareTo(o.value.toString());
33 }
34 return penalty > o.penalty ? 1 : -1;
35 }
36
37 @Override
38 public String toString() {
39 return issue + " = " + value + " (" + penalty + ")";
40 }
41}
Note: See TracBrowser for help on using the repository browser.