Package avail.utility.fsm

Types

Link copied to clipboard
class ExecutionContext<State : Enum<State>, Event : Enum<Event>, GuardKey : Enum<GuardKey>, ActionKey : Enum<ActionKey>, Memento>

An ExecutionContext represents a running finite state machine. In order to execute a step, it maintains a reference to the executor, the current state, and a client-provided memento which will be passed as the sole argument of every action invocation.

Link copied to clipboard
class InvalidContextException : RuntimeException

Exception thrown during a state transition when an invalid execution context is detected.

Link copied to clipboard
class InvalidTransitionException : RuntimeException

Exception raised during an invalid transition.

Link copied to clipboard
class StateMachine<State : Enum<State>, Event : Enum<Event>, GuardKey : Enum<GuardKey>, ActionKey : Enum<ActionKey>, Memento>

A finite state machine (FSM) comprises a finite set of states, a table of transitions between those states, and a table of actions to be performed when states are entered, exited, or transitioned between. Each transition may have a guard, allowing conditional selection among transitions for the same event. A transition may have null for its event, in which case the transition is traversed immediately after arriving if the guard permits.

Link copied to clipboard
class StateMachineFactory<State : Enum<State>, Event : Enum<Event>, GuardKey : Enum<GuardKey>, ActionKey : Enum<ActionKey>, Memento>(    stateType: Class<State>,     eventType: Class<Event>,     guardKeyType: Class<GuardKey>,     actionKeyType: Class<ActionKey>)

A StateMachineFactory enables a client to dynamically specify and assemble a finite state machine. In particular, the factory allows a client to flexibly define a particular FSM while ignoring specification and evaluation order dependency. Validation is postponed until final assembly time, at which time a ValidationException will be thrown in the event of incorrect or incomplete specification; otherwise, the constructed FSM provably reflects the client specification.

Link copied to clipboard
class ValidationException : RuntimeException

Exception thrown by the factory's validation process in the event that the client-specified state machine fails validation.