1 | package genius.core.uncertainty;
|
---|
2 |
|
---|
3 | import genius.core.Bid;
|
---|
4 | import genius.core.bidding.BidDetails;
|
---|
5 | import genius.core.bidding.BidDetailsSorterUtility;
|
---|
6 |
|
---|
7 | /**
|
---|
8 | * @author Dimitrios Tsimpoukis
|
---|
9 | *
|
---|
10 | * Helper class, any object of which depicts the comparison of two negotiation of two outcomes.
|
---|
11 | * bid1 < bid2 is coded by comparisonResult = -1.
|
---|
12 | *
|
---|
13 | *
|
---|
14 | */
|
---|
15 |
|
---|
16 | public class OutcomeComparison {
|
---|
17 |
|
---|
18 | private Bid bid1;
|
---|
19 | private Bid bid2;
|
---|
20 | private int comparisonResult;
|
---|
21 |
|
---|
22 | public OutcomeComparison (BidDetails bid1, BidDetails bid2) {
|
---|
23 | this.bid1 = bid1.getBid();
|
---|
24 | this.bid2 = bid2.getBid();
|
---|
25 | this.comparisonResult = (new BidDetailsSorterUtility()).compare(bid1 , bid2);
|
---|
26 | }
|
---|
27 |
|
---|
28 | public OutcomeComparison (Bid bid1, Bid bid2, int comparisonResult)
|
---|
29 | {
|
---|
30 | this.bid1 = bid1;
|
---|
31 | this.bid2 = bid2;
|
---|
32 | this.comparisonResult = comparisonResult;
|
---|
33 | }
|
---|
34 |
|
---|
35 |
|
---|
36 | public Bid getBid1() {
|
---|
37 | return bid1;
|
---|
38 | }
|
---|
39 |
|
---|
40 | public Bid getBid2() {
|
---|
41 | return bid2;
|
---|
42 | }
|
---|
43 |
|
---|
44 |
|
---|
45 | public int getComparisonResult() {
|
---|
46 | return comparisonResult;
|
---|
47 | }
|
---|
48 |
|
---|
49 | public void setComparisonResult(int comparisonResult) {
|
---|
50 | this.comparisonResult = comparisonResult;
|
---|
51 | }
|
---|
52 |
|
---|
53 | @Override
|
---|
54 | public String toString() {
|
---|
55 | String s;
|
---|
56 | if (comparisonResult == 1) {
|
---|
57 | s = bid2.toString() + " is preferred over the outcome " +bid1.toString();
|
---|
58 | }
|
---|
59 | else if (comparisonResult == -1) {
|
---|
60 | s = bid1.toString() + " is preferred over the outcome " +bid2.toString();
|
---|
61 | }
|
---|
62 | else if (comparisonResult == 0){
|
---|
63 | s = "Both bids are of equal utility";
|
---|
64 | }
|
---|
65 | else s = "No Comparison";
|
---|
66 | return s;
|
---|
67 | }
|
---|
68 |
|
---|
69 | }
|
---|
70 |
|
---|
71 |
|
---|