[127] | 1 | package agents.qoagent2;
|
---|
| 2 |
|
---|
| 3 | //file name: Message.java
|
---|
| 4 |
|
---|
| 5 | /*****************************************************************
|
---|
| 6 | * Class name: Message
|
---|
| 7 | * Goal: Saving a message that was sent from one side of the
|
---|
| 8 | * negotiation to another side. A message contains the message ID
|
---|
| 9 | * and the body (the content).
|
---|
| 10 | ****************************************************************/
|
---|
| 11 | class Message
|
---|
| 12 | {
|
---|
| 13 | private String m_sID;
|
---|
| 14 | private String m_sBody;
|
---|
| 15 |
|
---|
| 16 | /*****************************************************************
|
---|
| 17 | * Method name: Message()
|
---|
| 18 | * Goal: Constructor.
|
---|
| 19 | * Description: Initialize the class variables.
|
---|
| 20 | * Input: Two strings - the message ID and its body.
|
---|
| 21 | * Output: None.
|
---|
| 22 | ****************************************************************/
|
---|
| 23 | public Message(String id, String body)
|
---|
| 24 | {
|
---|
| 25 | m_sID=id;
|
---|
| 26 | m_sBody=body;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | /*****************************************************************
|
---|
| 30 | * Method name: setId()
|
---|
| 31 | * Goal: Setting the message ID.
|
---|
| 32 | * Input: A string.
|
---|
| 33 | * Output: None.
|
---|
| 34 | ****************************************************************/
|
---|
| 35 | public void setId(String id)
|
---|
| 36 | {
|
---|
| 37 | m_sID=id;
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | /*****************************************************************
|
---|
| 41 | * Method name: setBody()
|
---|
| 42 | * Goal: Setting the message body.
|
---|
| 43 | * Input: A string.
|
---|
| 44 | * Output: None.
|
---|
| 45 | ****************************************************************/
|
---|
| 46 | public void setBody(String body)
|
---|
| 47 | {
|
---|
| 48 | m_sBody=body;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | /*****************************************************************
|
---|
| 52 | * Method name: getId()
|
---|
| 53 | * Goal: Return the message ID.
|
---|
| 54 | * Input: None.
|
---|
| 55 | * Output: A string.
|
---|
| 56 | ***************************************************************/
|
---|
| 57 | public String getId()
|
---|
| 58 | {
|
---|
| 59 | return m_sID;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | /*****************************************************************
|
---|
| 63 | * Method name: getBody()
|
---|
| 64 | * Goal: Return the message body.
|
---|
| 65 | * Input: None.
|
---|
| 66 | * Output: A string.
|
---|
| 67 | ***************************************************************/
|
---|
| 68 | public String getBody()
|
---|
| 69 | {
|
---|
| 70 | return m_sBody;
|
---|
| 71 | }
|
---|
[1] | 72 | } |
---|