Guard conditions

In Unified Modeling Language (UML) sequence diagrams, a guard condition, also called as an interaction constraint, is a Boolean conditional expression that guards an interaction operand in a combined fragment. A guard condition contains two expressions that designate the minimum and maximum number of times that a loop combined fragment executes.

In sequence diagrams, a guard condition is a semantic condition or restriction that is set in square brackets in an interaction operand in a combined fragment. When you create a combined fragment, a guard condition is created automatically. You can also manually create a guard condition in an interaction operand that does not have an existing guard condition.

A guard condition appears at the start of the interaction and contains all the information that is required to make the decision about whether to execute the traces in the interaction operand. If the guard condition tests true, the traces execute. Because a guard condition is optional, the interaction also executes if no guard condition is specified in the interaction operand.

The following figure illustrates how guard conditions are represented in an interaction.

This interaction frame shows two lifelines with two combined fragments crossing the lifelines. The first loop combined fragment has one interaction operand and a guard condition. The second alt combined fragment has two interaction operands, each with a guard condition.

Related tasks
Adding guard conditions to interaction operands
Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.