Agent System POND 1.2 (28.2.2002)

PkgAgentSystem.Messaging
Class BroadcastMessage

java.lang.Object
  |
  +--PkgAgentSystem.Messaging.BroadcastMessage
All Implemented Interfaces:
Cloneable, MessageType, Serializable
Direct Known Subclasses:
SendExperienceMessage

public abstract class BroadcastMessage
extends Object
implements MessageType

A message, which can be sent from one agent to all other local agents (no single recipient).
Subclasses MUST be serializable, else messaging will NOT work!

Version:
1.0, 1.7.2000
Author:
Michael Sonntag
See Also:
AgentBase, AgentSystem.localBroadcastMessage(AgentBase,BroadcastMessage), Serialized Form

Constructor Summary
protected BroadcastMessage()
          Create a new and empty message.
protected BroadcastMessage(AgentIdentity sender, long convTypeID, long srcConvID)
          Creates a new broadcast message from one agent to all others.
 
Method Summary
 BroadcastMessage copy()
          Returns a shallow copy of this message.
 boolean fromInitiator()
          Returns whether this message is from the initiator to the other party/parties or an answer.
 AgentIdentity getAddressee()
          Returns the identity of the recipient of the message.
 long getConversationTypeID()
          Returns the ID of the type of conversations handling this message.
 long getDestConversationID()
          Returns the ID of the conversation at the recipient of the message.
 AgentIdentity getSender()
          Returns the identity of the sender of the message.
 long getSrcConversationID()
          Returns the ID of the conversation at the sender of the message.
 void setAddressee(AgentIdentity addressee)
          Set the addressee of the message.
 void setConversationTypeID(long id)
          Set the type ID for the conversation.
 void setDestConversationID(long id)
          Set the ID for the conversation at the destination.
 void setFromInitiator(boolean fromInitiator)
          Sets whether this message is from the initiator to the other party/parties or an answer.
 void setSender(AgentIdentity sender)
          Set the sender of the message.
 void setSrcConversationID(long id)
          Set the ID for the conversation at the sender.
 String toString()
          Returns a string representation of this broadcast-message.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BroadcastMessage

protected BroadcastMessage()
Create a new and empty message. Such a message can be sent ONLY through a conversation, which will fill in the necessary values.

BroadcastMessage

protected BroadcastMessage(AgentIdentity sender,
                           long convTypeID,
                           long srcConvID)
Creates a new broadcast message from one agent to all others. Has no single recipient and therefore also no destination conversation ID.
Parameters:
sender - the identity of the sender. Must be provided.
convTypeID - ID of the type of the conversation. Must not be 0.
srcConvID - ID of the conversation at the source. Must not be 0 (broadcasts may appear only within conversations).
Method Detail

setSrcConversationID

public void setSrcConversationID(long id)
Set the ID for the conversation at the sender. Only allowed if the ID is currently 0.
Specified by:
setSrcConversationID in interface MessageType
Parameters:
id - the id of the conversation at the sender (may not be 0)

getSrcConversationID

public long getSrcConversationID()
Returns the ID of the conversation at the sender of the message.
Specified by:
getSrcConversationID in interface MessageType
Returns:
conversation ID of the sender

setDestConversationID

public void setDestConversationID(long id)
Set the ID for the conversation at the destination. Only allowed if the ID is currently 0.
Specified by:
setDestConversationID in interface MessageType
Parameters:
id - the id of the conversation at the destination (may not be 0)

getDestConversationID

public long getDestConversationID()
Returns the ID of the conversation at the recipient of the message.
Specified by:
getDestConversationID in interface MessageType
Returns:
conversation ID of the recipient

fromInitiator

public boolean fromInitiator()
Returns whether this message is from the initiator to the other party/parties or an answer. Is always true for broadcasts!
Specified by:
fromInitiator in interface MessageType
Returns:
always true

setFromInitiator

public void setFromInitiator(boolean fromInitiator)
Sets whether this message is from the initiator to the other party/parties or an answer.
Specified by:
setFromInitiator in interface MessageType
Parameters:
fromInitiator - Must always be true!
Throws:
IllegalArgumentException - if false

setConversationTypeID

public void setConversationTypeID(long id)
Set the type ID for the conversation. Only allowed if the ID is currently 0.
Specified by:
setConversationTypeID in interface MessageType
Parameters:
id - the id of the type of the conversation (may not be 0)

getConversationTypeID

public long getConversationTypeID()
Returns the ID of the type of conversations handling this message.
Specified by:
getConversationTypeID in interface MessageType
Returns:
conversation type ID of this message

setSender

public void setSender(AgentIdentity sender)
Set the sender of the message. Only allowed if the sender is currently null.
Specified by:
setSender in interface MessageType
Parameters:
sender - the sender for the message (may not be null)

getSender

public AgentIdentity getSender()
Returns the identity of the sender of the message.
Specified by:
getSender in interface MessageType
Returns:
identity of the sender

setAddressee

public void setAddressee(AgentIdentity addressee)
Set the addressee of the message. Only allowed if the addressee is currently null.
Specified by:
setAddressee in interface MessageType
Parameters:
sender - the addressee for the message (may not be null)

getAddressee

public AgentIdentity getAddressee()
Returns the identity of the recipient of the message.
Specified by:
getAddressee in interface MessageType
Returns:
identity of the recipient

toString

public String toString()
Returns a string representation of this broadcast-message. The representation is the name of the actual class of the message and the name of the sender.
Overrides:
toString in class Object
Returns:
string representation of this broadcast

copy

public BroadcastMessage copy()
                      throws MessageException
Returns a shallow copy of this message.
Returns:
a clone of this message
Throws:
MessageException - if this message cannot be cloned

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.