Class StateMachine.Builder<S extends Enum<S>>
- java.lang.Object
-
- com.couchbase.lite.internal.utils.StateMachine.Builder<S>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StateMachine.Builder<S>
addTransition(S source, S target1, S... targets)
Add arcs to the DAG.StateMachine<S>
build()
Create the state machine.
-
-
-
Constructor Detail
-
Builder
public Builder(@NonNull Class<S> klass, @NonNull S initialState, @Nullable S errorState)
State machine builder. The error state is treated specially: it is always legal to transition into the error state and never legal to transfer out of it.- Parameters:
klass
- The class of the enum of states.initialState
- The start state for the machine.errorState
- The machine error state.
-
-
Method Detail
-
addTransition
@NonNull @SafeVarargs public final StateMachine.Builder<S> addTransition(@NonNull S source, @NonNull S target1, @NonNull S... targets)
Add arcs to the DAG. I believe that the use of varargs is, in fact, safe.- Parameters:
source
- of the arcs.target1
- the end of the first arctargets
- the ends of other arcs
-
build
@NonNull public StateMachine<S> build()
Create the state machine.- Returns:
- a new state machine instance.
-
-