madkit.kernel
Class Message

java.lang.Object
  extended by madkit.kernel.Message
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
ActMessage, BallMessage, ControlMessage, EndDownloadMessage, FicMessage, FormalismMessage, FoundMessage, IndexMessage, KernelMessage, KillMessage, LineChartMessage, NetConfigMessage, NetworkMessage, NetworkRequest, ObjectMessage, OffsetMessage, PluginInfoMessage, PositionMessage, RequestPluginInfoMessage, RequestSearchFileMessage, RequestTreeMessage, ReturnMessage, SearchFileMessage, SearchMessage, SEditMessage, StringMessage, TreeMessage, WarbotMessage, XMLMessage

public class Message
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

The generic MadKit message class. Use a subclass to adapt it to your needs. This class is quite lightweight, it just defines sender and receivers (expressed with AgentAddress class) and automatically stamp the date of send on the message. If security is an issue for the application, implementing the SecuredMessage interface should be considered as, although the default fields of a message could not be altered by receivers (read only or copy), other messages (subclasses of Message) and their content could be intercepted via the hooking mechanism of the kernel. Thus, additional content could be altered by receivers if not read only. Implementing the SecuredMessage interface (and Overriding the default clone method of Message; Do not forget to call super.clone()) will tell the kernel to do a copy of the message for each receiver, ensuring the data security of the original object/content used to build a message.

Version:
3.1
Author:
Olivier Gutknecht, Fabien Michel
See Also:
SecuredMessage, Serialized Form

Constructor Summary
Message()
          Instantiates a new empty message.
 
Method Summary
 Message clone()
           
 java.util.Date getCreationDate()
          Gets the creation date.
 AgentAddress getReceiver()
           
 AgentAddress getSender()
           
 java.lang.String toString()
          Returns a debug string with envelope and content for the message
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Message

public Message()
Instantiates a new empty message.

Method Detail

getSender

public final AgentAddress getSender()
Returns:
the original sender of this message.

getReceiver

public final AgentAddress getReceiver()
Returns:
the intended receiver.

getCreationDate

public final java.util.Date getCreationDate()
Gets the creation date.

Returns:
the creation date for the message (instantiation time)

clone

public Message clone()
Overrides:
clone in class java.lang.Object
Returns:
a shallow copy of the message.

toString

public java.lang.String toString()
Returns a debug string with envelope and content for the message

Overrides:
toString in class java.lang.Object


Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.