Previous UML Classes Table of Contents UML Packages Next


12.3.35 LoopNode

CompleteStructuredActivities , StructuredActivities


   A loop node is a structured activity node that represents a loop with setup, test, and body sections.

*Generalizations

   StructuredActivityNode (from CompleteStructuredActivities , StructuredActivities) on page 425.

*Description

   Each section is a well-nested subregion of the activity whose nodes follow any predecessors of the loop and precede any successors of the loop. The test section may precede or follow the body section. The setup section is executed once on entry to the loop, and the test and body sections are executed repeatedly until the test produces a false value. The results of the final execution of the test or body are available after completion of execution of the loop.

*Attributes

Issue 9191 -add default value

   • isTestedFirst : Boolean [1] If true, the test is performed before the first execution of the body. If false, the body is executed once before the test is performed. Default value is false.

*Associations

   Package StructuredActivities

Issue 8740 -replace ActivityNode by ExecutableNode

   Package CompleteStructuredActivities

Issue 8255 -add subsets and ordered constraints

   8733 -replace ‘copied’ with ‘moved’ 8490 -remove ‘owned by the loop’ from ‘loopVariable’ description and remove subsets constraint add {ordered} constraint on ‘bodyOutput’

*Constraints

Issue 8491 - add constraint and package subheading

   Package CompleteStructuredActivities

   [1] Loop variable inputs must not have outgoing edges.

Issue 8497 - add constraint

   [2] The bodyOutput pins are output pins on actions in the body of the loop node

Issue 8939 - add constraint

   [3] The result output pins have no incoming edges.

*Semantics

   No part of a loop node is executed until all control-flow or data-flow predecessors of the loop node have completed execution. When all such predecessors have completed execution and made tokens available to inputs of the loop node, the loop node captures the input tokens and begins execution.

   First the setup section of the loop node is executed. A front end node is a node within a nested section (such as the setup section, test section, or body section) that has no predecessor dependencies within the same section. A control token is offered to each front end node within the setup section. Nodes in the setup section may also have individual dependencies (typically data flow dependencies) on nodes external to the loop node. To begin execution, such nodes must receive their individual tokens in addition to the control token from the overall loop.

   A back end node is a node within a nested section that has no successor dependencies within the same section. When all the back end nodes have completed execution, the overall section is considered to have completed execution. (It may be thought of as delivering a control token to the next section within the loop.)

   When the setup section has completed execution, the iterative execution of the loop begins. The test section may precede or follow the body section (test-first loop or test-last loop). The following description assumes that the test section comes first. If the body section comes first, it is always executed at least once, after which this description applies to subsequent iterations.

   When the setup section has completed execution (if the test comes first) or when the body section has completed execution of an iteration, the test section is executed. A control token is offered to each front end node within the test section. When all back end nodes in the test section have completed execution, execution of the test section is complete. Typically there will only be one back end node and it will have a Boolean value, but for generality it is permitted to perform arbitrary computation in the test section.

   When the test section has completed execution, the Boolean value on the designated decider pin within the test section is examined. If the value is true, the body section is executed again. If the value is false, execution of the loop node is complete.

   When the setup section has completed execution (if the body comes first) or when the iteration section has completed execution and produced a true value, execution of the body section begins. Each front end node in the body section is offered a control token. When all back end nodes in the body section have completed execution, execution of the body section is complete.

   Within the body section, variables defined in the loop node or in some higher-level enclosing node are updated with any new values produced during the iteration and any temporary values are discarded.

*Notation

   No specific notation.

   Loop nodes are introduced to provide a structured way to represent iteration.

*Changes from previous UML

   Loop nodes are new in UML 2.0.