-
A conditional-test expression maps to a decision node with an incoming control flow from an initial node. The decision input flow for the decision node has as its source the result source element from the mapping of the first operand expression.
The decision node has two outgoing control flows with the guards true and false. The true flow has as its target a structured activity node that contains the mapping of the second operand expression. The false flow has as its target a structured activity node that contains the mapping of the third operand expression.
The result source elements from the mapping of the second and third operand expressions are connected by object flows to a merge node (outside either structured activity node). This merge node is the result source element for the conditional-test expression.
-
For any name assigned in either (or both) of the second and third operand expressions, an output pin is added to the structured activity nodes for both the second and third operand expressions. Within each structured activity node, if the name is assigned in the corresponding operand expression, then the assigned source for the name after the operand expression is connected to the output pin. If the name is not assigned in the corresponding operand expression, then an additional structured activity node is added to the mapping of the operand expression 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 before the operand expression to the input pin of the structured activity node.
The output pin of the added structured activity node is then connected by an object flow to the output pin corresponding to the name on the enclosing structured activity node for the argument expression.
Each pair of output pins on the structured activity nodes for the operand expressions corresponding to the same name are connected by object flows to a merge node. This merge node is the source for the assigned value of the name after the conditional-test expression.
17.24Assignment Expressions -
The mapping of an assignment expression depends on whether it is a simple or compound assignment and, if it is a simple assignment whether it has a name or feature left-hand side and whether or not it has an index.
-
As an assigned source, an assignment expression maps to the result source of the expression.
-
If no conversion is required then the result source element of the right-hand side of an assignment expression, as referenced below, should be considered to the the result source element of the mapping of the right-hand side expression. If collection conversion is required, then the result source element of the argument expression is connect by an object flow to an invocation of the Collection::toSequence operation (see Subclause 11.6.2), and the result of that invocation acts as the result source element for the right-hand side, unless bit string conversion is also require. If bit string conversion is required, then either the result source element of the argument expression or the result of the toSequence invocation, if collection conversion was required, is connected by an object flow to an invocation of the BitStringFunctions::toBitString function (see Subclause 11.3.5), and the result of that invocation acts as the result source element for the right-hand side.
Simple Assignment: Name Left-Hand Side, without Index
-
If the left-hand side is a name without an index, then a simple assignment maps to a fork node. The result source element from the mapping of the right-hand side is connected to the fork node by an object flow. The fork node is the result source element for the assignment expression and also the source for the assigned value for the name.
Simple Assignment: Name Left-Hand Side, with Index
-
If the left-hand side is a name with an index, then a simple assignment maps to a call behavior action for the library behavior Alf::Library::SequenceFunctions::ReplaceAt (see Subclaue 11.3.6). The assigned source for the name from the left-hand side is connected b an object flow to the seq argument input pin of the call behavior action. The result source element from the mapping of the right-hand side is connected to the element argument input pin and the result source element from the mapping of the index expression is connected to the index argument input pin. The seq output pin of the call behavior action is connected by an object flow to a fork node, which is the result source element for the assignment expression and also the source for the assigned value for the name after the expression.
Simple Assignment: Feature Left-Hand Side, without Index
-
If the left-hand side is a property reference but has no index, then the mapping of a simple assignment depends on the multiplicity upper bound of the right-hand side expression.
-
If the right-hand side expression has a multiplicity upper bound of 0, then the simple assignment maps to a clear structural feature action for the identified property. If the right-hand side expression is a sequence construction expression for an empty set, then it is not mapped at all. Otherwise, the right-hand side expression is mapped inside a structured activity node, with a control flow from the structured activity node to the clear structural feature action. There is no result source element for the assignment.
-
If the right-hand side expression has a multiplicity upper bound of 1, then the simple assignment maps to an add structural feature value action for the identified property with isReplaceAll=true. The result source element from the mapping of the right-hand side expression is connect by an object flow to a fork node that has a further object flow to the value input pin of the add structural feature value action. The fork node is the result source element for the assignment.
-
Otherwise, the simple assignment maps to a clear structural feature value action for the identified property followed by an expansion region. The result source element from the mapping of the right-hand side expression is connected by an object flow to a fork node that has a further object flow to an input expansion node of the expansion region. The expansion region contains an add structural feature value action for the property with isReplaceAll=false and an incoming object flow from the input expansion node to its value input pin. If the property is ordered, then the insertAt input pin has an incoming object flow from a value specification action for the unbounded value *. The fork node is the result source element for the assignment.
Simple Assignment: Feature Left-Hand Side, with Index
-
If the left-hand side has an index, then the mapping of a simple assignment includes a structured activity node containing the mapping of the index expression. The further mapping of the assignment expression then depends on the multiplicity upper bound of the right-hand side expression.
-
If the right-hand side expression has a multiplicity upper bound of 0, then the simple assignment maps to a remove structural feature value action for the identified property with isRemoveDuplicates=false and an incoming object flow into its removeAt input pin from the result source element from the mapping of the index expression. If the right-hand side expression is a sequence construction expression for an empty collection, then it is not mapped at all. Otherwise, the right-hand side expression is mapped inside a structured activity node, with a control flow from that structured activity node to the structured activity node containing the mapping of the index expression. There is no result source element for the assignment.
-
If the right-hand side expression has a multiplicity upper bound of 1, then the simple assignment maps to a remove structural feature value action for the identified property with isRemoveDuplicates=false followed by an add structural feature value action with isReplaceAll=false. The result source element of the mapping of the index expression is connected by an object flow to a fork node, which then has object flows to the removeAt input pin of the remove structural feature value action and the insertAt input pin of the add structural feature value action. The right-hand side expression is mapped inside a structured activity node, which is connected by a control flow to the structured activity node for the index expression. The result source element of the mapping of the right-hand side expression is connected by an object flow to the value input pin of the add structural feature value action. The fork node is the result source element for the assignment.
-
If the left-hand side is a data value attribute update, then a fork node is added to the mapping for the assignment expression to be used as the source element for the assigned value of the name. The fork node is the target of an object flow whose source is determined as follows.
-
If the mapping includes a remove structural feature action, but no add structural feature action, then the result output pin of the remove structural feature action is used.
-
If the mapping includes an add structural feature action not in an expansion region, then the result output pin of the add structural feature action is used.
-
If the mapping has an add structural feature action in an expansion region, then an output expansion node is added to the expansion region and the result output pin of the add structural feature action is connected to the output expansion node by an object flow. The output expansion node is then connected by an object flow to a mapping of the expression ListGet(x,ListSize(x)), where x represents the object flow from the expansion node.
Compound Assignment
-
A compound assignment is mapped like a simple assignment expression for which the assigned value is the result of a call behavior action for the primitive behavior corresponding to the compound assignment operator. The arguments to the call behavior action come from the result source elements of the mapping of the effective expression for the left-hand side and the right-hand side expression. However, if the left-hand side is a property reference, then the primary expression for the reference and any index expression are only mapped once with their values used both in the mapping of the effective expression for the left-hand side and the updating of the left-hand side as a structural feature.
Share with your friends: |