Save This Page
Home » jboss-5.0.0.CR1-src » org » jboss » util » state » [javadoc | source]
org.jboss.util.state
public class: State [javadoc | source]
java.lang.Object
   org.jboss.util.CloneableObject
      org.jboss.util.state.State

All Implemented Interfaces:
    Serializable, Cloneable

Direct Known Subclasses:
    StateAdapter, AcceptableState

Provides the basic interface for states (both accepting, acceptable and final) of a state machine.

Each state is immutable and has a name and integer value. States are considered equivilent if the integer values equal.

Note that the second opperand is an annonymous class, changing its equivilence from a vanilla Type instance.

State objects also can contain an optional opaque object. This is provided for applications to make use of the state machine for managing data assocciated with the state.

Field Summary
public final  int value    The integer value of the state.

States with the same value are equal. 

public final  String name    The human readable name of the state. 
protected  Object opaque    The optional opaque user data for the state. 
Constructor:
 public State(int value) 
 public State(int value,
    String name) 
Method from org.jboss.util.state.State Summary:
equals,   getName,   getOpaque,   getValue,   hashCode,   setOpaque,   toIdentityString,   toString
Methods from org.jboss.util.CloneableObject:
clone
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jboss.util.state.State Detail:
 public boolean equals(Object obj) 
    Check for state equality.

    States are considered equal if the integer values of the State objects are equivilent.

 public String getName() 
    Returns the name of the state, or if null returns the integer value as a string.
 public Object getOpaque() 
 public int getValue() 
 public int hashCode() 
    Returns the has code of the object.
 public  void setOpaque(Object obj) 
 public String toIdentityString() 
    Returns the identity string of this state.

    This is the same value returned by Object#toString() .

 public String toString()