Loop Node

A Loop Structured Activity Node is used for defining a loop, and is commonly associated with �While�, �Repeat� or �For� loop statements.

Each Loop Node has three partitions:

·Setup commonly initiates variables to be used in the loop's exit-condition; it is executed once on entry to the loop
·Test defines the loop exit-condition
·Body can contain Actions to be executed repeatedly until the Test produces a false value

The results of the final execution of the Test or Body are available after execution of the Loop is complete.

Create a Loop Node



See Also


From the Activity page of the Diagram Toolbox, drag a Structured Activity icon onto the Activity diagram.

A short menu displays.




Select the Loop Node option.

The Loop Node displays on the diagram, with the element Properties dialog (if the dialog does not  display, double-click on the element).




Complete as many of the common element Properties fields as required.




Select the Loop tab and set the following checkboxes as required:

·Must Isolate - defines concurrency: if selected, no object within the node can be used outside it; the objects are isolated from parallel use
·Tested First - defines the loop type; select for a For / While loop, deselect for a Repeat Until loop




For each of the following fields, click on the ( ... ) or Add button as appropriate, to display the Select Pins dialog and select an Action Pin:

·Decider (an Output pin within the Test partition, the value of which is examined after execution of the Test to determine whether to execute the loop Body)
·Loop Variable Input
·Loop Variable
·Body Output and


The Select Pins dialog lists only Input pins for the Loop Variable Input field and only Output pins for the other fields.

If the required Action Pin does not already exist, you can click on the Add New button on the dialog to automatically create the Input pin or an Output pin for the node.




In the Nodes panel, click on one of the Setup, Test or Body radio buttons to list the Actions and Activities contained in the corresponding partition of the Loop Node.

An element must be completely below the top edge of a partition to be listed for that partition - if it overlaps with the partition above in any way, it is treated as being part of that partition.




Click on the OK button to save the properties of the Loop Node and close the Properties dialog.




Right-click on the Node in the diagram and select the Structural Elements context menu option.

The Structural Elements dialog displays.

Select the checkbox against each embedded element and close the dialog.

The Action pins should now be visible in the diagram, attached to the Node.


Manage Structural Elements


A Loop Node is depicted on an Activity diagram as shown below:


You define the Loop nodes by dragging Action elements from the Diagram Toolbox page into the Setup, Test and Body partitions. The Body partition can contain several Actions, which can be linked and organized into the required structure. The elements are aligned on the top left of the partition, so that resizing the node maintains the organization of the structure within and between the partitions. If you try to shrink the node below the structure size, the node automatically defaults to the 'best fit' size.



·You can check on the exact location of an existing Action Pin by right-clicking on the pin name in the Loop Node Properties dialog and selecting the Find in Project Browser context menu option; the location of the Action Pin in the Project Browser is expanded and highlighted

OMG UML Specification

The OMG UML specification (UML Superstructure Specification, v2.1.1, pp. 384-385) states:

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

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.