|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object p2p.simulator.message.Message
public class Message
The class Message creates and manages the messages that are being delivered among peers.
Field Summary | |
---|---|
int |
method
|
Constructor Summary | |
---|---|
Message(long src,
long dest,
MessageBody data)
Creates a new message. |
Method Summary | |
---|---|
MessageBody |
getData()
Returns the message's data. |
long |
getDestinationId()
Returns the peer id of the receiver. |
int |
getHops()
Returns the number of times this message has been forwarded. |
int |
getMethod()
Returns the transmittion method of the message. |
long |
getMsgId()
Returns the unique message's identifier. |
long |
getSourceId()
Returns the peer id of the transmitter. |
int |
getType()
Returns the message's data type. |
void |
incHops()
Increases the number of hops by one. |
void |
setData(MessageBody data)
Sets the message data. |
void |
setDestinationId(long id)
Sets the peer id of the receiver. |
void |
setMethod(int meth)
Sets the message's transmittion method. |
void |
setSourceId(long id)
Sets the peer id of the transmitter. |
java.lang.String |
toString()
Creates a string with the following message's fields: transmitter's id, receiver's id, type of message, number of hops and their respective values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int method
Constructor Detail |
---|
public Message(long src, long dest, MessageBody data)
src
- The peer's id that sends the message.dest
- The peer's id of the message's destination.data
- The message's data.Method Detail |
---|
public long getSourceId()
public void setSourceId(long id)
id
- The peer's id.public void setDestinationId(long id)
id
- public long getDestinationId()
public int getType()
public long getMsgId()
public int getHops()
public void incHops()
public void setMethod(int meth)
meth
- The transmittion method.public int getMethod()
public MessageBody getData()
public void setData(MessageBody data)
data
- The messages data.public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |