Class StateMachine<T>
java.lang.Object
org.antublue.test.engine.internal.util.StateMachine<T>
Class to implement a StateMachine
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface to implement an Action -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionafterEach(StateMachine.Action<T> afterEachAction) Method to add an afterEach actiondefinition(T state, StateMachine.Action<T> action, T... nextStates) Method to define a state, the action to perform when the state is encountered, and valid next statesend(T state, StateMachine.Action<T> action) Method to set the end state and actionvoidMethod to run the state machinetoString()
-
Constructor Details
-
StateMachine
Constructor- Parameters:
id- id
-
-
Method Details
-
afterEach
Method to add an afterEach action- Parameters:
afterEachAction- afterEachAction- Returns:
- this
-
definition
public StateMachine<T> definition(T state, StateMachine.Action<T> action, T... nextStates) throws StateMachineException Method to define a state, the action to perform when the state is encountered, and valid next states- Parameters:
state- stateaction- actionnextStates- nextStates- Returns:
- this
- Throws:
StateMachineException
-
end
Method to set the end state and action- Parameters:
state- stateaction- action- Returns:
- this
-
run
Method to run the state machine- Parameters:
initialState- initialState- Throws:
StateMachineException- StateMachineException
-
toString
-