Class Component

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable

    public class Component
    extends ParameterElement
    The Agent object.
    See Also:
    Serialized Form
    • Field Detail

      • DUMMY_COMPONENT

        public static final Component DUMMY_COMPONENT
        The dummy agent
      • DUMMY_NAME

        public static final java.lang.String DUMMY_NAME
        The name for the dummy agent
        See Also:
        Constant Field Values
      • AGENT_ATTRIBUTES

        public static final java.util.List AGENT_ATTRIBUTES
        The allowed message attributes.
      • messages

        protected java.util.List messages
        The messages send or received by the agent
    • Constructor Detail

      • Component

        public Component()
        Constructor for a dummy agent which represents every agent not present on the canvas.
      • Component

        public Component​(IComponentDescription desc)
        Constructor for any named agent to be put on the Agent Canvas
    • Method Detail

      • getDeclaredAttributes

        public static final java.lang.String[] getDeclaredAttributes()
        Returns:
        The declared agent attributes.
      • getParameters

        public java.util.Map getParameters()
        Returns the parameter map.
        Overrides:
        getParameters in class ParameterElement
        Returns:
        The parameter map.
      • getParameter

        public java.lang.Object getParameter​(java.lang.String name)
        Returns the parameter with the given name.
        Overrides:
        getParameter in class ParameterElement
        Parameters:
        name - The parameter name.
        Returns:
        The parameter object
      • getState

        public java.lang.String getState()
        Returns:
        The state.
      • setState

        public void setState​(java.lang.String state)
        Parameters:
        state - The state to set.
      • applyFilter

        public boolean applyFilter​(ComponentFilter[] filter,
                                   boolean zeromessages)
        Applies a filter to the agent and returns if the visibility has changed.
        Parameters:
        filter - The array of filters to apply to.
        zeromessages - True if the zero message filter should be applied
        Returns:
        True if visibility has changed.
      • getMessages

        public java.util.List getMessages()
        Returns the messages send or received by the agent.
        Returns:
        The array of messages.
      • setMessages

        public void setMessages​(java.util.List messages)
        Set the messages.
        Parameters:
        messages - The messages.
      • addMessage

        public void addMessage​(Message message)
        Adds a message to the agent.
        Parameters:
        message - The message to add to the agent.
      • removeMessage

        public void removeMessage​(Message message)
        Removes a message from the agent.
        Parameters:
        message - The message to remove.
      • removeAllMessages

        public void removeAllMessages()
        Removes all messages send or received by the agent.
      • getId

        public java.lang.String getId()
        Specified by:
        getId in class ParameterElement
        Returns:
        The id of the element.
      • compareTo

        public int compareTo​(java.lang.Object o)
        Agents are compared by their names. Only the dummy agent is always the first in line.
        Specified by:
        compareTo in interface java.lang.Comparable
        Overrides:
        compareTo in class ParameterElement
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class ParameterElement
        Returns:
        The string representation.