Package madkit.kernel
Class Message
java.lang.Object
madkit.kernel.Message
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
ActMessage
,ObjectMessage
,XMLMessage
The generic MaDKit message class. Create Subclasses to adapt it to your
needs. This class is quite lightweight, it just defines sender and receivers
(expressed with
AgentAddress
class).- Version:
- 5
- Author:
- Fabien Michel, Olivier Gutknecht
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Message
clone()
Returns a shadow copy of the message.returns the conversation ID for this message.Returns the agent address corresponding to the agent that receive this message.Returns the agent address corresponding to the agent that sends this message.toString()
-
Constructor Details
-
Message
public Message()
-
-
Method Details
-
getReceiver
Returns the agent address corresponding to the agent that receive this message.- Returns:
- the receiver
-
getSender
Returns the agent address corresponding to the agent that sends this message.- Returns:
- the message's sender or
null
if the message has not been sent by an agent, but by any other kind of object. - See Also:
-
toString
-
clone
Returns a shadow copy of the message. Message subclasses requiring deep copies of their object fields should override this method. Especially, message cloning is used byAbstractAgent.broadcastMessage(String, String, String, Message)
and the like to set different receivers for each cloned message. -
getConversationID
returns the conversation ID for this message. When a message is created, it is given an ID that will be used to tag all the messages that will be created for answering this message usingAbstractAgent.sendReply(Message, Message)
like methods. Especially, if the answer is again used for replying, the ID will be used again to tag this new answer, and so on.- Returns:
- the ID of the conversation to which this message belongs to.
-