Constructor and Description |
---|
StateMachine(T initialState) |
Modifier and Type | Method and Description |
---|---|
boolean |
is(T state,
T... otherStates)
Check if current state is one of given states
|
StateMachine<T> |
next(T nextState)
Transition to next state
|
void |
nextOrStay(T nextState)
Transition to next state if not already there
|
static <T extends Enum<T>> |
of(T initialState) |
String |
toString() |
StateMachine<T> |
withTransition(T from,
T to,
T... moreTo)
Add a valid transition from one state to one or more states
|
public StateMachine(T initialState)
public static <T extends Enum<T>> StateMachine<T> of(T initialState)
public StateMachine<T> withTransition(T from, T to, T... moreTo)
public StateMachine<T> next(T nextState) throws IllegalStateException
IllegalStateException
- if transition is not allowedNullPointerException
- if the nextState
is null
public void nextOrStay(T nextState)
IllegalStateException
- if transition is not allowedNullPointerException
- if the nextState
is null
Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.