source: src/main/java/onetomany/bargainingchipsgame/interactions/Offer.java@ 267

Last change on this file since 267 was 267, checked in by Tim Baarslag, 5 years ago

Packages cleanup

File size: 2.3 KB
Line 
1/**
2 * Offer class
3 */
4package onetomany.bargainingchipsgame.interactions;
5
6import onetomany.bargainingchipsgame.Bundle;
7
8/**
9 * An offer has two parts: (1) a bundle or null, (2) a message code: `bid', `accept', `end'.
10 * When the code is 'bid', the first part is checked; for the two latter codes, the first part of the offer is null.
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.
13 *
14 * @author Faria Nassiri-Mofakham
15 *
16 */
17public class Offer
18{
19
20 private Bundle bundle; //body of the offer, which is a bundle or null
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]
22 private MessageType message;
23 //private String message;
24
25
26 public Offer()
27 {
28 setBundle(null);
29 setMessage(null);
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 /**
47 * @param message the message to set
48 */
49 public void setMessage(MessageType m) {
50 this.message = m;
51 }
52
53 /**
54 * @return the message
55 */
56 public MessageType getMessage() {
57 return message;
58 }
59}
60
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//}
Note: See TracBrowser for help on using the repository browser.