Class ComponentList

  • All Implemented Interfaces:
    java.io.Serializable

    public class ComponentList
    extends java.lang.Object
    implements java.io.Serializable
    A 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 Detail

      • ComponentList

        public ComponentList()
        Default constructor for the agent list.
    • 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:
        true if 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 null if 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.