Class Message
java.lang.Object
|
+--Message
- Direct Known Subclasses:
- MessageNegotiate, MessageNegotiateRequest
- public class Message
- extends java.lang.Object
Constructor Summary |
Message(Agent anAgentFrom,
Agent anAgentTo,
java.lang.String aMessage)
Creates a new message to a specific agent |
Message(Agent anAgentFrom,
Base aBaseTo,
java.lang.String aMessage)
Creates a new message to another base ( to all the agents in the other base,
broadcast ) |
Message(Agent anAgentFrom,
java.lang.String aMessage)
Creates a new message to the home base of an agent ( to the neighbors of
our agent, broadcast) |
Method Summary |
void |
deliver()
Delivers the message.
|
Agent |
getAgentFrom()
Returns which agent has sent the message |
java.lang.String |
getMessage()
Returns the string content of the message |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Message
public Message(Agent anAgentFrom,
java.lang.String aMessage)
- Creates a new message to the home base of an agent ( to the neighbors of
our agent, broadcast)
Message
public Message(Agent anAgentFrom,
Base aBaseTo,
java.lang.String aMessage)
- Creates a new message to another base ( to all the agents in the other base,
broadcast )
Message
public Message(Agent anAgentFrom,
Agent anAgentTo,
java.lang.String aMessage)
- Creates a new message to a specific agent
getAgentFrom
public Agent getAgentFrom()
- Returns which agent has sent the message
getMessage
public java.lang.String getMessage()
- Returns the string content of the message
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
deliver
public void deliver()
- Delivers the message.
Call this function to active delivery.