/** * Offer class */ package onetomany.bargainingchipsgame.interactions; import onetomany.bargainingchipsgame.Bundle; /** * An offer has two parts: (1) a bundle or null, (2) a message code: `bid', `accept', `end'. * When the code is 'bid', the first part is checked; for the two latter codes, the first part of the offer is null. * In other words, message `bid' means that offer contains a bundle which is proposed, `accept' means offer contains no bundle to propose, * but an agreement with the deal (the received offer), and `end' again means that nothing to propose, and quitting the negotiation. * * @author Faria Nassiri-Mofakham * */ public class Offer { private Bundle bundle; //body of the offer, which is a bundle or null //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] private MessageType message; //private String message; public Offer() { setBundle(null); setMessage(null); } /** * @return the proposal */ public Bundle getBundle() { return bundle; } /** * @param proposal the proposal to set */ public void setBundle(Bundle b) { this.bundle = b; } /** * @param message the message to set */ public void setMessage(MessageType m) { this.message = m; } /** * @return the message */ public MessageType getMessage() { return message; } } // /** // * @return the message // */ // public String getMessage() { // return message; // } // // /** // * @param message the message to set // */ // public void setMessage(String m) { // this.message = m; // } // @Override // public String toString() // { // switch(message) // { // case "bid": // return message+": "+bundle.toString(); // case "accept": // return "Accept!"; might be completed during programming the protocol and agents //break; // case "end": // return "End!"; // might be completed during programming the protocol and agents //break; // default: // System.out.println(" Undefined message!"); // return ""; //return null; // } // } // // /** // * @param message the message to set // */ // public void setMessage(String m) { // this.message = m; // } // //}