In addition to the events and variables which are declared by the statechart, also additional life cycle operations exist. As explained before (see type
IStateMachine in previous chapter), they implicitly exist for each state machine and can be used to control its life cycle.
|enter() : void||An inactive state machine can be activated by calling this operation. During activation the initial state will be activated and all required entry actions are executed. A state machine is inactive by default after creation.|
|exit() : void||A call to exit deactivates an active state machine. During exit, all active states will be exited and all relevant exit actions will be executed. After exit, no state is active.|
|isActive() : boolean||Returns true if the state machine is active and false otherwise. A state machine is active if there is at least one active state. This operation can be used in guards to test the life cycle state of a state machine.|
|isStateActive(state): boolean||Can be used in guards to check the activation of a specific state. The state parameter must be of the state machines state enumeration type.|
|isFinal() : boolean||Returns true if all active states are final states. The final state won’t change until the state machine is exited and reentered. This operation can be used in guards to check if a state machine has finished its work.|
|runCycle(): void||Performs a state machines run-to-completion step. If a state machine takes full control of a cycle-based state machine then it has to decide when the run-to-completion step must be executed.|
Using these operations implies a tighter semantic coupling of separate state machines. It is the basis for the implementation of sub state machines as described in the following chapter.