Specifications of the Collaborative State Machines model

Transition-related constructs are described below.

Transition

A state transition enables the transitioning between the states of a state machine. The result of a state transition is exiting the currently active state and entering the newly active state.

CSML supports external transitions, using the target keyword to specify a target state towards which the transition is directed within the same state machine. A state may externally transition into itself by declaring a transition with its state name.

Optionally, the target state may be omitted, leading to an internal transition. In this case, the state machine stays in its current state, bypassing the execution of any actions triggered by entering or exiting a state while still carrying out the transition actions.

Guard conditions are provided as expressions in the context of transitions. A guard expression $E : \mathbb{R}^n \to {\text{true}, \text{false}}$ takes the form where $\mathbb{R}^n$ represents the domain, consisting of all variables in scope, see dynamic extent.

To initiate a transition, the conjunction of all guard expressions must collectively evaluate to true. The actions keyword is used to specify the actions executed when the transition is taken.

new Transition {
    target = "Sa"
    guards {
        new Guard {...}...
    }
    actions {
        new Action {...}...
    }
    else = "Sb"
}

Listing 10: A Transition construct.

Transition guards must be mutually exclusive to ensure determinism, so that at most one transition can be triggered from any given state at a time.

The following keywords can/must be provided:

Keyword Description Type Optional
target Target state name. State.name No
guards Guard conditions. list of Guard Yes
actions Transition actions. list of Action Yes
else Else target. State.name Yes

OnTransition

The on-transition construct is a specialization of the transition construct, adding the event keyword that specifies the event that triggers the transition.

new OnTransition {
    event = "e1"
    target = "Sa"
    guards {
        new Guard {...}...
    }
    actions {
        new Action {...}...
    }
    else = "Sb"
}

Listing 11: An OnTransition construct.

The following keywords can/must be provided:

Keyword Description Type Optional
event Event responding to. string No

target

The target keyword specifies the State.name to transition into.

The target state name must be valid.

guards

The guards keyword specifies the guard conditions of the transition. All guard expressions must evaluate to boolean true for the transition to be taken.

The guard expression must evaluate to boolean true or false.

actions

The actions keyword specifies the actions executed as part of the transition. Actions may be declared in-line, in which case an action name is not required. Actions may also be referenced by name. Actions executed within a state have state-scope, see dynamic extent.

An action reference must be a valid action name.

else

The else keyword specifies the state to transition into, should the guard condition not evaluate to boolean true.

The else state name must be valid.

event

The event keyword specifies the name of an event that triggers the on-transition.

The name of the event must be an event raised within the collaborative state machine.