|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Defines the data model required by a StateMachine
.
Method Summary | |
Set |
acceptableStates(State state)
Return an immutable set of the acceptable states for a given accepting state. |
Set |
addState(State state)
Add a final state. |
Set |
addState(State state,
Set acceptable)
Add a non-final state. |
Set |
addState(State state,
State[] acceptable)
Add a non-final state. |
void |
clear()
Clear all accepting state mappings and reset the initial and current state to null. |
boolean |
containsState(State state)
Check if a give state is contained in the model. |
State |
getCurrentState()
Get the current state. |
State |
getInitialState()
Return the initial state which the state machine should start in. |
State |
getMappedState(State state)
Returns the state object mapped for the given state value. |
boolean |
isMappedState(State state)
Determins if there is a mapping for the given state object. |
Set |
removeState(State state)
Remove a state from the model. |
void |
setCurrentState(State state)
Set the current state. |
void |
setInitialState(State state)
Set the initial state. |
Set |
states()
Return an immutable set of the accepting states. |
Methods inherited from interface org.jboss.util.CloneableObject.Cloneable |
clone |
Methods inherited from interface org.jboss.util.PrettyString.Appendable |
appendPrettyString |
Method Detail |
public Set addState(State state, Set acceptable)
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).
state
- The accepting state; must not be null.acceptable
- The valid acceptable states; must not contain null elements.public Set addState(State state, State[] acceptable)
state
- The accepting state; must not be null.acceptable
- The valid acceptable states; must not contain null elements.addState(State,Set)
public Set addState(State state)
Note, if the given state implements StateMachine.Acceptable
then
the final determiniation of its finality will be unknown until
runtime.
state
- The final state; must not be null.public State getMappedState(State state)
Since states with the same value are equivlent, this provides access to the actual state instance which is bound in the model.
state
- The state with the value of the bound state to return;
null will return false.
IllegalArgumentException
- State not mapped.public boolean isMappedState(State state)
state
- The state with the value of the bound state to check for;
must not be null.
IllegalArgumentException
- State not mapped.public void setInitialState(State state)
Does not need to validate the state, StateMachine
will
handle those details.
state
- The initial state; must not be null.public State getInitialState()
public void setCurrentState(State state)
Does not need to validate the state, StateMachine
will
handle those details.
state
- The current state; must not be null.public State getCurrentState()
public boolean containsState(State state)
state
- The state to look for.
public Set removeState(State state)
state
- The state to remove.
public void clear()
public Set states()
public Set acceptableStates(State state)
state
- The accepting state to get acceptable states for; must not be null.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |