public class StateMachineBuilder
extends java.lang.Object
A state machine consists of one or more state machine cores. There cores are
constructed using a MachineCoreBuilder. State machines support 2
modes for handling inner events: normal mode and priority
mode. In normal mode events generated by transitions of the machine
cores are simply added to the main event queue behind already
enqueued requests. In priority mode these internal events are
handled before any already enqueued event. From the internal events the
oldest ones are always processed first. A new external event is only
processed once all internal events have been handled and no new internal
events have been created. The mode can be set using
setPrioritiseInternalEvents(boolean).
StateMachine,
MachineCoreBuilder| Constructor and Description |
|---|
StateMachineBuilder()
creates a new empty builder
|
StateMachineBuilder(StateMachineBuilder builder)
copy constructor
|
| Modifier and Type | Method and Description |
|---|---|
StateMachineBuilder |
addMachineCore(MachineCoreBuilder builder)
Adds a
MachineCoreBuilder to this builder. |
StateMachine |
build()
Constructs a
StateMachine represented by this builder and all its
MachineCoreBuilders |
StateMachineBuilder |
copy()
creates a copy of this builder
|
StateMachineBuilder |
setPrioritiseInternalEvents(boolean prioritise)
Set if internal events should get priority over all other events.
|
public StateMachineBuilder()
public StateMachineBuilder(StateMachineBuilder builder)
builder - the builder to copyjava.lang.NullPointerException - builder is nullpublic StateMachineBuilder addMachineCore(MachineCoreBuilder builder)
MachineCoreBuilder to this builder. That builder will be
used to derive a state machine core internally. The passed
MachineCoreBuilder instance will be copied and will therefore not
be affected by further changes to that instance.builder - the core builder to add. may not be nulljava.lang.NullPointerException - builder is nullpublic StateMachineBuilder copy()
public StateMachineBuilder setPrioritiseInternalEvents(boolean prioritise)
true internal events generated by an event are processed
immediately before processing the next external event. If the processing
of internal events yields more internal events they are queued in order
of appearance (i.e. the oldest internal event is always processed first)prioritise - public StateMachine build()
StateMachine represented by this builder and all its
MachineCoreBuildersjava.lang.IllegalArgumentException - a core could not be constructed due to invalid dataCopyright © 2018. All Rights Reserved.