Book a Demo
Prev Next

Choice

A Choice or Decision Element used in UML Activity and StateMachine diagrams as depicted in Sparx Systems Enterprise Architect.

Description

The Choice pseudostate is used to compose complex transitional paths in, for example, a StateMachine diagram, where the outgoing transition path is decided by dynamic, run-time conditions. The run-time conditions are determined by the actions performed by the StateMachine on the path leading to the choice.

This example depicts the Choice element. Upon reaching the Filter pseudostate, a transition fires to the appropriate State based on the run-time value passed to the Filter. Very similar in form to a Junction pseudostate, the Choice pseudostate's distinction is in deciding transition paths at run-time.

Using a Choice element in a StateMachine diagram as depicted in Sparx Systems Enterprise Architect.

Toolbox icon

Choice element

Learn more

OMG UML Specification:

The OMG Unified Modeling Language specification, (v2.5.1, p.313) states:

This type of Pseudostate is similar to a junction Pseudostate (...) and serves similar purposes, with the difference that the guard Constraints on all outgoing Transitions are evaluated dynamically, when the compound transition traversal reaches this Pseudostate. Consequently, choice is used to realize a dynamic conditional branch. It allows splitting of compound transitions into multiple alternative paths such that the decision on which path to take may depend on the results of Behavior executions performed in the same compound transition prior to reaching the choice point. If more than one guard evaluates to true, one of the corresponding Transitions is selected. The algorithm for making this selection is not defined. If none of the guards evaluates to true, then the model is considered ill formed. To avoid this, it is recommended to define one outgoing Transition with the predefined “else” guard for every choice Pseudostate.