All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sics.agentbase.core.AgentMessage

java.lang.Object
   |
   +----sics.agentbase.core.Message
           |
           +----sics.agentbase.core.AgentMessage

public class AgentMessage
extends Message

Variable Index

 o fields
Table containing all valid field names as Strings.
 o messageTree
Datastructure containing the message.
 o types
Table containing all valid message types as Strings.

Constructor Index

 o AgentMessage()
Constructs an empty Agent Message.

Method Index

 o getMessageField(String)
Returns the specified message field.
 o getMessageType()
Returns the message type.
 o makeHash(String[])
Generates a Hashtable containing all the keys in the specified array and with an empty string as value.
 o readMessage(InputStream)
Reads and parses a message from the specified input stream.
 o setMessageField(String, Node)
Sets the specified message field.
 o setMessageType(String)
Set the message type for this message.
 o toString()
Returns a string representation of this message.

Variables

 o fields
 protected Hashtable fields
Table containing all valid field names as Strings.

 o types
 protected Hashtable types
Table containing all valid message types as Strings.

 o messageTree
 protected ASTSNode messageTree
Datastructure containing the message.

Constructors

 o AgentMessage
 public AgentMessage()
Constructs an empty Agent Message.

Methods

 o makeHash
 protected static final Hashtable makeHash(String keys[])
Generates a Hashtable containing all the keys in the specified array and with an empty string as value.

Parameters:
keys - a string array with keys.
Returns:
a Hashtable with the specified keys.
 o getMessageType
 public synchronized String getMessageType()
Returns the message type.

Returns:
the message type or null if none exists.
 o setMessageType
 public synchronized void setMessageType(String type) throws IOException
Set the message type for this message.

Parameters:
type - the message type.
Throws: IOException
if an illegal message type is specified.
 o getMessageField
 protected synchronized Node getMessageField(String name)
Returns the specified message field.

Parameters:
name - the name of the message field to be returned.
Returns:
the value of the message field or null if the field does not exist.
 o setMessageField
 protected synchronized void setMessageField(String name,
                                             Node node) throws IOException
Sets the specified message field.

Parameters:
name - the name of the message field to set.
node - the value of the message field to set.
Throws: IOException
if an illegal message type is specified.
 o readMessage
 public synchronized void readMessage(InputStream stream) throws IOException
Reads and parses a message from the specified input stream. The new values replaces the current values in the message.

Parameters:
stream - the input stream to read from.
Throws: IOException
if an I/O or parse error occurs.
 o toString
 public synchronized String toString()
Returns a string representation of this message.

Returns:
a string representation of this message.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index