Package jade.core

Class BehaviourID

  • All Implemented Interfaces:
    Concept, Term, Serializable, Serializable

    public class BehaviourID
    extends Object
    implements Concept
    This class represents an unique identifier referring to a specific agent behaviour.
    Version:
    $Date$ $Revision$
    Author:
    Giovanni Rimassa - Universita' di Parma
    See Also:
    Serialized Form
    • Constructor Detail

      • BehaviourID

        public BehaviourID()
        Default constructor. Builds an unspecified behaviour ID.
      • BehaviourID

        public BehaviourID​(Behaviour b)
        This constructor builds a new behaviour ID, describing the given behaviour object. The various attributes of the behaviour ID (behaviour name, behaviour class, etc.) are set accordingly.
        Parameters:
        b - The Behaviour object that is to be described with this ID.
    • Method Detail

      • setName

        public void setName​(String n)
        Set the name of this behaviour ID
        Parameters:
        n - The name to give to this behaviour ID.
      • getName

        public String getName()
        Retrieve the name of this behaviour ID.
        Returns:
        The given name, or null if no name was set.
      • setCode

        public void setCode​(int code)
        Set the code of this behaviour ID
        Parameters:
        code - The code to give to this behaviour ID.
      • getCode

        public int getCode()
        Retrieve the code of this behaviour ID.
      • setClassName

        public void setClassName​(String n)
        Set the class name for this behaviour ID. This is the name of the Java class implementing the described agent behaviour.
        Parameters:
        n - The class name of the described behaviour.
      • getClassName

        public String getClassName()
        Retrieve the class name implementing the agent behaviour described by this ID.
        Returns:
        The class name, or null if no class name was set.
      • setKind

        public void setKind​(String k)
        Set the kind of behaviour described by this behaviour ID.
        Parameters:
        k - A string specifying the kind of the described behaviour.
      • getKind

        public String getKind()
        Retrieve the kind of behaviour described by this behaviour ID.
        Returns:
        A string describing the kind of behaviour, or null if no kind was set.
      • addChildren

        public void addChildren​(BehaviourID bid)
        Adds a new behaviour ID as a child of this one. The parent-child relationship between behaviour IDs reflects the one between their described behaviours.
        Parameters:
        bid - The behaviour ID object to add.
      • getAllChildren

        public Iterator getAllChildren()
        Retrieve the list of all the children behaviour IDs, as an iterator object.
        Returns:
        An iterator over the children collection of this behaviour ID.
      • isSimple

        public boolean isSimple()
        Tells whether this behaviour ID has children.
        Returns:
        If the children collection is empty, true is returned, and false otherwise.
      • equals

        public boolean equals​(Object o)
        Equality test on two behaviour IDs. They are considered to be equal if and only if their name, className and kind attributed are the same.
        Overrides:
        equals in class Object
        Parameters:
        o - The right hand side of the equality test (the left hand one being the current object).
        Returns:
        If the o parameter is a behaviour ID with the same name, class name and kind of the current object, true. Otherwise, false is returned.
      • hashCode

        public int hashCode()
        Hash code operation, compliant with identity-by-name. This method returns an hash code for a behaviour ID, so that two behaviour IDs with the same name, class name and kind have the same hash code.
        Overrides:
        hashCode in class Object
      • toString

        public String toString()
        Create a string representation for this behaviour ID. The actual representation is simply the name of the behaviour ID.
        Overrides:
        toString in class Object
        Returns:
        The name of this behaviour ID.