Constructor and Description |
---|
StateMachine(State startState,
Multimap<State,State> transitions) |
Modifier and Type | Method and Description |
---|---|
void |
checkState(State... requiredStates)
Checks that the machine is in one of the given states.
|
void |
checkState(State requiredState)
Checks that the machine is in the given state.
|
State |
getState() |
String |
toString() |
void |
transition(State newState)
Transitions to a new state, provided that the required transition exists
|
public void checkState(State requiredState) throws IllegalStateException
requiredState
- IllegalStateException
public void checkState(State... requiredStates) throws IllegalStateException
requiredStates
- IllegalStateException
public void transition(State newState) throws IllegalStateException
newState
- IllegalStateException
- If no state transition exists from oldState to newStatepublic State getState()
Copyright © 2016. All rights reserved.