com.ls.lars.communication
Class MulticastMessage
java.lang.Object
|
+--com.ls.lars.communication.Message
|
+--com.ls.lars.communication.MulticastMessage
- All Implemented Interfaces:
- Cloneable, Comparable, Serializable
- public class MulticastMessage
- extends Message
A broadcast message is sent to a list of receivers. Each of the specified receivers gets a clone of the
original message.
Message object for the communication between the agents.
Note, that the Message object is not synchronized!
Standard for naming message services:
- a message service is written in lower case
- if a service consists of multiple words, they are separated by an underscore ("_"), e.g. "set_constants"
This standard is needed for automatic registration of "interpret"-methods in agents.
- Version:
- $Revision: 1.3 $
- Author:
- Last modified by $Author: ODrugan $
- See Also:
- Serialized Form
Fields inherited from class com.ls.lars.communication.Message |
ADDRESS_CONFIG, ADDRESS_LARS_INTERNAL, EXPIRE_HOPS_DEFAULT, MESSAGE_TYPE_GROUP, MESSAGE_TYPE_MULTICAST, MESSAGE_TYPE_SERVICE_BROADCAST, MESSAGE_TYPE_SERVICE_SINGLE, MESSAGE_TYPE_SINGLE, PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_NORMAL, PRIORITY_SYSTEM, PRIORITY_TEXT_HIGH, PRIORITY_TEXT_LOW, PRIORITY_TEXT_NORMAL, SERVICE_UNKNOWN, TAG_CONTENT, TAG_CURRENT_HOPS, TAG_EXPIRE_HOPS, TAG_FORWARDED_BY, TAG_IN_REPLY_TO, TAG_MESSAGE, TAG_PRIORITY, TAG_QUALITY_OF_SERVICE, TAG_REPLY_COUNTER, TAG_REPLY_WITH, TAG_SENDER, TAG_SENT_TIME, TAG_SERVICE, TAG_TYPE |
Method Summary |
List |
getReceiver()
returns the names of the receiver agent |
boolean |
hasInvalidReceiver()
calls MulticastMessage.hasInvalidReceiver(this.receiver) |
static boolean |
hasInvalidReceiver(List receivers)
Rudimentary checks this message, if it contains in the list of agent an invalid receiver address.
|
protected Map |
inheritorToMap()
returns a map containing the MulticastMessage specific fields (type and receiver) |
protected String |
inheritorToString()
returns a well formatted string containing the MulticastMessage specific fields (type and receivers) |
Methods inherited from class com.ls.lars.communication.Message |
clone, compareTo, createMessage, createReply, getContent, getCurrentHops, getExpireHops, getForwardedBy, getInReplyTo, getPriority, getQualityOfService, getReplyWith, getSender, getSentTime, getService, hasInvalidSender, hop, increasePriority, isExpired, isSent, setExpireHops, setInReplyTo, setPriority, setPriority, setQualityOfService, setQualityOfService, setReplyWith, setSystemPriority, toMap, toString, toStringWithContent |
TAG_RECEIVER
public static final String TAG_RECEIVER
- string that represent the "receiver"
MulticastMessage
public MulticastMessage(String service,
List receivers,
Object content)
throws InvalidArgumentException
- sets all fields of a message including the content object
- Parameters:
service
- service of the messagereceivers
- the names of the agents that will receive this messagecontent
- content of the message as a hash- Throws:
InvalidArgumentException
- if given service or receiver is null or empty or contains only whitespace
characters or if given content is null
getReceiver
public final List getReceiver()
- returns the names of the receiver agent
- Returns:
- names of this receiver agent
hasInvalidReceiver
public final boolean hasInvalidReceiver()
- calls MulticastMessage.hasInvalidReceiver(this.receiver)
- Returns:
hasInvalidReceiver(this.receiver)
hasInvalidReceiver
public static boolean hasInvalidReceiver(List receivers)
- Rudimentary checks this message, if it contains in the list of agent an invalid receiver address.
A receiver address is assumed to be invalid, if any of the following cases is true: receiver ...
- ... is Message.ADDRESS_CONFIG
- ... is Message.ADDRESS_LARS_INTERNAL
- Parameters:
receivers
- the list with all the receivers of the message- Returns:
- true, if one receiver is one cases above evaluates to true; false else
inheritorToMap
protected Map inheritorToMap()
- returns a map containing the MulticastMessage specific fields (type and receiver)
- Overrides:
inheritorToMap
in class Message
- Returns:
- MulticastMessage specific fields as a Map
inheritorToString
protected String inheritorToString()
- returns a well formatted string containing the MulticastMessage specific fields (type and receivers)
- Overrides:
inheritorToString
in class Message
- Returns:
- MulticastMessage specific fields as a well-formatted string