MiceOnABeam Product Documentation

Modified: 10/27/2011 7:34 PM
Recently changed articles You can subscribe to this wiki article using an RSS feed reader.

Final State

Summary

A Final State is used to indicate the completion of a sequence of events.  When transitioned to, it automatically generates an internal Completion Event on the enclosing Composite State.

Graphic

A Final State is represented by the following graphic:

One or more incoming transitions may be connected to a Final State, but it may not have an outgoing transition.

Description

When a transition is taken to a Final State, the Composite State containing the Final State is considered to be completed, and a Completion Event is automatically generated for the Composite State. In order to handle a Completion Event the Composite State must have an originating transition whose event has been set to %%completion_event. This is called a Completion Transition.

If no transition exists on the enclosing Composite State that has the Completion Event, then the script remains in the Final State, it's status remains running, but it will no longer respond to any events, including Group Transitions.

Usage

The following is a very simple model of an ATM (Automatic Teller Machine) which dispenses cash. The User of the ATM begins by touching the ATM screen which transitions the script to the ATM_Processing_Request state, and via Default Entry, to the Authorizing state contained within it's decomposition.

The ATM then requests a PIN (Personal Identification Number) from the User for authorization purposes. If the PIN is bad the transaction is terminated via a transition to the Final State.

If the PIN is valid the ATM checks the checking account balance of the user in the Checking_Account state. If there are insufficient funds, the transaction is terminated via a transition to the Final State.

If there are sufficient funds, the ATM dispenses the funds and asks the user if they want to do another transaction. If not, the transaction is terminated as above, otherwise the script returns to the Checking_Account state again.

When the Final State has been entered, a Completion Event is generated and the End Transition within the Top Level state, whose event has been set to %%completion_event is then taken.

Top Level State

 

ATM_Processing_Request State

Notes

  • Only one Final State may be defined within the decomposition of a Composite State.
  • A transition set with the Completion Event may also originate from the interior border of a Composite State, (thereby bypassing the Exit Action of the Composite State if any) and it will be triggered by a contained Final State.
  • The normal use of the Final State and Completion Event is to transition away from the "completed" state, however this is not enforced. The user is therefore cautioned not to redirect a Completion Transition back to a Final State contained within the completed state or it's substates, as this may cause an infinite loop.
Tags:
Home: MiceOnABeam Product Documentation Copyright © 2010-2018 MiceOnABeam Software