|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--fipaos.agent.AgentList
This class implements a specific list type data structure to store lists
of agents of specific types. The idea is that this list structure provides
a convenient way of storing lists of agents that we are registered with, or
a list of agents that we are waiting on etc. The data structure lets you store
an agent name or AgentGUID object with an associated type/id/string. You can then
search the structure for the name or identifier and receive specific objects
or lists of objects back.
Constructor Summary | |
AgentList()
Constructs an empty agent list. |
Method Summary | |
boolean |
add(java.lang.Object name,
java.lang.String type)
Adds a new agent to the list. |
void |
clear()
Removes every element in the list. |
boolean |
contains(java.lang.Object name)
Indicates whether this list contains the agent name specified. |
boolean |
containsType(java.lang.String type)
Indicates whether this list contains any elements added with an associated string that matches the type parameter. |
AgentID[] |
getAIDs(java.lang.String type)
Returns every agent name with the associated type specified by the type parameter in an array of AgentGUIDs. |
java.lang.String[] |
getNames(java.lang.String type)
Returns every agent name with the associated type specified by the type parameter in an array of Strings. |
java.lang.String |
getType(java.lang.Object name)
Returns the type/id/string of the specified agent name. |
void |
remove(java.lang.Object name)
Removes an agent from the list. |
void |
removeAll()
Removes every element in the list. |
void |
removeAll(java.lang.String type)
Removes all agents with the given type/id parameter. |
java.lang.String |
toString()
Returns a string representation of the contents of the agent list. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AgentList()
Method Detail |
public boolean add(java.lang.Object name, java.lang.String type)
name
- A String or AgentGUID representing the agent to be stored in the listtype
- A String that can hold whatever data you like. For example, it could be the type
of an agent (df, ams, oa, arb etc) or it could be some other data.public void remove(java.lang.Object name)
name
- The String or AgentGUID object to remove.public void removeAll(java.lang.String type)
type
- The type/id/string of the agent names to removepublic void removeAll()
public void clear()
public boolean contains(java.lang.Object name)
name
- The agent name to look for in the list (as a String or AgentID)public boolean containsType(java.lang.String type)
type
- The type/id/string to look for in the listpublic java.lang.String getType(java.lang.Object name)
name
- The String or AgentGUID of the agent of whose type you wish to findpublic java.lang.String[] getNames(java.lang.String type)
type
- The type/id/string associated with the names that you wish to extractpublic AgentID[] getAIDs(java.lang.String type)
type
- The type/id/string associated with the names that you wish to extractpublic java.lang.String toString()
[ {agent-name, type/id/string}, ... ]
e.g.
[ {agent@iiop://45.45.45.45:9000/acc, df}, {agent2@iiop://67.45.34.564:90/Agency/FIPA_Agent_97, ams} ]
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |