Package org.jboss.security.util.state
Class StateMachine
- java.lang.Object
-
- org.jboss.security.util.state.StateMachine
-
-
Constructor Summary
Constructors Constructor Description StateMachine(Set states, State startState)
Create a state machine given its states and start state.StateMachine(Set states, State startState, String description)
Create a state machine given its states and start state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
Make a copy of the StateMachine maintaining the current state.State
getCurrentState()
Get the current state of the state machine.String
getDescription()
Get the state machine description.State
getStartState()
Get the start state of the state machine.Set
getStates()
Get the states of the state machine.State
nextState(String actionName)
Transition to the next state given the name of a valid transition.State
reset()
Reset the state machine back to the start stateString
toString()
-
-
-
Method Detail
-
clone
public Object clone()
Make a copy of the StateMachine maintaining the current state.
-
getDescription
public String getDescription()
Get the state machine description.- Returns:
- an possibly null description.
-
getCurrentState
public State getCurrentState()
Get the current state of the state machine.- Returns:
- the current state.
-
getStartState
public State getStartState()
Get the start state of the state machine.- Returns:
- the start state.
-
getStates
public Set getStates()
Get the states of the state machine.- Returns:
- the machine states.
-
nextState
public State nextState(String actionName) throws IllegalTransitionException
Transition to the next state given the name of a valid transition.- Parameters:
actionName
- - the name of transition that is valid for the current state.- Returns:
- the next state
- Throws:
IllegalTransitionException
-
reset
public State reset()
Reset the state machine back to the start state- Returns:
- the start state
-
-