Package madkit.kernel

Class Message

All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
ActMessage, ObjectMessage, XMLMessage

public class Message extends Object implements Cloneable, Serializable
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).
Fabien Michel, Olivier Gutknecht
See Also:
  • Constructor Details

    • Message

      public Message()
  • Method Details

    • getReceiver

      public AgentAddress getReceiver()
      Returns the agent address corresponding to the agent that receive this message.
      the receiver
    • getSender

      public AgentAddress getSender()
      Returns the agent address corresponding to the agent that sends this message.
      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

      public String toString()
      toString in class Object
    • clone

      protected Message 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 by AbstractAgent.broadcastMessage(String, String, String, Message) and the like to set different receivers for each cloned message.
      clone in class Object
      a shadow copy of the message.
    • getConversationID

      public ConversationID 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 using AbstractAgent.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.
      the ID of the conversation to which this message belongs to.