FSM Monitoring Algorithm3

Finite State Machine Monitoring

The monitoring algorithm for FSM keeps an integer representing the current state in a deterministic finite state machine. As events are received the value of the current state and the event in question uniquely determine the next state of the finite state machine. The first state in the input specification is assumed to be the start state.

State Aliases and fail

One may assign an alias to a group of the states in the state machine and then associate an action to the alias in the MOP specification .
The associated action will be triggered when any state in the corresponding group is reached by the state machine.
fail is a special state in the state machine, meaning the failure of the machine.
In other words, if a state machine received an event that cannot trigger any transition in the current state, it will go into the fail state by default. The state machine is unable to leave the fail once it is entered.

In this example, three events, namely, next, hasnext and dummy, and three states, namely, start, safe and unsafe, are defined. start is the start state. Two state aliases are declared: all_states represents all the states in the state machine and safe_states includes the start state and the safe state. The state machine will go into "fail" whenever a dummy event is received, unless the machine is in the start state, in which case it will stay in the start state.