Package jadex.tools.comanalyzer
Class ComponentList
- java.lang.Object
-
- jadex.tools.comanalyzer.ComponentList
-
- All Implemented Interfaces:
java.io.Serializable
public class ComponentList extends java.lang.Object implements java.io.SerializableA list of Agents. This class provides methods to notify other classes which are implementing the IAgentListListener interface about adding, changing and removing of agents.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ComponentList()Default constructor for the agent list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAgent(Component agent)Adds an agent to the list.protected voidaddListener(IComponentListListener listener)Register for agent events.booleancontainsAgent(Component agent)Checks if an agent is contained in the agent list.protected voidfireAgentsAdded(Component[] agents)Notifies the listeners about the adding of agents.protected voidfireAgentsChanged(Component[] agents)Notifies the listeners about agents with changed visibility.protected voidfireAgentsRemoved(Component[] agents)Notifies the listeners about the removal of agents.ComponentgetAgent(IComponentIdentifier aid)Returns the agent from the list with the same identifierComponent[]getAgents()java.util.ListgetList()java.util.Iteratoriterator()voidremoveAgent(Component agent)voidremoveAllAgents()Clears the agent list and notifies all listenersintsize()
-
-
-
Method Detail
-
addAgent
public void addAgent(Component agent)
Adds an agent to the list.- Parameters:
agent- The agent to add.
-
removeAgent
public void removeAgent(Component agent)
- Parameters:
agent- The agent to remove.
-
removeAllAgents
public void removeAllAgents()
Clears the agent list and notifies all listeners
-
getList
public java.util.List getList()
- Returns:
- The list of agents.
-
getAgents
public Component[] getAgents()
- Returns:
- The array of agents.
-
containsAgent
public boolean containsAgent(Component agent)
Checks if an agent is contained in the agent list.- Parameters:
agent- The agent to check.- Returns:
trueif a specific agent is in the agentlist.
-
getAgent
public Component getAgent(IComponentIdentifier aid)
Returns the agent from the list with the same identifier- Parameters:
aid- The agent identifier.- Returns:
- The agent or
nullif there is no agent with the same identifier in the list.
-
iterator
public java.util.Iterator iterator()
- Returns:
- The agent list iterator.
-
size
public int size()
- Returns:
- The size of the agentlist.
-
addListener
protected void addListener(IComponentListListener listener)
Register for agent events.- Parameters:
listener- A class implementing the IAgentListListener interface.
-
fireAgentsRemoved
protected void fireAgentsRemoved(Component[] agents)
Notifies the listeners about the removal of agents.- Parameters:
agents- The removed agents.
-
fireAgentsAdded
protected void fireAgentsAdded(Component[] agents)
Notifies the listeners about the adding of agents.- Parameters:
agents- The added agents.
-
fireAgentsChanged
protected void fireAgentsChanged(Component[] agents)
Notifies the listeners about agents with changed visibility.- Parameters:
agents- The changed agents.
-
-