choice

The choice pseudostate evaluates the guards of the outgoing transitions. This forms a dynamic conditional branch. It allows splitting of transitions into multiple outgoing paths such that the decision of which path to take may be a function of the results of prior actions.

choice dynamic conditional branchThe dynamic conditional branch can be expressed as follows:

if (A){

   Exit State One;

   B;

   if (C){

      D;

      Enter State Two;

   }

   else if (E){

      F;

      Enter State Three;

   }

}

If more than one the guard evaluates to TRUE, the transition is executed according to its evaluation order. If none of the guards evaluates to TRUE, then the state chart is in error, and a message is produced indicating the offending element. To avoid this, it is recommended that every choice pseudostate have one outgoing transition with the predefined else guard.

Icon

choiceblock

Constraints

      A choice pseudostate must have at least one incoming and one outgoing transition.

Color

Background: Specifies the color of the border.

Foreground: Specifies the color of the center.

Name: Specifies a name for the state.

Example

See Examples > State Charts > Choice001.