com.agentfactory.cldc.mts
Class IDSet

java.lang.Object
  extended by com.agentfactory.cldc.mts.IDSet

public class IDSet
extends java.lang.Object

A set of agent IDs.

Author:
Conor Muldoon

Constructor Summary
IDSet()
          Creates a new instance of IDSet.
 
Method Summary
 void addID(AID id)
          Adds an agent ID to the set.
 FOS createIDFOS()
          Creates a first order structure representation of the ID set.
 FOS createMessage(java.lang.String localAddress, FOS messageTo, java.lang.String performative, AgentName senderName, FOS content, java.util.Hashtable pending)
           
 FOS sendOut(MessageTransportService mts, FOS messageTo, java.lang.String performative, AgentName agentName, FOS content, java.util.Hashtable pending)
          This method adds a message to the outgoing list if the agent ID of the agent that the message is intended for is in the set.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDSet

public IDSet()
Creates a new instance of IDSet.

Method Detail

addID

public void addID(AID id)
Adds an agent ID to the set.

Parameters:
id - the agent ID that is added.

sendOut

public FOS sendOut(MessageTransportService mts,
                   FOS messageTo,
                   java.lang.String performative,
                   AgentName agentName,
                   FOS content,
                   java.util.Hashtable pending)
            throws MalformedLogicException
This method adds a message to the outgoing list if the agent ID of the agent that the message is intended for is in the set. Otherwise the message is stored in the pending hashtable until the relevant agent ID is obtained.

Parameters:
mts - the local message transport service.
messageTo - the name of the agent that the message is to be sent to.
performative - the performative of the message.
agentName - the name of the message sender.
content - the content of the message.
pending - a hashtable that stores pending messages.
Returns:
null if the ID of the agent that the message is for is not in the set or if the message transport service is operating in synchronous mode. Otherwise a first order structure representation of the message is returned.
Throws:
MalformedLogicException - if there is a logic error.

createMessage

public FOS createMessage(java.lang.String localAddress,
                         FOS messageTo,
                         java.lang.String performative,
                         AgentName senderName,
                         FOS content,
                         java.util.Hashtable pending)

createIDFOS

public FOS createIDFOS()
                throws MalformedLogicException
Creates a first order structure representation of the ID set. The first order structure will be of the form id(?id1,?id2,...?idN).

Returns:
the first order structure representation of the ID set.
Throws:
MalformedLogicException - if there is a logic error.