[237] | 1 | /**
|
---|
| 2 | * Offer class
|
---|
| 3 | */
|
---|
[253] | 4 | package onetomany.bargainingchipsgame.interactions;
|
---|
[237] | 5 |
|
---|
[253] | 6 | import onetomany.bargainingchipsgame.Bundle;
|
---|
[237] | 7 |
|
---|
| 8 | /**
|
---|
[263] | 9 | * An offer has two parts: (1) a bundle or null, (2) a message code: `bid', `accept', `end'.
|
---|
[237] | 10 | * When the code is 'bid', the first part is checked; for the two latter codes, the first part of the offer is null.
|
---|
[263] | 11 | * In other words, message `bid' means that offer contains a bundle which is proposed, `accept' means offer contains no bundle to propose,
|
---|
| 12 | * but an agreement with the deal (the received offer), and `end' again means that nothing to propose, and quitting the negotiation.
|
---|
[237] | 13 | *
|
---|
| 14 | * @author Faria Nassiri-Mofakham
|
---|
| 15 | *
|
---|
| 16 | */
|
---|
| 17 | public class Offer
|
---|
| 18 | {
|
---|
| 19 |
|
---|
| 20 | private Bundle bundle; //body of the offer, which is a bundle or null
|
---|
[263] | 21 | //message codes: (1) `bid' [body contains a bundle], (2) `accept' [agree with the deal (based on the rules); null body], (3) `end' [quitting the negotiation; null body]
|
---|
[267] | 22 | private MessageType message;
|
---|
[263] | 23 | //private String message;
|
---|
[237] | 24 |
|
---|
[263] | 25 |
|
---|
[237] | 26 | public Offer()
|
---|
| 27 | {
|
---|
[263] | 28 | setBundle(null);
|
---|
| 29 | setMessage(null);
|
---|
[237] | 30 | }
|
---|
| 31 |
|
---|
| 32 | /**
|
---|
| 33 | * @return the proposal
|
---|
| 34 | */
|
---|
| 35 | public Bundle getBundle() {
|
---|
| 36 | return bundle;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | /**
|
---|
| 40 | * @param proposal the proposal to set
|
---|
| 41 | */
|
---|
| 42 | public void setBundle(Bundle b) {
|
---|
| 43 | this.bundle = b;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | /**
|
---|
[263] | 47 | * @param message the message to set
|
---|
[237] | 48 | */
|
---|
[267] | 49 | public void setMessage(MessageType m) {
|
---|
[263] | 50 | this.message = m;
|
---|
[237] | 51 | }
|
---|
| 52 |
|
---|
| 53 | /**
|
---|
[263] | 54 | * @return the message
|
---|
[237] | 55 | */
|
---|
[267] | 56 | public MessageType getMessage() {
|
---|
[263] | 57 | return message;
|
---|
[237] | 58 | }
|
---|
[263] | 59 | }
|
---|
[237] | 60 |
|
---|
[263] | 61 | // /**
|
---|
| 62 | // * @return the message
|
---|
| 63 | // */
|
---|
| 64 | // public String getMessage() {
|
---|
| 65 | // return message;
|
---|
| 66 | // }
|
---|
| 67 | //
|
---|
| 68 | // /**
|
---|
| 69 | // * @param message the message to set
|
---|
| 70 | // */
|
---|
| 71 | // public void setMessage(String m) {
|
---|
| 72 | // this.message = m;
|
---|
| 73 | // }
|
---|
| 74 | // @Override
|
---|
| 75 | // public String toString()
|
---|
| 76 | // {
|
---|
| 77 | // switch(message)
|
---|
| 78 | // {
|
---|
| 79 | // case "bid":
|
---|
| 80 | // return message+": "+bundle.toString();
|
---|
| 81 | // case "accept":
|
---|
| 82 | // return "Accept!"; might be completed during programming the protocol and agents //break;
|
---|
| 83 | // case "end":
|
---|
| 84 | // return "End!"; // might be completed during programming the protocol and agents //break;
|
---|
| 85 | // default:
|
---|
| 86 | // System.out.println(" Undefined message!");
|
---|
| 87 | // return ""; //return null;
|
---|
| 88 | // }
|
---|
| 89 | // }
|
---|
| 90 | //
|
---|
| 91 | // /**
|
---|
| 92 | // * @param message the message to set
|
---|
| 93 | // */
|
---|
| 94 | // public void setMessage(String m) {
|
---|
| 95 | // this.message = m;
|
---|
| 96 | // }
|
---|
| 97 | //
|
---|
| 98 | //} |
---|