|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.ksu.cis.cooprobot.simulator.communication.Message
This class represents format of message which passes back and forth between
robots in the system. The content in a message is composed of
- Sender
- Receiver
- The time that message was sent.
- The expected time that message will be delivered to the receiver.
- The real content of a message
The sent time will be automatically filled in with the current time step By the time message is created the received time will be blank until the message is passed to the process of sending message. The received time will be filled out based on system delay and robot delay.
In order to passing an object across TCP/IP connection, this object must implement Serializable.
Field Summary | |
private Object |
content
The actual content of a message which can be any object. |
static Message |
NULL_MESSAGE
|
private long |
receivedTime
The expected time which message will be delivered to the recipients. |
private String |
receiver
Message receiver. |
private String |
sender
Message sender |
private long |
sentTime
The time which message was sent. |
Constructor Summary | |
Message()
Constructor of Message class |
|
Message(String sender,
String receiver,
Object content)
Contructor of Message class |
Method Summary | |
Object |
getContent()
Get content of a message |
long |
getReceivedTime()
Get expected time which receiver will get this message |
String |
getReceiver()
Get receiver name |
String |
getSender()
Get sender name |
long |
getSentTime()
Get message sent time |
boolean |
isBroadcastMessage()
Check if this message is broadcast message. |
boolean |
isNullMessage()
|
boolean |
isP2PMessage()
Check if this message is point-to-point message. |
void |
setContent(Object content)
Set message content |
void |
setReceivedTime(long time)
Set expected received time |
void |
setReceiver(String name)
Set receiver name |
void |
setSender(String name)
Set sender name |
void |
setSentTime(long time)
Set message sent time. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Message NULL_MESSAGE
private String sender
private String receiver
private long sentTime
private long receivedTime
private Object content
Constructor Detail |
public Message()
public Message(String sender, String receiver, Object content)
sender
- - message senderreceiver
- - message receivercontent
- - actual content of messageMethod Detail |
public String getSender()
public String getReceiver()
public long getSentTime()
public long getReceivedTime()
public Object getContent()
public void setSender(String name)
name
- - sender namepublic void setReceiver(String name)
name
- - receiver namepublic void setSentTime(long time)
time
- - message sent timepublic void setReceivedTime(long time)
time
- - expected received timepublic void setContent(Object content)
content
- - message contentpublic boolean isBroadcastMessage()
public boolean isP2PMessage()
public boolean isNullMessage()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |