Divooka Reference

State Machine

7 nodes

On this page 7

Make State Machine

Function

This node carries no documentation.

Signature
StateMachineApplication() -> State Machine
StateMachineApplication StateMachineApplication()

Returns

State MachineState Machine
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
State Machine
Package
State Machines

Add Transition

Function

Declares one transition. A null Condition is an UNCONDITIONAL transition: it is
satisfied on every evaluation, so the machine leaves From State after its next
Update returns (subject to priority - an unconditional low-priority transition is a fallback edge).
That is the recorded phase-3 decision for a transition whose payload names no condition graph: an
edge the author drew means something, and "always" is the natural meaning of an unguarded one.

Signature
AddTransition
    State Machine: State Machine
    fromState: Text
    toState: Text
    transitionName: Text
    condition: Func<Truth>
    priority: Integer
void AddTransition(
    StateMachineApplication State Machine,
    string fromState,
    string toState,
    string transitionName,
    Func<bool> condition,
    int priority)

Parameters

nametypedefaultdescription
State MachineState Machine—
fromStateText—The state this transition leaves.
toStateText—The state this transition enters (may equal From State - a self-transition).
transitionNameText—The authored display name, or null for an unnamed transition.
conditionFunc<Truth>—Whether the transition fires, asked after each Update; null = always.
priorityInteger—Higher evaluates first; see StateMachineApplication.OutgoingOf for the tie rule.
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
State Machine
Package
State Machines

Machine Name

Function

What failure messages call this machine: the graph's name interpreted, set by the emitted
constructor compiled; the emitted type's name failing both.

Signature
MachineName(State Machine: State Machine) -> Text
string MachineName(StateMachineApplication State Machine)

Parameters

nametypedefaultdescription
State MachineState Machine—

Returns

resultText
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
State Machine
Package
State Machines

Stop Requested

Function

Whether StateMachineApplication.Stop has been called for the current run.

Signature
StopRequested(State Machine: State Machine) -> Truth
bool StopRequested(StateMachineApplication State Machine)

Parameters

nametypedefaultdescription
State MachineState Machine—

Returns

resultTruth
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
State Machine
Package
State Machines

Tick Scheduler

Function

The tick scheduler the loop runs on; null (the default) means real time
(StateMachine.RealTimeTickScheduler). Settable so a test - or any host that owns time - can drive
the machine deterministically; this is the machine analogue of the recording-driver pattern.

Signature
TickScheduler(State Machine: State Machine) -> I State Machine Tick Scheduler
IStateMachineTickScheduler TickScheduler(StateMachineApplication State Machine)

Parameters

nametypedefaultdescription
State MachineState Machine—

Returns

resultI State Machine Tick Scheduler
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
State Machine
Package
State Machines

Register State

Function

Declares one state: its name (the state graph's name), how to construct a FRESH instance of it -
entering a state always constructs anew, self-transitions included - and whether it is the initial
state.

Signature
RegisterState
    State Machine: State Machine
    stateName: Text
    factory: Func<State Machine State>
    isInitial: Truth
void RegisterState(
    StateMachineApplication State Machine,
    string stateName,
    Func<StateMachineState> factory,
    bool isInitial = false)

Parameters

nametypedefaultdescription
State MachineState Machine—
stateNameText—
factoryFunc<State Machine State>—
isInitialTruthFalse
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
State Machine
Package
State Machines

Stop

Function

Ends the machine from anywhere: the loop stops at its next checkpoint - after the callback (or
condition) that called this returns - without exiting the active state. Callable from a state
(through StateMachineState.Stop), from a condition, or from another thread.

Signature
Stop(State Machine: State Machine)
void Stop(StateMachineApplication State Machine)

Parameters

nametypedefaultdescription
State MachineState Machine—
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Events Routine StateMachineState
Declared by
State Machine
Package
State Machines