Package jade.core
Class AgentState
- java.lang.Object
-
- jade.core.AgentState
-
public class AgentState extends Object
This class represents the Life-Cycle state of an agent.- Version:
- $Date$ $Revision$
- Author:
- Giovanni Rimassa - Universita' di Parma
-
-
Constructor Summary
Constructors Constructor Description AgentState()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object o)Compares two agent states.booleanequals(Object o)Equality operations between agent states.static AgentState[]getAllInstances()Access the whole prototypes array.static AgentStategetInstance(int value)Static access method to retrieve a prototype object for an agent life-cycle state.StringgetName()Retrieve the name of this state.intgetValue()Retrieve the numeric value of this state, in agreement with theAP_XXXconstants defined in theAgentclass.inthashCode()Calculate an hash code for this agent state.voidsetName(String n)Set the name of this state.voidsetValue(int v)Set the numeric value of this state, in agreement with theAP_XXXconstants defined in theAgentclass.StringtoString()Retrieve a string representation for this agent state.
-
-
-
Method Detail
-
getInstance
public static AgentState getInstance(int value)
Static access method to retrieve a prototype object for an agent life-cycle state.- Parameters:
value- One of theAP_XXXconstants defined in theAgentclass.- Returns:
- A prototype object for the requested state.
-
getAllInstances
public static AgentState[] getAllInstances()
Access the whole prototypes array.- Returns:
- All the defined prototype objects for the life-cycle states.
-
setName
public void setName(String n)
Set the name of this state.- Parameters:
n- The name to give.
-
getName
public String getName()
Retrieve the name of this state.- Returns:
- The state name.
-
setValue
public void setValue(int v)
Set the numeric value of this state, in agreement with theAP_XXXconstants defined in theAgentclass.- Parameters:
v- The numeric value for this state.
-
getValue
public int getValue()
Retrieve the numeric value of this state, in agreement with theAP_XXXconstants defined in theAgentclass.- Returns:
- The numeric value set for this state.
-
equals
public boolean equals(Object o)
Equality operations between agent states. The equality operation is defined as equality by state name (case insensitive string comparison is used).
-
toString
public String toString()
Retrieve a string representation for this agent state.
-
compareTo
public int compareTo(Object o)
Compares two agent states. A lexicographical, case insensitive comparison on state name is used.- Parameters:
o- The object to compare the current object to.- Returns:
- An integer value,
-1,0or1depending upon whether the current object is lesser, equal or greater than the given parameter. - Throws:
ClassCastException- If the given parameter is not an instance ofAgentState.
-
-