jade.core
Class BehaviourID

java.lang.Object
  extended by jade.core.BehaviourID
All Implemented Interfaces:
Concept, Term, java.io.Serializable

public class BehaviourID
extends java.lang.Object
implements Concept

This class represents an unique identifier referring to a specific agent behaviour.

Version:
$Date: 2006-10-25 18:45:54 +0200 (mer, 25 ott 2006) $ $Revision: 5902 $
Author:
Giovanni Rimassa - Universita' di Parma
See Also:
Serialized Form

Constructor Summary
BehaviourID()
          Default constructor.
BehaviourID(Behaviour b)
          This constructor builds a new behaviour ID, describing the given behaviour object.
 
Method Summary
 void addChildren(BehaviourID bid)
          Adds a new behaviour ID as a child of this one.
 boolean equals(java.lang.Object o)
          Equality test on two behaviour IDs.
 Iterator getAllChildren()
          Retrieve the list of all the children behaviour IDs, as an iterator object.
 java.lang.String getClassName()
          Retrieve the class name implementing the agent behaviour described by this ID.
 int getCode()
          Retrieve the code of this behaviour ID.
 java.lang.String getKind()
          Retrieve the kind of behaviour described by this behaviour ID.
 java.lang.String getName()
          Retrieve the name of this behaviour ID.
 int hashCode()
          Hash code operation, compliant with identity-by-name.
 boolean isSimple()
          Tells whether this behaviour ID has children.
 void setClassName(java.lang.String n)
          Set the class name for this behaviour ID.
 void setCode(int code)
          Set the code of this behaviour ID
 void setKind(java.lang.String k)
          Set the kind of behaviour described by this behaviour ID.
 void setName(java.lang.String n)
          Set the name of this behaviour ID
 java.lang.String toString()
          Create a string representation for this behaviour ID.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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(java.lang.String n)
Set the name of this behaviour ID

Parameters:
n - The name to give to this behaviour ID.

getName

public java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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(java.lang.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 java.lang.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 java.lang.Object

toString

public java.lang.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 java.lang.Object
Returns:
The name of this behaviour ID.