public static final class StateMachine.Builder extends Object
Modifier and Type | Method and Description |
---|---|
StateMachine.Builder |
addState(Enum stateEnum,
String description)
Adds a state with name and description.
|
StateMachine.Builder |
addTransition(Enum from,
Enum to,
String description)
Adds a transition with description.
|
StateMachine |
build()
Builds and returns the StateMachine.
|
StateMachine.Builder |
setInitialState(Enum stateToSet) |
public StateMachine.Builder addState(Enum stateEnum, String description)
stateEnum
- enumeration indicating the statedescription
- description of the stateRuntimeException
- if the state was already addedpublic StateMachine.Builder setInitialState(Enum stateToSet)
stateToSet
- the initial state for StateMachineRuntimeException
- if the initial state was not added firstpublic StateMachine.Builder addTransition(Enum from, Enum to, String description)
from
- from state nameto
- to state namedescription
- description of the transitionRuntimeException
- if either from or to state was not added, or the same transition
was already addedpublic StateMachine build()
RuntimeException
- if an initial state was not setCopyright © 2018. All rights reserved.