Save This Page
Home » jboss-5.0.0.CR1-src » org » jboss » util » state » [javadoc | source]
org.jboss.util.state
public interface: StateMachine.Model [javadoc | source]

All Implemented Interfaces:
    Cloneable, Appendable

All Known Implementing Classes:
    DefaultStateMachineModel

Defines the data model required by a StateMachine .
Method from org.jboss.util.state.StateMachine$Model Summary:
acceptableStates,   addState,   addState,   addState,   clear,   containsState,   getCurrentState,   getInitialState,   getMappedState,   isMappedState,   removeState,   setCurrentState,   setInitialState,   states
Method from org.jboss.util.state.StateMachine$Model Detail:
 public Set acceptableStates(State state)
    Return an immutable set of the acceptable states for a given accepting state.
 public Set addState(State state)
    Add a final state.

    Note, if the given state implements StateMachine.Acceptable then the final determiniation of its finality will be unknown until runtime.

 public Set addState(State state,
    Set acceptable)
    Add a non-final state.

    Existing acceptable states will be replaced by the given states.

    Acceptable states which are not registered as accepting states will be added as final states.

    If the acceptable set is null, then the added state will be final.

    Note, states are added based on the valid states which can be transitioned to from the given state, not on the states which accept the given state.

    For example, if adding state A which accepts B and C, this means that when the machine is in state A, it will allow transitions to B or C and not from C to A or B to A (unless of course a state mapping is setup up such that C and B both accept A).

 public Set addState(State state,
    State[] acceptable)
    Add a non-final state.
 public  void clear()
    Clear all accepting state mappings and reset the initial and current state to null.
 public boolean containsState(State state)
    Check if a give state is contained in the model.
 public State getCurrentState()
    Get the current state.
 public State getInitialState()
    Return the initial state which the state machine should start in.
 public State getMappedState(State state)
    Returns the state object mapped for the given state value.

    Since states with the same value are equivlent, this provides access to the actual state instance which is bound in the model.

 public boolean isMappedState(State state)
    Determins if there is a mapping for the given state object.
 public Set removeState(State state)
    Remove a state from the model.
 public  void setCurrentState(State state)
    Set the current state.

    Does not need to validate the state, StateMachine will handle those details.

 public  void setInitialState(State state)
    Set the initial state.

    Does not need to validate the state, StateMachine will handle those details.

 public Set states()
    Return an immutable set of the accepting states.