transport.protocol
Class UnicastMessage

java.lang.Object
  |
  +--transport.protocol.Message
        |
        +--transport.protocol.P2PMessage
              |
              +--transport.protocol.UnicastMessage
All Implemented Interfaces:
java.io.Serializable

public class UnicastMessage
extends P2PMessage
implements java.io.Serializable

This class represents a Multicast message. This message is sent by agents to the simulator, the simulator then sends the message to all agents that are with within range and certain number of hops.

See Also:
Serialized Form

Field Summary
private  java.lang.String message
          The string content of this Message.
private  int topeer
           
 
Fields inherited from class transport.protocol.P2PMessage
 
Fields inherited from class transport.protocol.Message
 
Constructor Summary
UnicastMessage(java.lang.String message, int to, int from)
          This constructor initializes the Message.
UnicastMessage(java.lang.String message, int to, int from, int hops)
          This constructor initializes the Message.
 
Method Summary
 java.lang.String getMessage()
          This method returns the String content of the message.
 int getToPeer()
          This method returns the String content of the message.
 
Methods inherited from class transport.protocol.P2PMessage
getContent, getHops, setContent
 
Methods inherited from class transport.protocol.Message
getFrom, getTo, setTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

message

private java.lang.String message
The string content of this Message.


topeer

private int topeer
Constructor Detail

UnicastMessage

public UnicastMessage(java.lang.String message,
                      int to,
                      int from)
This constructor initializes the Message. Object content must be added seperately with setContent() method, and the object must be Serializable.

Parameters:
message - The String message.
from - The port the message sender listens to.

UnicastMessage

public UnicastMessage(java.lang.String message,
                      int to,
                      int from,
                      int hops)
This constructor initializes the Message. Object content must be added seperately with setContent() method, and the object must be Serializable.

Parameters:
message - The String message.
from - The port the message sender listens to.
hops - The max number of hops.
Method Detail

getMessage

public java.lang.String getMessage()
This method returns the String content of the message.

Returns:
String The message.

getToPeer

public int getToPeer()
This method returns the String content of the message.

Returns:
String The message.