Package jade.wrapper
Class StateBase
- java.lang.Object
-
- jade.wrapper.StateBase
-
- All Implemented Interfaces:
Comparable,Serializable,State,Serializable,Comparable
- Direct Known Subclasses:
AgentState,PlatformState
public abstract class StateBase extends Object implements State, Comparable, Serializable
Provides an abstract base class for implementations of state.
NOT available in MIDP- Author:
- David Bell, Dick Cowan: Hewlett-Packard
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object object)Compares a given object to this state object for the purpose of collating.booleanequals(Object object)Determines if an object is equal to this object.intgetCode()Return the integer code that identifies this state.StringgetName()Returns the descriptive name of the state.inthashCode()Returns the hash code for this state.StringtoString()A string representation of this state.
-
-
-
Method Detail
-
getName
public String getName()
Returns the descriptive name of the state.
-
getCode
public int getCode()
Return the integer code that identifies this state.
-
equals
public boolean equals(Object object)
Determines if an object is equal to this object. In order for the the passed object to be equal to this one the passed object must be an instance if State and contain the same state code.
-
compareTo
public int compareTo(Object object)
Compares a given object to this state object for the purpose of collating. This method is used for the sorting of states. A positive value means the receiver (this object) is "greater than" the passed object. A negative value means the receiver is "less than" the passed object. A value of zero means the receiver and the passed object are equal to each other.- Specified by:
compareToin interfaceComparable- Parameters:
object- An object to compare this object to.- Returns:
- The result of the comparison.
The value 1 is returned if:
- the passed object is null (the receiver is considered "greater than" null objects)
- the state code held by the receiver (this object) is greater than the code of the passed object
The value 0 (zero) is returned if:
- the two state objects hold the same state code
The value -1 is returned if:
- the passed object is not a AgentStateImpl object (the receiver is considered "less than" objects of other types)
- the state code held by the receiver (this object) is less than the code of the passed object
-
hashCode
public int hashCode()
Returns the hash code for this state. The hash code equals the state code.
-
-