Package jade.core
Class BehaviourID
- java.lang.Object
-
- jade.core.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 Summary
Constructors Constructor Description BehaviourID()Default constructor.BehaviourID(Behaviour b)This constructor builds a new behaviour ID, describing the given behaviour object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChildren(BehaviourID bid)Adds a new behaviour ID as a child of this one.booleanequals(Object o)Equality test on two behaviour IDs.IteratorgetAllChildren()Retrieve the list of all the children behaviour IDs, as an iterator object.StringgetClassName()Retrieve the class name implementing the agent behaviour described by this ID.intgetCode()Retrieve the code of this behaviour ID.StringgetKind()Retrieve the kind of behaviour described by this behaviour ID.StringgetName()Retrieve the name of this behaviour ID.inthashCode()Hash code operation, compliant with identity-by-name.booleanisSimple()Tells whether this behaviour ID has children.voidsetClassName(String n)Set the class name for this behaviour ID.voidsetCode(int code)Set the code of this behaviour IDvoidsetKind(String k)Set the kind of behaviour described by this behaviour ID.voidsetName(String n)Set the name of this behaviour IDStringtoString()Create a string representation for this behaviour ID.
-
-
-
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- TheBehaviourobject 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
nullif 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
nullif 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
nullif 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,
trueis returned, andfalseotherwise.
-
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.
-
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.
-
-