Loop Node
-
A while statement maps to a loop node with isTestedFirst=true (see fUML Specification, Subclause 7.4.3). The loop node contains the activity nodes and edges mapped from both the condition expression (see Subclause 12.2) and the block of the while statement. All the actions from the mapping of the condition expression constitute the test part of the loop node. All the actions from the mapping of the block form the body part.
-
If the result source element from the mapping of the condition expression is an output pin, then this is the decider pin for the loop node. Otherwise, a structured activity node is added inside the loop node as follows.
-
The structured activity node has one input pin and one output pin, with an object flow from the input pin to the output pin contained within the structured activity node.
-
There is an object flow from the result source element from the mapping of the expression to the input pin of the structured activity node.
The output pin of the structured activity node is then used as the decider pin.
Loop Variables
-
Any name that is assigned in the condition expression or block of the while statement is mapped to a loop variable of the loop node. The loop variable corresponding to a name is used as the assigned source before the condition expression when mapping the while statement. If the name is assigned before the while statement, then the corresponding loop variable input pin is the target of an incoming object flow from the assigned source for the name before the while statement. Otherwise the loop variable input pin is unconnected.
-
If the assigned source for the name after the block of the while statement is an output pin, then this output pin is identified as the body output pin corresponding to the loop variable for the name. Otherwise, a structured activity node is added to the mapping of the body of the loop as follows.
-
The structured activity node has one input pin and one output pin, with an object flow from the input pin to the output pin contained within the structured activity node.
-
There is an object flow from the assigned source for the name after the block to the input pin of the structured activity node.
The output pin of the structured activity node is then used as the body output pin corresponding to the name.
-
If the assigned source of a name after a while statement is the statement, then the source for its assigned value is the result output pin of the loop node corresponding to the loop variable for the name.
18.10do Statements
Loop Node
-
A do statement maps to a loop node with isTestedFirst=false (see fUML Specification, Subclause 7.4.3). The loop node contains the activity nodes and edges mapped from both the block and the condition expression (see Subclause 12.2) of the do statement. All the actions from the mapping of the condition expression constitute the test part of the loop node. All the actions from the mapping of the block form the body part.
-
If the result source element from the mapping of the condition expression is an output pin, then this is the decider pin for the loop node. Otherwise, a structured activity node is added inside the loop node as follows.
-
The structured activity node has one input pin and one output pin, with an object flow from the input pin to the output pin contained within the structured activity node.
-
There is an object flow from the result source element from the mapping of the expression to the input pin of the structured activity node.
The output pin of the structured activity node is then used as the decider pin.
Loop Variables
-
Any name that is assigned in the condition expression or block of the do statement is mapped to a loop variable of the loop node. The loop variable corresponding to a name is used as the assigned source before the block when mapping the do statement. If the name is assigned before the do statement, then the corresponding loop variable input pin is the target of an incoming object flow from the assigned source for the name before the do statement. Otherwise the loop variable input pin is unconnected.
-
If the assigned source for the name after the condition expression of the do statement is an output pin, then this output pin is identified as the body output pin corresponding to the loop variable for the name. Otherwise, a structured activity node is added to the mapping of the body of the loop as follows.
-
The structured activity node has one input pin and one output pin, with an object flow from the input pin to the output pin contained within the structured activity node.
-
There is an object flow from the assigned source for the name after the block to the input pin of the structured activity node.
The output pin of the structured activity node is then used as the body output pin corresponding to the name.
-
If the assigned source of a name after a do statement is the statement, then the source for its assigned value is the result output pin of the loop node corresponding to the loop variable for the name.
18.11for Statements
Iterative for Statements
-
An iterative for statement is generally mapped to a structured activity node containing the maopping of the loop variable expressions and either a loop node or an expansion reagion.
-
An iterative for statement that does not make within it any re-assignments to names defined outside of it is mapped to an expansion region with mode=iterative (see fUML Specification, Subclause 7.4.4). The result source element from the mapping of the loop variable expressions are connected by object flows to input expansion nodes on the expansion region.
-
Otherewise, an iterative for statement is mapped to a loop node (see fUML Specification, Subclause 7.4.3). A for statement of the form
for (v1 in expr1, v2 in expr2,…) { stmts }
is mapped equivalently to
{
list1 = (T[]) expr1;
list2 = (T[]) expr2;
…
size = list1->size();
i = 1;
while (i <= size) {
v1 = list1[i];
v2 = list2[i];
…
stmts
i++;
}
}
where list, size and i are arbitrary local names not otherwise used in the enclosing activity and T is the type of expr1.
Parallel for Statements
-
A parallel for statement is always mapped to an expansion region, but with mode=parallel. Any name listed in the @parallel annotation for the statement is mapped to an output expansion node with that name and its assigned type. This expansion node provides the source element for the assigned value for the name after the for statement.
Share with your friends: |