Class StateMachine<T>
- java.lang.Object
-
- org.antublue.test.engine.internal.test.util.StateMachine<T>
-
public class StateMachine<T> extends Object
Class to implement a StateMachine
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceStateMachine.Action<T>Interface to implement an Action
-
Constructor Summary
Constructors Constructor Description StateMachine(String id)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StateMachine<T>afterEach(StateMachine.Action<T> afterEachAction)Method to add an afterEach actionStateMachine<T>define(T source, StateMachine.Action<T> action, T... targets)Method to define a state, the action to perform, and possible target statesStateMachine<T>end(T end, StateMachine.Action<T> endAction)Method to set the end state and actionvoidrun(T begin)Method to run the state machineStringtoString()
-
-
-
Constructor Detail
-
StateMachine
public StateMachine(String id)
Constructor- Parameters:
id- id
-
-
Method Detail
-
afterEach
public StateMachine<T> afterEach(StateMachine.Action<T> afterEachAction)
Method to add an afterEach action- Parameters:
afterEachAction- afterEachAction- Returns:
- this
-
define
public StateMachine<T> define(T source, StateMachine.Action<T> action, T... targets)
Method to define a state, the action to perform, and possible target states- Parameters:
source- sourceaction- actiontargets- targets- Returns:
- this
-
end
public StateMachine<T> end(T end, StateMachine.Action<T> endAction)
Method to set the end state and action- Parameters:
end- endendAction- endAction- Returns:
- this
-
run
public void run(T begin) throws StateMachineException
Method to run the state machine- Parameters:
begin- begin- Throws:
StateMachineException- StateMachineException
-
-