States
Flowchart States (or simply “States”) are logical states of the finite-state machine defined by a Flowchart. All States are listed in States List dialog.
An instance is in a State ABC from the moment it reaches a EnterState Block named ABC, and until it exits via ExitState Block with the same name. The instance exits via ExitState Block when once of the Block’s children becomes executable. If one of the child Blocks is ready to be executed, the instance does not spend any time in the State. Instead, it passes through the State by executing the ready child Block. If there is no ExitState Blocks associated with State ABC, the instance remains in the State until the execution of the Flowchart stops.
While the States are the same for all instances of a Flowchart, each instance transitions from State to State independently.
States List
States List dialog is called from a State Block context menu or through Edit >> States List command.
Every State corresponds to a uniquely named entry in States List dialog. The entry is automatically added when a State Block with a new name is added to a Flowchart. The relationship between a State and a State Block is one-to-many: a State is associated with one or more State Blocks, while a State Block is associated with a single State only. Editing Name column allows changing the names of the States.
Column Type shows the type of the State. Column Refs contains the number of Blocks associated with this State in the script. If the counter is 0, the entry is colored in red, which means that the State is not used in any Blocks. States with no associated Blocks are inactive.
There are several operations that could be performed through this dialog.
- Changing the State associated with the current State Block. To do so, select the radio button next to the desired States.
- Add a new State by clicking Add button.
- Editing attributes of an existing State. Select a State by clicking any of its columns. Click Edit button on the right.
State Types
There are two types of States in a Flowchart.
- NULL
- NORMAL
NULL State
NULL State is a special State. The only instance running in this State is NULL Instance. All other instances stop running upon reaching NULL State.
NULL State is the only mandatory State in a Flowchart. An executable Flowchart should always include a NULL State Block.
When a working instance enters NULL State, it dies. This is a standard way of instance completion.
All the Blocks directly descending from NULL State Block and ready to be executed are executed. The Blocks are checked for execution readiness from left to right.
NORMAL State
A State which is not the NULL State is a NORMAL State. NORMAL States are essential for partitioning a Flowchart into easily manageable parts.
Block to execute next
There might be multiple paths for an instance to exit a State. See more at Execution Order.