/** * Offer class */ package onetomany.bargainingchipsgame.interactions; import onetomany.bargainingchipsgame.Bundle; /** * An offer has two parts: (1) a bundle or null, (2) 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. * * * @author Faria Nassiri-Mofakham * */ public class Offer { private Bundle bundle; //body of the offer, which is a bundle or null private String message; //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] public Offer() { setBundle(null); setMessage(""); } /** * @return the proposal */ public Bundle getBundle() { return bundle; } /** * @param proposal the proposal to set */ public void setBundle(Bundle b) { this.bundle = b; } /** * @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; } } }