diff options
author | Ed Seidewitz | 2015-05-01 06:53:02 +0000 |
---|---|---|
committer | Arnaud Cuccuru | 2015-05-04 08:30:08 +0000 |
commit | ab647664e65adea6e9ca8163245691d762ee1eef (patch) | |
tree | ed7b612eada73dafba54f865b789270027e45270 | |
parent | 91552f4478f91c3781ec8f902e118ccbf501e9cf (diff) | |
download | org.eclipse.papyrus-ab647664e65adea6e9ca8163245691d762ee1eef.tar.gz org.eclipse.papyrus-ab647664e65adea6e9ca8163245691d762ee1eef.tar.xz org.eclipse.papyrus-ab647664e65adea6e9ca8163245691d762ee1eef.zip |
- Implemented the missing FeatureLeftHandSide::expression() operation.
- Corrected derivations of InputNamedExpression::isBitStringConversion
and isCollectionConversion.
- Corrected the parsing of numeric literal strings.
- Fixed the mapping for SequenceOperationExpression.
- Allowed for missing output arguments in the mapping for Tuple.
- Corrected the identification of the functions for unary operators.
- Eliminated the right-hand side structured activity node for an
AssignmentExpression, if it is empty.
- Handled element names more consistently in the mappings.
- Corrected errors in the setting of assigned value sources in do and
accept statements.
Change-Id: I1487adc7e6a560f10281d1238e2feca7520179b9
Signed-off-by: Ed Seidewitz <ed-s@modeldriven.com>
Reviewed-on: https://git.eclipse.org/r/46945
Tested-by: Hudson CI
Reviewed-by: Jeremie Tatibouet <jeremie.tatibouet@cea.fr>
Reviewed-by: Arnaud Cuccuru <arnaud.cuccuru@cea.fr>
Tested-by: Arnaud Cuccuru <arnaud.cuccuru@cea.fr>
13 files changed, 179 insertions, 183 deletions
diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfCommon2UML.qvto b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfCommon2UML.qvto index 181ea58ba95..04f6cff467c 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfCommon2UML.qvto +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfCommon2UML.qvto @@ -603,7 +603,7 @@ constructor TestIdentityAction::TestIdentityAction(testName : String, booleanTyp } constructor ValueSpecificationAction::ValueSpecificationAction(valueSpecification : ValueSpecification) { - name := "Value(" + valueSpecification.name + ")"; + name := "Value(" + nameOf(valueSpecification) + ")"; value := valueSpecification; result.result := new OutputPin(name + ".result", valueSpecification.type, 1, 1); } @@ -636,11 +636,13 @@ constructor LiteralNull::LiteralNull() { } constructor InstanceValue::InstanceValue(spec : InstanceSpecification) { + name := nameOf(spec); instance := spec; type := spec.classifier![true]; } constructor InstanceValue::InstanceValue(type_ : Classifier) { + name := "Instance(" + nameOf(type_) + ")"; instance := object InstanceSpecification { classifier += type_; }; diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfExpression2UML.qvto b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfExpression2UML.qvto index 6f0f306abb6..4a3e5013a99 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfExpression2UML.qvto +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfExpression2UML.qvto @@ -71,8 +71,7 @@ helper addExpansionRegion(inout graph : ActivityGraph, name : String, mode : Exp addToExpansionRegion(graph, region, nodes, edges); // Add an input expansion node. - var inputName := if inputSource = null then null else inputSource.name endif; - graph.nodes += var inputNode ::= new ExpansionNode(inputName, region, true); + graph.nodes += var inputNode ::= new ExpansionNode(nameOf(inputSource), region, true); // Connect the input source (if any) to the region input node. if inputSource <> null then { @@ -86,7 +85,7 @@ helper addExpansionRegion(inout graph : ActivityGraph, name : String, mode : Exp // Connect the internal result source (if any) to a region output node. if resultSource <> null then { - graph.nodes += var outputNode ::= new ExpansionNode(resultSource.name, region, false); + graph.nodes += var outputNode ::= new ExpansionNode(nameOf(resultSource), region, false); region.edge += new ObjectFlow(resultSource, outputNode); } endif; @@ -175,16 +174,17 @@ query Expression::assignedValueSource(assignedName : String) : ActivityNode { return self.map toActivityGraph().resultSource; } -mapping AssignedSource::toActivityNode() : ActivityNode - when { self.source <> null } { +mapping AssignedSource::toActivityNode() : ActivityNode { init { - result := self.source.assignedValueSource(self.name); + result := if self.source = null then null else self.source.assignedValueSource(self.name) endif; /* if result = null then { var name = - if self.source.oclIsKindOf(Member) then self.source.oclAsType(Member).definition.name + if self.source = null then "null" + else if self.source.oclIsKindOf(Member) then self.source.oclAsType(Member).definition.name else if self.source.oclIsKindOf(MemberDefinition) then self.source.oclAsType(MemberDefinition).name - else null endif endif; + else null + endif endif endif; result := new ForkNode("No assigned value source! name = " + self.name + if name = null then "" else ", source = " + name endif); } endif; */ @@ -192,10 +192,7 @@ init { } query find(assignments : Set(AssignedSource), assignedName : String) : AssignedSource { - var sourcedAssignments := assignments[name = assignedName and source <> null]; - return - if sourcedAssignments->isEmpty() then null - else sourcedAssignments->any(true) endif; + return assignments![name = assignedName and source <> null]; } helper AssignedSource::toInputPin() : InputPin { @@ -252,6 +249,12 @@ mapping Expression::expressionToActivityGraph() : ExpressionGraph abstract mapping Expression::toActivityGraph() : ExpressionGraph; +mapping ExpressionReference::toActivityGraph() : ExpressionGraph { +init { + result := self.expression.map toActivityGraph(); +} +} + mapping Expression::Dummy_toActivityGraph() : ExpressionGraph inherits Expression::toActivityGraph { resultSource := new ForkNode("Dummy"); @@ -273,35 +276,40 @@ helper BooleanLiteralExpression::toValueSpecification() : ValueSpecification { } helper NaturalLiteralExpression::toValueSpecification() : ValueSpecification { - return new LiteralInteger(self.image.replaceAll("_", "").parseInt(self.radix()), self.type.toType()); + return new LiteralInteger(self.image.replaceAll("_", "").parseInt(), self.type.toType()); } -query NaturalLiteralExpression::radix() : Integer { - var image := self.image; +query String::radix() : Integer { var radix := 10; - if image.length() > 1 and image.at(1) = "0" then { - var radixChar := image.at(2); + if self.length() > 1 and self.at(1) = "0" then { + var radixChar := self.at(2); radix := if radixChar = "b" or radixChar = "B" then 2 else if radixChar = "x" or radixChar = "X" then 16 else 8 endif endif; - if radix <> 8 then { - image := image.substring(2, image.length()); - } endif; } endif; return radix; } -query String::parseInt(radix : Integer) : Integer { - var digits := - if radix <> 16 then self.characters().toInteger() - else self.characters().hexValue() - endif; +query String::parseInt() : Integer { var value := 0; - digits->forEach(d) { - value := value * radix + d; - }; + var radix := self.radix(); + if radix = 10 then { + value := self.toInteger(); + } else { + var image = + if radix = 8 then self + else self.substring(3, self.length()) + endif; + var digits := + if radix <> 16 then image.characters().toInteger() + else image.characters().hexValue() + endif; + digits->forEach(d) { + value := value * radix + d; + }; + } endif; return value; } @@ -351,7 +359,6 @@ init { }; } else if enumerationLiteralReference <> null then { var enumerationLiteral = enumerationLiteralReference.toUml().oclAsType(EnumerationLiteral); - var valueActionName := "Value(" + enumerationLiteral.name + ")"; result := object ExpressionGraph { nodes += var valueAction ::= new ValueSpecificationAction(new InstanceValue(enumerationLiteral)); resultSource := valueAction._'result'; @@ -382,7 +389,7 @@ mapping PropertyAccessExpression::toActivityGraph() : ExpressionGraph // Add a fork node that may be used as the source of the feature // expression to avoid recomputing it for inout parameters, // increment or decrement expressions and compound assignments. - nodes += objectSource := new ForkNode(graph.resultSource.name); + nodes += objectSource := new ForkNode(nameOf(graph.resultSource)); edges += new ObjectFlow(graph.resultSource, objectSource); var type := @@ -401,7 +408,7 @@ mapping PropertyAccessExpression::toActivityGraph() : ExpressionGraph } else { // Sequence property access var region := addExpansionRegion( - result, "Collect(" + readAction.name + ")", ExpansionKind::parallel, + result, "Collect(" + nameOf(readAction) + ")", ExpansionKind::parallel, Set{readAction}, Set{}, objectSource, readAction._'object', readAction.result); resultSource := region.outputElement![true]; } endif; @@ -409,6 +416,10 @@ mapping PropertyAccessExpression::toActivityGraph() : ExpressionGraph // Invocation Actions +query InvocationExpression::assignedValueSource(assignedName : String) : ActivityNode { + return self.tuple.assignedValueSourceMap->get(assignedName); +} + mapping InvocationExpression::toActivityGraph() : ExpressionGraph inherits Expression::toActivityGraph { self.mapAction(result); @@ -420,7 +431,7 @@ helper InvocationExpression::mapAction(inout graph : ExpressionGraph) : Action { helper InvocationExpression::InvocationExpression_mapAction(inout graph : ExpressionGraph) : Action { var action := self.mapTarget(graph); - var lhsGraph := self.tuple.map toActivityGraph(graph, action); + var lhsGraph := self.mapTuple(graph, action); self.mapFeature(graph, action); // NOTE: Adding left-hand side elements here prevents them from being @@ -462,6 +473,10 @@ helper InvocationExpression::InvocationExpression_mapTarget(inout graph : Expres return action; } +helper InvocationExpression::mapTuple(inout graph : ExpressionGraph, action : Action) : ActivityGraph { + return self.tuple.map toActivityGraph(graph, action, null, null); +} + helper InvocationExpression::mapFeature(inout graph : ExpressionGraph, action : Action) { var targetNode : ActivityNode; switch { @@ -470,7 +485,7 @@ helper InvocationExpression::mapFeature(inout graph : ExpressionGraph, action : if not self.isDestructor then { targetNode := callAction.target; } else { - graph.nodes += targetNode := new ForkNode(callAction.target.name); + graph.nodes += targetNode := new ForkNode(nameOf(callAction.target)); graph.edges += new ObjectFlow(targetNode, callAction.target); graph.nodes += var destroyAction ::= new DestroyObjectAction(callAction.operation._'class'); @@ -496,7 +511,7 @@ helper InvocationExpression::mapFeature(inout graph : ExpressionGraph, action : case(action.oclIsKindOf(DestroyObjectAction)) { var destroyAction := action.oclAsType(DestroyObjectAction); if self.isContainedInDestructor() then { - graph.nodes += targetNode := new ForkNode(destroyAction.target.name); + graph.nodes += targetNode := new ForkNode(nameOf(destroyAction.target)); self.addDestroyCheck(graph, targetNode, destroyAction.target); } else { targetNode := destroyAction.target; @@ -513,7 +528,7 @@ helper InvocationExpression::mapFeature(inout graph : ExpressionGraph, action : graph.nodes := Set{}; graph.edges := Set{}; var region := addExpansionRegion(graph, - "Collect(" + action.name + ")", ExpansionKind::parallel, nodes, edges, + "Collect(" + nameOf(action) + ")", ExpansionKind::parallel, nodes, edges, featureGraph.resultSource, targetNode, graph.resultSource); if graph.resultSource <> null then { graph.resultSource := region.outputElement![incoming![true].source = graph.resultSource]; @@ -550,15 +565,13 @@ query InvocationExpression::isSequenceFeatureInvocation() : Boolean { // and conditioning the destroy action on that. helper InvocationExpression::addDestroyCheck(inout graph : ActivityGraph, targetNode : ActivityNode, targetPin : ActivityNode) { graph.nodes += var readSelfAction ::= new ReadSelfAction(null); - graph.nodes += var testAction ::= new TestIdentityAction("self==" + targetNode.name, self.booleanType().toType()); + graph.nodes += var testAction ::= new TestIdentityAction("self==" + nameOf(targetNode), self.booleanType().toType()); graph.edges += new ObjectFlow(readSelfAction.result, testAction.first); graph.edges += new ObjectFlow(targetNode, testAction.second); createObjectDecisionGraph("destroy check", targetNode, testAction.result, targetPin, null).addTo(graph); } -query InvocationExpression::assignedValueSource(assignedName : String) : ActivityNode { - return self.tuple.assignedValueSourceMap->get(assignedName); -} +// Tuples intermediate property _Tuple::assignedValueSourceMap : Dict(String, ActivityNode); @@ -567,17 +580,28 @@ query _Tuple::assignedValueSource(assignedName : String) : ActivityNode { } // Adds tuple input elements to the given graph and effective left-hand side elements to the returned graph. -mapping _Tuple::toActivityGraph(inout graph : ExpressionGraph, action : Action) : ActivityGraph { +mapping _Tuple::toActivityGraph(inout graph : ExpressionGraph, action : Action, firstParameter : ElementReference, firstArgument : OutputNamedExpression) : ActivityGraph { var invocation := self.invocation; + var parameters := invocation.parameter; + var inputParameters := parameters[direction() = "in" or direction() = "inout"]; + var outputParameters := parameters[direction() = "out" or direction() = "inout"]; + var inputs := self.input; var outputs := self.output; - var parameters := invocation.parameter; + if firstParameter <> null then { + inputParameters := inputParameters->prepend(firstParameter); + inputs += firstArgument; + if firstParameter.direction() = "inout" then { + outputParameters := outputParameters->prepend(firstParameter); + outputs += firstArgument; + } endif; + } endif; + var objectSourceMap : Dict(String, ActivityNode); var indexSourceMap : Dict(String, ActivityNode); if inputs->notEmpty() then { var subgraph := object ActivityGraph{}; - var inputParameters := parameters[direction() = "in" or direction() = "inout"]; var i := 1; inputParameters->forEach(parameter) { var input := inputs![name = parameter.name()]; @@ -639,18 +663,17 @@ mapping _Tuple::toActivityGraph(inout graph : ExpressionGraph, action : Action) }; if subgraph.nodes->notEmpty() then { - var node := subgraph.addStructuredActivityNodeTo(graph, "Tuple(" + action.name + ")"); + var node := subgraph.addStructuredActivityNodeTo(graph, "Tuple(" + nameOf(action) + ")"); graph.edges += new ControlFlow(node, action); } endif; } endif; if outputs->notEmpty() then { - var outputParameters := parameters[direction() = "out" or direction() = "inout"]; var i := 1; var returnPin := action.returnPin(); outputParameters->forEach(parameter) { var output := outputs![name = parameter.name()]; - if not output.expression.isNull() then { + if output <> null and not output.expression.isNull() then { var outputGraph := object ExpressionGraph{}; var lhs := output.leftHandSide; var lhsGraph := lhs.map toActivityGraph(objectSourceMap->get(output.name), indexSourceMap->get(output.name), -1); @@ -735,7 +758,7 @@ helper InstanceCreationExpression::mapAction(inout graph : ExpressionGraph) : Ac var nodes := graph.nodes; var edges := graph.edges; - nodes += var forkNode ::= new ForkNode(graph.resultSource.name); + nodes += var forkNode ::= new ForkNode(nameOf(graph.resultSource)); edges += new ObjectFlow(graph.resultSource, forkNode); nodes += var startAction ::= new StartObjectBehaviorAction(class_); @@ -836,19 +859,19 @@ helper LinkOperationExpression::mapTarget(inout graph : ActivityGraph) : Action // For a non-binary association, specific links need to be found and destroyed to maintain // any upper bound multiplicities of 1. graph.nodes := graph.nodes->excluding(action); - graph.nodes += var node ::= new StructuredActivityNode("CreateLink(" + association.name + ")"); + graph.nodes += var node ::= new StructuredActivityNode("CreateLink(" + nameOf(association) + ")"); var subgraph := object ActivityGraph {}; subgraph.nodes += action; endDataList->forEach(endData) { var end_ := endData._'end'; - var inputPin := new InputPin(node, node.name + ".input(" + end_.name + ")", end_.type, end_.lower, end_.upper); + var inputPin := new InputPin(node, node.name + ".input(" + nameOf(end_) + ")", end_.type, end_.lower, end_.upper); inputPin.isOrdered := end_.isOrdered; - subgraph.nodes += var forkNode ::= new ForkNode(end_.name); + subgraph.nodes += var forkNode ::= new ForkNode(nameOf(end_)); subgraph.edges += new ObjectFlow(inputPin, forkNode); subgraph.edges += new ObjectFlow(forkNode, endData.value); if end_.isOrdered then { - inputPin := new InputPin(node, node.name + ".index(" + end_.name + ")", endData.insertAt.type, 1, 1); + inputPin := new InputPin(node, node.name + ".index(" + nameOf(end_) + ")", endData.insertAt.type, 1, 1); subgraph.edges += new ObjectFlow(inputPin, endData.insertAt); } endif; }; @@ -895,7 +918,7 @@ mapping ClassExtentExpression::toActivityGraph() : ExpressionGraph mapping SequenceConstructionExpression::toActivityGraph() : ExpressionGraph inherits Expression::Dummy_toActivityGraph { - + // TODO } abstract mapping SequenceElements::toActivityGraph(out nodes : Set(ActivityNode), out edges : Set(ActivityEdge)); @@ -908,7 +931,7 @@ mapping SequenceRange::toActivityGraph(out nodes : Set(ActivityNode), out edges mapping SequenceAccessExpression::toActivityGraph() : ExpressionGraph inherits Expression::Dummy_toActivityGraph { - + // TODO } helper mapSequenceRangeLoop( @@ -921,17 +944,8 @@ helper mapSequenceRangeLoop( // Sequence Operation Expressions -mapping SequenceOperationExpression::toActivityGraph() : ExpressionGraph - inherits Expression::toActivityGraph { -init { - result := self.invocation().map toActivityGraph(); -} - // TODO -} - -mapping ExtentOrExpression::toActivityGraph() : ExpressionGraph - inherits Expression::Dummy_toActivityGraph { - // TODO +helper SequenceOperationExpression::mapTuple(inout graph : ExpressionGraph, action : Action) : ActivityGraph { + return self.tuple.map toActivityGraph(graph, action, self.firstParameter(), self.firstArgument()); } // Sequence Reduction Expressions @@ -948,6 +962,11 @@ mapping SequenceReductionExpression::toActivityGraph() : ExpressionGraph // Sequence Expansion Expressions +mapping ExtentOrExpression::toActivityGraph() : ExpressionGraph + inherits Expression::Dummy_toActivityGraph { + // TODO +} + abstract mapping SequenceExpansionExpression::toActivityGraph() : ExpressionGraph inherits Expression::Dummy_toActivityGraph; @@ -974,7 +993,7 @@ mapping IsUniqueExpression::toActivityGraph() : ExpressionGraph // Increment or Decrement Expressions mapping IncrementOrDecrementExpression::toActivityGraph() : ExpressionGraph - inherits Expression::Dummy_toActivityGraph { + inherits Expression::toActivityGraph { var behavior := self.integerFunction("" + if self.operator = "++" then "+" else "-" endif); nodes += var callAction ::= new CallBehaviorAction(behavior); @@ -993,7 +1012,7 @@ mapping IncrementOrDecrementExpression::toActivityGraph() : ExpressionGraph edges += new ObjectFlow(operandGraph.resultSource, callAction.argument->at(1)); resultSource := lhsGraph.resultSource; } else { - nodes += resultSource := new ForkNode(operandGraph.resultSource.name + ")"); + nodes += resultSource := new ForkNode(nameOf(operandGraph.resultSource) + ")"); edges += new ObjectFlow(operandGraph.resultSource, resultSource); edges += new ObjectFlow(resultSource, callAction.argument->at(1)); } endif; @@ -1022,8 +1041,8 @@ query UnaryExpression::operatorFunction(operator : String) : String { return switch { case (operator = "!") "BooleanFunctions::!"; - case (operator = "~") "BitStringFunction::~"; - case (operator = "-") "IntegerFunction::Neg"; + case (operator = "~") "BitStringFunctions::~"; + case (operator = "-") "IntegerFunctions::Neg"; else null; }; } @@ -1070,7 +1089,7 @@ mapping IsolationExpression::toActivityGraph() : ExpressionGraph inherits Expression::toActivityGraph { var operandGraph := self.operand.map toActivityGraph(); var structuredNode := - operandGraph.addStructuredActivityNodeTo(result, "IsolationExpression(" + operandGraph.resultSource.name + ")"); + operandGraph.addStructuredActivityNodeTo(result, "IsolationExpression(" + nameOf(operandGraph.resultSource) + ")"); structuredNode.mustIsolate := true; resultSource := new OutputPin(structuredNode, structuredNode.name + ".output", self.operand.type.toType(), self.operand.upper, self.operand.lower); @@ -1278,7 +1297,7 @@ mapping AssignmentExpression::toActivityGraph() : ExpressionGraph if lhsGraph.assignmentTarget <> null then { edges += new ObjectFlow(rhsGraph.resultSource, lhsGraph.assignmentTarget); } endif; - if not (lhsGraph.assignmentTarget = null and rhs.oclIsKindOf(SequenceConstructionExpression)) then { + if rhsGraph->notEmpty() and not (lhsGraph.assignmentTarget = null and rhs.oclIsKindOf(SequenceConstructionExpression)) then { var rhsNode := rhsGraph.addStructuredActivityNodeTo(result, "RighthandSide(" + nameOf(rhsGraph.resultSource) + ")"); if lhsGraph.controlTarget <> null then { edges += new ControlFlow(rhsNode, lhsGraph.controlTarget); @@ -1335,15 +1354,15 @@ helper SyntaxElement::mapPropertyAssignment(property_ : Property, objectSource : } else if not featuringClassifier.oclIsKindOf(DataType) then { // If the property is not a feature of a data type, use an iterative // expansion region to set multiple values. - var region := new ExpansionRegion("Iterate(" + writeAction.name + ")", ExpansionKind::iterative); + var region := new ExpansionRegion("Iterate(" + nameOf(writeAction) + ")", ExpansionKind::iterative); region.node := graph.nodes; region.edge := graph.edges; - var objectInputPin := new InputPin(region, region.name + ".input(" + objectSource.name + ")", featuringClassifier, 1, 1); + var objectInputPin := new InputPin(region, region.name + ".input(" + nameOf(objectSource) + ")", featuringClassifier, 1, 1); new ObjectFlow(region, objectInputPin, writeAction._'object'); graph.nodes := region; - graph.nodes += var inputNode ::= new ExpansionNode(valueSource.name, region, true); + graph.nodes += var inputNode ::= new ExpansionNode(nameOf(valueSource), region, true); graph.edges += new ObjectFlow(objectSource, objectInputPin); graph.edges += new ObjectFlow(valueSource, inputNode); @@ -1351,15 +1370,15 @@ helper SyntaxElement::mapPropertyAssignment(property_ : Property, objectSource : // If the property is a feature of a data type, then use a loop node // to iteratively update the data value. - var objectInputPin := new InputPin(objectSource.name, featuringClassifier, 1, 1); + var objectInputPin := new InputPin(nameOf(objectSource), featuringClassifier, 1, 1); var valueInputPin := new InputPin("value", property_.type, 0, -1); - graph.nodes += var loopNode ::= new LoopNode("Iterate(" + writeAction.name + "),", true, OrderedSet{objectInputPin, valueInputPin}); + graph.nodes += var loopNode ::= new LoopNode("Iterate(" + nameOf(writeAction) + "),", true, OrderedSet{objectInputPin, valueInputPin}); graph.edges += new ObjectFlow(objectSource, loopNode.loopVariableInput->at(1)); graph.edges += new ObjectFlow(valueSource, loopNode.loopVariableInput->at(2)); loopNode.node += var valueFork ::= new ForkNode("value"); loopNode.node += var value1Action ::= new ValueSpecificationAction(self.literalInteger(1)); - loopNode.node += var value1Fork ::= new ForkNode(value1Action.result.name); + loopNode.node += var value1Fork ::= new ForkNode(nameOf(value1Action.result)); loopNode.node += var getAction ::= new CallBehaviorAction(self.sequenceFunction("At")); loopNode.node += var removeAction ::= new CallBehaviorAction(self.sequenceFunction("ExcludeAt")); loopNode.edge += new ObjectFlow(loopNode.loopVariable->at(1), writeAction._'object'); @@ -1471,7 +1490,7 @@ helper LeftHandSide::mapFeatureLeftHandSide(inout graph : LhsGraph, objectSource if objectResultSource = null then { var expressionGraph := feature.expression.map toActivityGraph(); objectResultSource := expressionGraph.resultSource; - graph.controlTarget := expressionGraph.addStructuredActivityNodeTo(graph, "Expression(LeftHandSide(" + objectResultSource.name + "))"); + graph.controlTarget := expressionGraph.addStructuredActivityNodeTo(graph, "Expression(LeftHandSide(" + nameOf(objectResultSource) + "))"); } endif; var index := self.index(); var resultNode : ActivityNode; @@ -1484,7 +1503,7 @@ helper LeftHandSide::mapFeatureLeftHandSide(inout graph : LhsGraph, objectSource if rhsUpper = 0 then { resultNode := clearAction.result; } else { - graph.nodes += graph.resultSource := new ForkNode("LeftHandSide(" + objectResultSource.name + ")"); + graph.nodes += graph.resultSource := new ForkNode("LeftHandSide(" + nameOf(objectResultSource) + ")"); graph.assignmentTarget := graph.resultSource; // Place the property assignment mapping in a structured activity node to insure @@ -1502,7 +1521,7 @@ helper LeftHandSide::mapFeatureLeftHandSide(inout graph : LhsGraph, objectSource var indexResultSource := indexSource; if indexResultSource = null then { var indexGraph := index.map toActivityGraph(); - var indexNode := indexGraph.addStructuredActivityNodeTo(graph, "Index(LeftHandSide(" + objectResultSource.name + ")"); + var indexNode := indexGraph.addStructuredActivityNodeTo(graph, "Index(LeftHandSide(" + nameOf(objectResultSource) + ")"); if graph.controlTarget = null then { graph.controlTarget := indexNode; } else { @@ -1523,19 +1542,19 @@ helper LeftHandSide::mapFeatureLeftHandSide(inout graph : LhsGraph, objectSource if rhsUpper = 0 then { graph.edges += new ObjectFlow(indexResultSource, removeAction.removeAt); } else { - graph.nodes += var indexFork ::= new ForkNode(indexResultSource.name); + graph.nodes += var indexFork ::= new ForkNode(nameOf(indexResultSource)); graph.edges += new ObjectFlow(indexResultSource, indexFork); graph.edges += new ObjectFlow(indexFork, removeAction.removeAt); graph.nodes += var writeAction ::= new AddStructuralFeatureValueAction(property_, false, unlimitedNaturalType); - graph.nodes += graph.assignmentTarget := graph.resultSource := new ForkNode("LeftHandSide(" + objectResultSource.name + ")"); + graph.nodes += graph.assignmentTarget := graph.resultSource := new ForkNode("LeftHandSide(" + nameOf(objectResultSource) + ")"); graph.edges += new ObjectFlow(removeAction.result, writeAction._'object'); graph.edges += new ObjectFlow(graph.resultSource, writeAction.value); resultNode := writeAction.result; } endif; } endif; if self.isDataValueUpdate() then { - graph.nodes += self.assignedValueSource := new ForkNode(resultNode.name); + graph.nodes += self.assignedValueSource := new ForkNode(nameOf(resultNode)); graph.edges += new ObjectFlow(resultNode, self.assignedValueSource); } endif; } endif; diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfStatement2UML.qvto b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfStatement2UML.qvto index e39e199718b..98628e69380 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfStatement2UML.qvto +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfStatement2UML.qvto @@ -257,20 +257,11 @@ helper Statement::mapAssignedValueSources(inout graph : StatementActivityGraph, var statementIsSource := assignment.source = self; if (mapAll or statementIsSource) then { assignedNames->add(assignment.name); - var type = - if assignment.type = null then null - else assignment.type.map toUml().oclAsType(Type) - endif; - var outputPin := self.mapAssignment(graph, - assignment.name, type, assignment.lower, assignment.upper); + var outputPin := self.mapAssignment(graph, assignment.name, + toType(assignment.type), assignment.lower, assignment. upper); if statementIsSource then { - graph.nodes += var forkNode ::= object ForkNode { - name := "Fork(" + assignment.name + ")"; - }; - graph.edges += object ObjectFlow { - source := outputPin; - target := forkNode; - }; + graph.nodes += var forkNode ::= new ForkNode(assignment.name); + graph.edges += new ObjectFlow(outputPin, forkNode); self.assignedValueSourceMap->put(assignment.name, forkNode); } endif; } endif; @@ -278,17 +269,12 @@ helper Statement::mapAssignedValueSources(inout graph : StatementActivityGraph, return assignedNames; } +// NOTE: This function is overridden by some Statement subclasses. helper Statement::mapAssignment(inout graph : StatementActivityGraph, assignedName : String, assignedType : Type, lowerValue : Integer, upperValue : Integer) : OutputPin { - var node := graph.structuredNode; - var outputPin = object OutputPin { - name := node.name + ".output(" + assignedName + ")"; - type := assignedType; - lower := lowerValue; - upper := upperValue; - }; - node.structuredNodeOutput += outputPin; - return outputPin; + return new OutputPin( + graph.structuredNode, graph.structuredNode.name + ".output(" + assignedName + ")", + assignedType, lowerValue, upperValue); } // General @@ -620,22 +606,27 @@ mapping Statement::LoopStatement_toActivityGraph() : StatementActivityGraph loopNode.bodyOutput += outputPin; }; - var testGraph := self.condition().map toActivityGraph(); + var testGraph := if loopNode.isTestedFirst then self.condition().map toActivityGraph() else null endif; var bodyGraph := self.body().map toActivityGraph(false); if loopNode.isTestedFirst then { addToLoopNode(result, testGraph.nodes, testGraph.edges); loopNode.test += testGraph.nodes[ExecutableNode]; - } else if testGraph.nodes->notEmpty() then { - // Ensure that the body is executed before the condition expression. - createStructuredNode(bodyGraph, "Body(" + loopNode.name + ")"); - var conditionGraph := new StatementActivityGraph("Condition(" + loopNode.name + ")"); - addToStructuredNode(conditionGraph, testGraph.nodes, testGraph.edges); - conditionGraph.addTo(bodyGraph); - bodyGraph.edges += new ControlFlow(bodyGraph.structuredNode, conditionGraph.structuredNode); - testGraph.nodes := Set{}; - testGraph.edges := Set{}; - } endif endif; + } else { + // In this case, make sure the body is mapped before the test, so assigned value sources + // are set from the body. + testGraph := self.condition().map toActivityGraph(); + if testGraph.nodes->notEmpty() then { + // Ensure that the body is executed before the condition expression. + createStructuredNode(bodyGraph, "Body(" + loopNode.name + ")"); + var conditionGraph := new StatementActivityGraph("Condition(" + loopNode.name + ")"); + addToStructuredNode(conditionGraph, testGraph.nodes, testGraph.edges); + conditionGraph.addTo(bodyGraph); + bodyGraph.edges += new ControlFlow(bodyGraph.structuredNode, conditionGraph.structuredNode); + testGraph.nodes := Set{}; + testGraph.edges := Set{}; + } endif + } endif; if testGraph.nodes->notEmpty() and testGraph.resultSource.oclIsKindOf(InputPin) then { loopNode.decider := testGraph.resultSource.oclAsType(OutputPin); @@ -1208,7 +1199,7 @@ mapping AcceptBlock::toActivityGraph(parent : AcceptStatement, previousNode : Ac edges += new ObjectFlow(source, parent.assignedValueSource(assignedName).incoming->any(true).source); } else { structuredNode.node += var passthruNode ::= - createPassthruNode(assignedName, assignment.type.toType(), assignment.lower, assignment.upper); + createPassthruNode(assignedName, toType(assignment.type), assignment.lower, assignment.upper); edges += new ObjectFlow(source, passthruNode.input->at(1)); edges += new ObjectFlow(passthruNode.output->at(1), parent.assignedValueSource(assignedName).incoming->any(true).source); @@ -1219,7 +1210,7 @@ mapping AcceptBlock::toActivityGraph(parent : AcceptStatement, previousNode : Ac } query AcceptBlock::assignedValueSource(assignedName : String) : ActivityNode { - return self.owner.oclAsType(AcceptStatement).signalSourceNode; + return self.owner().oclAsType(AcceptStatement).signalSourceNode; } // classify Statements diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/model/alf.ecore b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/model/alf.ecore index d5f5ed4f1a7..fb68fd392be 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/model/alf.ecore +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/model/alf.ecore @@ -3818,7 +3818,7 @@ <details key="documentation" value="Whether the argument expression requires collection conversion."/> </eAnnotations> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> - <details key="derivation" value="
 let parameterType = self.tuple().invocation.parameterNamed(self.name).type() in
 parameterType <> null and self.expression.type <> null and
 self.isCollectionClass(parameterType) and 
 not self.isCollectionClass(self.expression.type)"/> + <details key="derivation" value="
 let parameter = self.tuple().invocation.parameterNamed(self.name) in
 	parameter <> null and
 	let parameterType = parameter.type() in
	 parameterType <> null and self.expression.type <> null and
	 self.isCollectionClass(parameterType) and 
	 not self.isCollectionClass(self.expression.type)"/> </eAnnotations> </eStructuralFeatures> <eStructuralFeatures xsi:type="ecore:EAttribute" name="isBitStringConversion" @@ -3828,7 +3828,7 @@ <details key="documentation" value="Whether the argument expression requires bit string conversion."/> </eAnnotations> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> - <details key="derivation" value="
 let parameterType = self.tuple().invocation.parameterNamed(self.name).type() in
 parameterType <> null and self.expression <> null and
 (self.isBitStringType(parameterType) or 
 self.isBitStringCollectionClass(parameterType)) and 
 not self.isBitStringType(self.expression.type)"/> + <details key="derivation" value="
 let parameter = self.tuple().invocation.parameterNamed(self.name) in
 	parameter <> null and
 	let parameterType = parameter.type() in
	 parameterType <> null and self.expression <> null and
	 (self.isBitStringType(parameterType) or 
	 self.isBitStringCollectionClass(parameterType)) and 
	 not self.isBitStringType(self.expression.type)"/> </eAnnotations> </eStructuralFeatures> </eClassifiers> @@ -4549,12 +4549,9 @@ <details key="body" value="
 let referent = self.referent in
 if referent = null then null
 else
 let parameters = referent.parameters() in
 if parameters->isEmpty() then null
 else parameters->first()
 endif
 endif"/> </eAnnotations> </eOperations> - <eOperations name="invocation" lowerBound="1" eType="#//BehaviorInvocationExpression"> - <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> - <details key="documentation" value="Return the behavior invocation expression that is equivalent to this
sequence operation expression."/> - </eAnnotations> + <eOperations name="firstArgument" lowerBound="1" eType="#//OutputNamedExpression"> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> - <details key="body" value="
				let firstParameter = self.firstParameter() in
				let namedExpression = NamedExpression{
					name = if firstParameter = null then null else firstParameter.name() endif,
					expression = self.primary.expression.reference()
				} in
				let namedTuple = NamedTuple{
					namedExpression = OrderedSet{namedExpression}->
						includingAll(self.tuple.input)->includingAll(self.tuple.output)
				} in
					BehaviorInvocationExpression{
						target = self.operation.copy(),
						referent = self.referent,
						tuple = namedTuple,
						owner = self
					}"/> + <details key="body" value="
				let firstParameter = self.firstParameter() in
					OutputNamedExpression{
						name = if firstParameter = null then null else firstParameter.name() endif,
						expression = self.primary.expression,
						index = null,
						owner = self.tuple
					}"/> </eAnnotations> </eOperations> <eOperations name="sequenceOperationExpressionReferentDerivation" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"> @@ -6178,9 +6175,9 @@ <details key="body" value="
 if self.expression.oclIsKindOf(PropertyAccessExpression) then
 self.expression.oclAsType(PropertyAccessExpression).featureReference
 else if self.expression.oclIsKindOf(SequenceAccessExpression) then
 let primary = self.expression.oclAsType(SequenceAccessExpression).primary in
 if primary.oclIsKindOf(PropertyAccessExpression) then
 primary.oclAsType(PropertyAccessExpression).featureReference
 else
 null
 endif
 else
 null
 endif endif"/> </eAnnotations> </eOperations> - <eOperations name="primary" eType="#//Expression"> + <eOperations name="expression" eType="#//Expression"> <eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot"> - <details key="body" value="
				PropertyAccessExpression{
					featureReference = self.feature(),
					owner = self.owner()
				}"/> + <details key="body" value="self.expression"/> </eAnnotations> </eOperations> <eOperations name="index" eType="#//Expression"> diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/model/alf.genmodel b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/model/alf.genmodel index c67fd3efe6b..14651de32f2 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/model/alf.genmodel +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/model/alf.genmodel @@ -1334,7 +1334,7 @@ <genParameters ecoreParameter="alf.ecore#//SequenceOperationExpression/isAddTarget/targetExpression"/>
</genOperations>
<genOperations ecoreOperation="alf.ecore#//SequenceOperationExpression/firstParameter"/>
- <genOperations ecoreOperation="alf.ecore#//SequenceOperationExpression/invocation"/>
+ <genOperations ecoreOperation="alf.ecore#//SequenceOperationExpression/firstArgument"/>
<genOperations ecoreOperation="alf.ecore#//SequenceOperationExpression/sequenceOperationExpressionReferentDerivation">
<genParameters ecoreParameter="alf.ecore#//SequenceOperationExpression/sequenceOperationExpressionReferentDerivation/diagnostics"/>
<genParameters ecoreParameter="alf.ecore#//SequenceOperationExpression/sequenceOperationExpressionReferentDerivation/context"/>
@@ -1762,10 +1762,10 @@ </genOperations>
</genClasses>
<genClasses ecoreClass="alf.ecore#//FeatureLeftHandSide">
- <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference alf.ecore#//FeatureLeftHandSide/expression"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference alf.ecore#//FeatureLeftHandSide/expression.1"/>
<genOperations ecoreOperation="alf.ecore#//FeatureLeftHandSide/referent"/>
<genOperations ecoreOperation="alf.ecore#//FeatureLeftHandSide/feature"/>
- <genOperations ecoreOperation="alf.ecore#//FeatureLeftHandSide/primary"/>
+ <genOperations ecoreOperation="alf.ecore#//FeatureLeftHandSide/expression"/>
<genOperations ecoreOperation="alf.ecore#//FeatureLeftHandSide/index"/>
<genOperations ecoreOperation="alf.ecore#//FeatureLeftHandSide/localName"/>
<genOperations ecoreOperation="alf.ecore#//FeatureLeftHandSide/featureLeftHandSideAssignmentBeforeDerivation">
diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/AlfPackage.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/AlfPackage.java index bd4486a8f61..a578d8da38e 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/AlfPackage.java +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/AlfPackage.java @@ -23651,13 +23651,13 @@ public interface AlfPackage extends EPackage { int SEQUENCE_OPERATION_EXPRESSION___FIRST_PARAMETER = INVOCATION_EXPRESSION_OPERATION_COUNT + 3; /** - * The operation id for the '<em>Invocation</em>' operation. + * The operation id for the '<em>First Argument</em>' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int SEQUENCE_OPERATION_EXPRESSION___INVOCATION = INVOCATION_EXPRESSION_OPERATION_COUNT + 4; + int SEQUENCE_OPERATION_EXPRESSION___FIRST_ARGUMENT = INVOCATION_EXPRESSION_OPERATION_COUNT + 4; /** * The operation id for the '<em>Sequence Operation Expression Referent Derivation</em>' operation. @@ -33628,15 +33628,6 @@ public interface AlfPackage extends EPackage { int FEATURE_LEFT_HAND_SIDE___ASSIGNED_NAME = LEFT_HAND_SIDE___ASSIGNED_NAME; /** - * The operation id for the '<em>Expression</em>' operation. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @generated - * @ordered - */ - int FEATURE_LEFT_HAND_SIDE___EXPRESSION = LEFT_HAND_SIDE___EXPRESSION; - - /** * The operation id for the '<em>Is Data Value Update</em>' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -33673,13 +33664,13 @@ public interface AlfPackage extends EPackage { int FEATURE_LEFT_HAND_SIDE___FEATURE = LEFT_HAND_SIDE_OPERATION_COUNT + 1; /** - * The operation id for the '<em>Primary</em>' operation. + * The operation id for the '<em>Expression</em>' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int FEATURE_LEFT_HAND_SIDE___PRIMARY = LEFT_HAND_SIDE_OPERATION_COUNT + 2; + int FEATURE_LEFT_HAND_SIDE___EXPRESSION = LEFT_HAND_SIDE_OPERATION_COUNT + 2; /** * The operation id for the '<em>Index</em>' operation. @@ -94896,14 +94887,14 @@ public interface AlfPackage extends EPackage { EOperation getSequenceOperationExpression__FirstParameter(); /** - * Returns the meta object for the '{@link org.eclipse.papyrus.uml.alf.SequenceOperationExpression#invocation() <em>Invocation</em>}' operation. + * Returns the meta object for the '{@link org.eclipse.papyrus.uml.alf.SequenceOperationExpression#firstArgument() <em>First Argument</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for the '<em>Invocation</em>' operation. - * @see org.eclipse.papyrus.uml.alf.SequenceOperationExpression#invocation() + * @return the meta object for the '<em>First Argument</em>' operation. + * @see org.eclipse.papyrus.uml.alf.SequenceOperationExpression#firstArgument() * @generated */ - EOperation getSequenceOperationExpression__Invocation(); + EOperation getSequenceOperationExpression__FirstArgument(); /** * Returns the meta object for the '{@link org.eclipse.papyrus.uml.alf.SequenceOperationExpression#sequenceOperationExpressionReferentDerivation(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Sequence Operation Expression Referent Derivation</em>}' operation. @@ -96661,14 +96652,14 @@ public interface AlfPackage extends EPackage { EOperation getFeatureLeftHandSide__Feature(); /** - * Returns the meta object for the '{@link org.eclipse.papyrus.uml.alf.FeatureLeftHandSide#primary() <em>Primary</em>}' operation. + * Returns the meta object for the '{@link org.eclipse.papyrus.uml.alf.FeatureLeftHandSide#expression() <em>Expression</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the meta object for the '<em>Primary</em>' operation. - * @see org.eclipse.papyrus.uml.alf.FeatureLeftHandSide#primary() + * @return the meta object for the '<em>Expression</em>' operation. + * @see org.eclipse.papyrus.uml.alf.FeatureLeftHandSide#expression() * @generated */ - EOperation getFeatureLeftHandSide__Primary(); + EOperation getFeatureLeftHandSide__Expression(); /** * Returns the meta object for the '{@link org.eclipse.papyrus.uml.alf.FeatureLeftHandSide#index() <em>Index</em>}' operation. diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/FeatureLeftHandSide.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/FeatureLeftHandSide.java index 837e602111b..a522dd28239 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/FeatureLeftHandSide.java +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/FeatureLeftHandSide.java @@ -74,10 +74,10 @@ public interface FeatureLeftHandSide extends LeftHandSide { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @model annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot body='\n\t\t\t\tPropertyAccessExpression{\n\t\t\t\t\tfeatureReference = self.feature(),\n\t\t\t\t\towner = self.owner()\n\t\t\t\t}'" + * @model annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot body='self.expression'" * @generated */ - Expression primary(); + Expression expression(); /** * <!-- begin-user-doc --> diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/InputNamedExpression.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/InputNamedExpression.java index 86774cf4414..6ca7be19096 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/InputNamedExpression.java +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/InputNamedExpression.java @@ -118,7 +118,7 @@ public interface InputNamedExpression extends SyntaxElement { * @see #setIsCollectionConversion(boolean) * @see org.eclipse.papyrus.uml.alf.AlfPackage#getInputNamedExpression_IsCollectionConversion() * @model transient="true" volatile="true" derived="true" - * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot derivation='\n let parameterType = self.tuple().invocation.parameterNamed(self.name).type() in\n parameterType <> null and self.expression.type <> null and\n self.isCollectionClass(parameterType) and \n not self.isCollectionClass(self.expression.type)'" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot derivation='\n let parameter = self.tuple().invocation.parameterNamed(self.name) in\n \tparameter <> null and\n \tlet parameterType = parameter.type() in\n\t parameterType <> null and self.expression.type <> null and\n\t self.isCollectionClass(parameterType) and \n\t not self.isCollectionClass(self.expression.type)'" * @generated */ boolean isIsCollectionConversion(); @@ -144,7 +144,7 @@ public interface InputNamedExpression extends SyntaxElement { * @see #setIsBitStringConversion(boolean) * @see org.eclipse.papyrus.uml.alf.AlfPackage#getInputNamedExpression_IsBitStringConversion() * @model transient="true" volatile="true" derived="true" - * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot derivation='\n let parameterType = self.tuple().invocation.parameterNamed(self.name).type() in\n parameterType <> null and self.expression <> null and\n (self.isBitStringType(parameterType) or \n self.isBitStringCollectionClass(parameterType)) and \n not self.isBitStringType(self.expression.type)'" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot derivation='\n let parameter = self.tuple().invocation.parameterNamed(self.name) in\n \tparameter <> null and\n \tlet parameterType = parameter.type() in\n\t parameterType <> null and self.expression <> null and\n\t (self.isBitStringType(parameterType) or \n\t self.isBitStringCollectionClass(parameterType)) and \n\t not self.isBitStringType(self.expression.type)'" * @generated */ boolean isIsBitStringConversion(); diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/SequenceOperationExpression.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/SequenceOperationExpression.java index 6be2c648582..d6d5cb30fb1 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/SequenceOperationExpression.java +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/SequenceOperationExpression.java @@ -199,15 +199,11 @@ public interface SequenceOperationExpression extends InvocationExpression { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> - * <!-- begin-model-doc --> - * Return the behavior invocation expression that is equivalent to this - * sequence operation expression. - * <!-- end-model-doc --> * @model required="true" - * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot body='\n\t\t\t\tlet firstParameter = self.firstParameter() in\n\t\t\t\tlet namedExpression = NamedExpression{\n\t\t\t\t\tname = if firstParameter = null then null else firstParameter.name() endif,\n\t\t\t\t\texpression = self.primary.expression.reference()\n\t\t\t\t} in\n\t\t\t\tlet namedTuple = NamedTuple{\n\t\t\t\t\tnamedExpression = OrderedSet{namedExpression}->\n\t\t\t\t\t\tincludingAll(self.tuple.input)->includingAll(self.tuple.output)\n\t\t\t\t} in\n\t\t\t\t\tBehaviorInvocationExpression{\n\t\t\t\t\t\ttarget = self.operation.copy(),\n\t\t\t\t\t\treferent = self.referent,\n\t\t\t\t\t\ttuple = namedTuple,\n\t\t\t\t\t\towner = self\n\t\t\t\t\t}'" + * annotation="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot body='\n\t\t\t\tlet firstParameter = self.firstParameter() in\n\t\t\t\t\tOutputNamedExpression{\n\t\t\t\t\t\tname = if firstParameter = null then null else firstParameter.name() endif,\n\t\t\t\t\t\texpression = self.primary.expression,\n\t\t\t\t\t\tindex = null,\n\t\t\t\t\t\towner = self.tuple\n\t\t\t\t\t}'" * @generated */ - BehaviorInvocationExpression invocation(); + OutputNamedExpression firstArgument(); /** * <!-- begin-user-doc --> diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/AlfPackageImpl.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/AlfPackageImpl.java index 048c338a114..6d5aad22107 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/AlfPackageImpl.java +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/AlfPackageImpl.java @@ -8118,7 +8118,7 @@ public class AlfPackageImpl extends EPackageImpl implements AlfPackage { * <!-- end-user-doc --> * @generated */ - public EOperation getSequenceOperationExpression__Invocation() { + public EOperation getSequenceOperationExpression__FirstArgument() { return getSequenceOperationExpression().getEOperations().get(4); } @@ -9717,7 +9717,7 @@ public class AlfPackageImpl extends EPackageImpl implements AlfPackage { * <!-- end-user-doc --> * @generated */ - public EOperation getFeatureLeftHandSide__Primary() { + public EOperation getFeatureLeftHandSide__Expression() { return getFeatureLeftHandSide().getEOperations().get(2); } diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/FeatureLeftHandSideImpl.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/FeatureLeftHandSideImpl.java index cb90cf66f82..32e42730002 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/FeatureLeftHandSideImpl.java +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/FeatureLeftHandSideImpl.java @@ -127,23 +127,23 @@ public class FeatureLeftHandSideImpl extends LeftHandSideImpl implements Feature } /** - * The cached invocation delegate for the '{@link #primary() <em>Primary</em>}' operation. + * The cached invocation delegate for the '{@link #expression() <em>Expression</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #primary() + * @see #expression() * @generated * @ordered */ - protected static final EOperation.Internal.InvocationDelegate PRIMARY__EINVOCATION_DELEGATE = ((EOperation.Internal)AlfPackage.eINSTANCE.getFeatureLeftHandSide__Primary()).getInvocationDelegate(); + protected static final EOperation.Internal.InvocationDelegate EXPRESSION__EINVOCATION_DELEGATE = ((EOperation.Internal)AlfPackage.eINSTANCE.getFeatureLeftHandSide__Expression()).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - public Expression primary() { + public Expression expression() { try { - return (Expression)PRIMARY__EINVOCATION_DELEGATE.dynamicInvoke(this, null); + return (Expression)EXPRESSION__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); @@ -485,8 +485,8 @@ public class FeatureLeftHandSideImpl extends LeftHandSideImpl implements Feature return referent(); case AlfPackage.FEATURE_LEFT_HAND_SIDE___FEATURE: return feature(); - case AlfPackage.FEATURE_LEFT_HAND_SIDE___PRIMARY: - return primary(); + case AlfPackage.FEATURE_LEFT_HAND_SIDE___EXPRESSION: + return expression(); case AlfPackage.FEATURE_LEFT_HAND_SIDE___INDEX: return index(); case AlfPackage.FEATURE_LEFT_HAND_SIDE___LOCAL_NAME: diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/SequenceOperationExpressionImpl.java b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/SequenceOperationExpressionImpl.java index 099a8bcacdb..d23a7c611ee 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/SequenceOperationExpressionImpl.java +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/SequenceOperationExpressionImpl.java @@ -22,13 +22,13 @@ import org.eclipse.emf.ecore.util.EObjectValidator; import org.eclipse.papyrus.uml.alf.AlfPackage; import org.eclipse.papyrus.uml.alf.AssignedSource; -import org.eclipse.papyrus.uml.alf.BehaviorInvocationExpression; import org.eclipse.papyrus.uml.alf.ElementReference; import org.eclipse.papyrus.uml.alf.Expression; import org.eclipse.papyrus.uml.alf.ExtentOrExpression; import org.eclipse.papyrus.uml.alf.FeatureReference; import org.eclipse.papyrus.uml.alf.InvocationExpression; import org.eclipse.papyrus.uml.alf.LeftHandSide; +import org.eclipse.papyrus.uml.alf.OutputNamedExpression; import org.eclipse.papyrus.uml.alf.QualifiedName; import org.eclipse.papyrus.uml.alf.SequenceOperationExpression; @@ -258,23 +258,23 @@ public class SequenceOperationExpressionImpl extends InvocationExpressionImpl im } /** - * The cached invocation delegate for the '{@link #invocation() <em>Invocation</em>}' operation. + * The cached invocation delegate for the '{@link #firstArgument() <em>First Argument</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @see #invocation() + * @see #firstArgument() * @generated * @ordered */ - protected static final EOperation.Internal.InvocationDelegate INVOCATION__EINVOCATION_DELEGATE = ((EOperation.Internal)AlfPackage.eINSTANCE.getSequenceOperationExpression__Invocation()).getInvocationDelegate(); + protected static final EOperation.Internal.InvocationDelegate FIRST_ARGUMENT__EINVOCATION_DELEGATE = ((EOperation.Internal)AlfPackage.eINSTANCE.getSequenceOperationExpression__FirstArgument()).getInvocationDelegate(); /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - public BehaviorInvocationExpression invocation() { + public OutputNamedExpression firstArgument() { try { - return (BehaviorInvocationExpression)INVOCATION__EINVOCATION_DELEGATE.dynamicInvoke(this, null); + return (OutputNamedExpression)FIRST_ARGUMENT__EINVOCATION_DELEGATE.dynamicInvoke(this, null); } catch (InvocationTargetException ite) { throw new WrappedException(ite); @@ -673,8 +673,8 @@ public class SequenceOperationExpressionImpl extends InvocationExpressionImpl im return isAddTarget((Expression)arguments.get(0)); case AlfPackage.SEQUENCE_OPERATION_EXPRESSION___FIRST_PARAMETER: return firstParameter(); - case AlfPackage.SEQUENCE_OPERATION_EXPRESSION___INVOCATION: - return invocation(); + case AlfPackage.SEQUENCE_OPERATION_EXPRESSION___FIRST_ARGUMENT: + return firstArgument(); case AlfPackage.SEQUENCE_OPERATION_EXPRESSION___SEQUENCE_OPERATION_EXPRESSION_REFERENT_DERIVATION__DIAGNOSTICCHAIN_MAP: return sequenceOperationExpressionReferentDerivation((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); case AlfPackage.SEQUENCE_OPERATION_EXPRESSION___SEQUENCE_OPERATION_EXPRESSION_FEATURE_DERIVATION__DIAGNOSTICCHAIN_MAP: diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/alf.ecore b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/alf.ecore index 183a8691add..e2ba9dbbd4c 100644 --- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/alf.ecore +++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf/syntax-gen/org/eclipse/papyrus/uml/alf/impl/alf.ecore @@ -3227,14 +3227,14 @@ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" volatile="true"
transient="true" derived="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
- <details key="derivation" value="
 let parameterType = self.tuple().invocation.parameterNamed(self.name).type() in
 parameterType <> null and self.expression.type <> null and
 self.isCollectionClass(parameterType) and 
 not self.isCollectionClass(self.expression.type)"/>
+ <details key="derivation" value="
 let parameter = self.tuple().invocation.parameterNamed(self.name) in
 	parameter <> null and
 	let parameterType = parameter.type() in
	 parameterType <> null and self.expression.type <> null and
	 self.isCollectionClass(parameterType) and 
	 not self.isCollectionClass(self.expression.type)"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isBitStringConversion"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean" volatile="true"
transient="true" derived="true">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
- <details key="derivation" value="
 let parameterType = self.tuple().invocation.parameterNamed(self.name).type() in
 parameterType <> null and self.expression <> null and
 (self.isBitStringType(parameterType) or 
 self.isBitStringCollectionClass(parameterType)) and 
 not self.isBitStringType(self.expression.type)"/>
+ <details key="derivation" value="
 let parameter = self.tuple().invocation.parameterNamed(self.name) in
 	parameter <> null and
 	let parameterType = parameter.type() in
	 parameterType <> null and self.expression <> null and
	 (self.isBitStringType(parameterType) or 
	 self.isBitStringCollectionClass(parameterType)) and 
	 not self.isBitStringType(self.expression.type)"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
@@ -3797,9 +3797,9 @@ <details key="body" value="
 let referent = self.referent in
 if referent = null then null
 else
 let parameters = referent.parameters() in
 if parameters->isEmpty() then null
 else parameters->first()
 endif
 endif"/>
</eAnnotations>
</eOperations>
- <eOperations name="invocation" lowerBound="1" eType="#//BehaviorInvocationExpression">
+ <eOperations name="firstArgument" lowerBound="1" eType="#//OutputNamedExpression">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
- <details key="body" value="
				let firstParameter = self.firstParameter() in
				let namedExpression = NamedExpression{
					name = if firstParameter = null then null else firstParameter.name() endif,
					expression = self.primary.expression.reference()
				} in
				let namedTuple = NamedTuple{
					namedExpression = OrderedSet{namedExpression}->
						includingAll(self.tuple.input)->includingAll(self.tuple.output)
				} in
					BehaviorInvocationExpression{
						target = self.operation.copy(),
						referent = self.referent,
						tuple = namedTuple,
						owner = self
					}"/>
+ <details key="body" value="
				let firstParameter = self.firstParameter() in
					OutputNamedExpression{
						name = if firstParameter = null then null else firstParameter.name() endif,
						expression = self.primary.expression,
						index = null,
						owner = self.tuple
					}"/>
</eAnnotations>
</eOperations>
<eOperations name="sequenceOperationExpressionReferentDerivation" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
@@ -5001,9 +5001,9 @@ <details key="body" value="
 if self.expression.oclIsKindOf(PropertyAccessExpression) then
 self.expression.oclAsType(PropertyAccessExpression).featureReference
 else if self.expression.oclIsKindOf(SequenceAccessExpression) then
 let primary = self.expression.oclAsType(SequenceAccessExpression).primary in
 if primary.oclIsKindOf(PropertyAccessExpression) then
 primary.oclAsType(PropertyAccessExpression).featureReference
 else
 null
 endif
 else
 null
 endif endif"/>
</eAnnotations>
</eOperations>
- <eOperations name="primary" eType="#//Expression">
+ <eOperations name="expression" eType="#//Expression">
<eAnnotations source="http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot">
- <details key="body" value="
				PropertyAccessExpression{
					featureReference = self.feature(),
					owner = self.owner()
				}"/>
+ <details key="body" value="self.expression"/>
</eAnnotations>
</eOperations>
<eOperations name="index" eType="#//Expression">
|