1 | package genius.core;
|
---|
2 |
|
---|
3 | import genius.core.actions.Accept;
|
---|
4 | import genius.core.actions.Action;
|
---|
5 |
|
---|
6 | public class NegotiationResult {
|
---|
7 |
|
---|
8 | /** The utility received by the agent at the end of the negotiation. */
|
---|
9 | private final double myDiscountedUtility;
|
---|
10 | /** The last action conducted in the negotiation. */
|
---|
11 | private final Action lastAction;
|
---|
12 | /** The last bid in the negotiation. */
|
---|
13 | private final Bid lastBid;
|
---|
14 |
|
---|
15 | public NegotiationResult(double myDiscountedUtility, Action lastAction, Bid lastBid) {
|
---|
16 | this.myDiscountedUtility = myDiscountedUtility;
|
---|
17 | this.lastAction = lastAction;
|
---|
18 | this.lastBid = lastBid;
|
---|
19 | }
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * @return true when the match ended in acceptance.
|
---|
23 | */
|
---|
24 | public boolean isAgreement() {
|
---|
25 | return lastAction instanceof Accept;
|
---|
26 | }
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @return the utility received at the end of the negotiation.
|
---|
30 | */
|
---|
31 | public double getMyDiscountedUtility() {
|
---|
32 | return myDiscountedUtility;
|
---|
33 | }
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * @return last action executed in the negotiation.
|
---|
37 | */
|
---|
38 | public Action getLastAction() {
|
---|
39 | return lastAction;
|
---|
40 | }
|
---|
41 |
|
---|
42 | /**
|
---|
43 | * @return last bid offered in the negotiation.
|
---|
44 | */
|
---|
45 | public Bid getLastBid() {
|
---|
46 | return lastBid;
|
---|
47 | }
|
---|
48 |
|
---|
49 | public String toString() {
|
---|
50 | return myDiscountedUtility + "\n" + lastAction + "\n" + lastBid;
|
---|
51 | }
|
---|
52 | } |
---|