Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Cuccuru2015-06-10 10:04:10 +0000
committerArnaud Cuccuru2015-06-10 10:05:00 +0000
commit5672c4f62acac4b207f5b32197db5728da43186b (patch)
tree1dbb2456c993996251b9f508260c5557861c0e7f
parent190b936157d70daf0f2c9a9a9eef8cdd8e01a434 (diff)
parentec334fb408ce5eecc095cae84cf995fc507a4cc4 (diff)
downloadorg.eclipse.papyrus-5672c4f62acac4b207f5b32197db5728da43186b.tar.gz
org.eclipse.papyrus-5672c4f62acac4b207f5b32197db5728da43186b.tar.xz
org.eclipse.papyrus-5672c4f62acac4b207f5b32197db5728da43186b.zip
Merge branch 'bugs/462954-alf'
Change-Id: I0f19a77ea87af9ade7401033766c4ca5403500c3 Signed-off-by: Arnaud Cuccuru <arnaud.cuccuru@cea.fr>
-rw-r--r--plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/Alf2UML.qvto31
-rw-r--r--plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfCommon2UML.qvto76
-rw-r--r--plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfExpression2UML.qvto204
-rw-r--r--plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/AlfStatement2UML.qvto4
4 files changed, 195 insertions, 120 deletions
diff --git a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/Alf2UML.qvto b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/Alf2UML.qvto
index cf5b13dacf8..01d50a19f1c 100644
--- a/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/Alf2UML.qvto
+++ b/plugins/uml/alf/org.eclipse.papyrus.uml.alf.to.fuml/transformation/Alf2UML.qvto
@@ -284,23 +284,6 @@ mapping UnitDefinition::toNamespace() : Namespace
init {
result := self.definition.map toNamespace();
}
- // TODO: Handle namespace declarations.
- /*
- if self.namespace <> null then
- let namespace =
- if self.namespace.isUml() then
- self.namespace.asUml().oclAsType(Namespace)
- else
- self.namespace.asAlf().oclAsType(NamespaceDefinition).map toNamespace()
- endif
- in
- if namespace.oclIsKindOf(Package) and result.oclIsKindOf(PackageableElement) then
- namespace.oclAsType(Package).packagedElement += result.oclAsType(PackageableElement)
- else if namespace.oclIsKindOf(Class) and result.oclIsKindOf(Classifier) then
- namespace.oclAsType(Class).nestedClassifier += result.oclAsType(Classifier)
- endif endif
- endif;
- */
elementImport := self._import[ElementImportReference]->map toElementImport();
packageImport := self._import[PackageImportReference]->map toPackageImport();
if self.annotation->notEmpty() then
@@ -454,9 +437,9 @@ init {
// log("template=" + template.toString());
result := template.newInstance();
}
- isAbstract := self.isAbstract;
+ isAbstract := template.isAbstract;
var templateSignature := template.ownedTemplateSignature;
- log("signature=" + templateSignature.toString());
+ // log("signature=" + templateSignature.toString());
if templateSignature <> null then
templateBinding := object uml::TemplateBinding {
signature := templateSignature;
@@ -628,7 +611,7 @@ helper ClassDefinition::createInitializationMethod(class_ : Class, initializatio
};
// Add action to set initialization to true.
- initializationNode.node += var valueAction ::= new ValueSpecificationAction(new LiteralBoolean(true, self.booleanType().toType()));
+ initializationNode.node += var valueAction ::= new ValueSpecificationAction(self.literalBoolean(true));
initializationNode.node += var writeAction ::= new AddStructuralFeatureValueAction(initializationFlag, true, null);
new ObjectFlow(method, selfFork, writeAction._'object');
new ObjectFlow(initializationNode, valueAction.result, writeAction.value);
@@ -643,8 +626,8 @@ helper ClassDefinition::createInitializationMethod(class_ : Class, initializatio
method.ownedNode += var sizeAction ::= new CallBehaviorAction(self.functionSize());
new ObjectFlow(method, readAction.result, sizeAction.argument->at(1));
- method.ownedNode += valueAction := new ValueSpecificationAction(new LiteralInteger(0, self.integerType().toType()));
- method.ownedNode += var testAction ::= new TestIdentityAction("Size==0", self.booleanType().toType());
+ method.ownedNode += valueAction := new ValueSpecificationAction(self.literalInteger(0));
+ method.ownedNode += var testAction ::= new TestIdentityAction("Size==0", self.typeBoolean());
new ObjectFlow(method, sizeAction.result->at(1), testAction.first);
new ObjectFlow(method, valueAction.result, testAction.second);
@@ -1092,8 +1075,8 @@ helper OperationDefinition::mapConstructor(initializationFlag : Property, initia
method.ownedNode += var sizeAction ::= new CallBehaviorAction(self.functionSize());
new ObjectFlow(method, readAction.result, sizeAction.argument->at(1));
- method.ownedNode += var valueAction ::= new ValueSpecificationAction(new LiteralInteger(0, self.integerType().toType()));
- method.ownedNode += var testAction ::= new TestIdentityAction("Size==0", self.booleanType().toType());
+ method.ownedNode += var valueAction ::= new ValueSpecificationAction(self.literalInteger(0));
+ method.ownedNode += var testAction ::= new TestIdentityAction("Size==0", self.typeBoolean());
new ObjectFlow(method, sizeAction.result->at(1), testAction.first);
new ObjectFlow(method, valueAction.result, testAction.second);
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 afa597394ba..37efa54f957 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
@@ -20,10 +20,27 @@ transformation AlfCommon2UML(in alf : Alf, inout uml : UML);
abstract mapping SyntaxElement::toUml() : Element;
+property libraryCache : Dict(String, ElementReference);
+
+helper SyntaxElement::libraryElement(path : String) : ElementReference {
+ var referent := libraryCache->get(path);
+ if referent = null then {
+ referent := self.resolveInLibrary(path)![true];
+ if referent <> null then {
+ libraryCache->put(path, referent);
+ } endif;
+ } endif;
+ return referent;
+}
+
+helper SyntaxElement::collectionFunctionsPackage() : ElementReference {
+ return self.libraryElement("CollectionFunctions");
+}
+
helper SyntaxElement::libraryFunction(path : String) : Behavior {
- var referent := self.resolveInLibrary(path)![isBehavior()];
+ var referent := self.libraryElement(path);
return
- if referent->isEmpty() then null
+ if referent = null then null
else referent.toUml().oclAsType(Behavior)
endif;
}
@@ -124,24 +141,52 @@ helper SyntaxElement::functionIntegerToBitString() : Behavior {
return self.libraryFunction("PrimitiveBehaviors::BitStringFunctions::ToBitString");
}
+helper SyntaxElement::libraryType(name : String) : Type {
+ return self.libraryElement("PrimitiveTypes::" + name).toType();
+}
+
+helper SyntaxElement::typeBoolean() : Type {
+ return self.libraryType("Boolean");
+}
+
+helper SyntaxElement::typeNatural() : Type {
+ return self.libraryType("Natural");
+}
+
+helper SyntaxElement::typeInteger() : Type {
+ return self.libraryType("Integer");
+}
+
+helper SyntaxElement::typeString() : Type {
+ return self.libraryType("String");
+}
+
+helper SyntaxElement::typeUnlimitedNatural() : Type {
+ return self.libraryType("UnlimitedNatural");
+}
+
+helper SyntaxElement::typeBitString() : Type {
+ return self.libraryType("BitString");
+}
+
helper SyntaxElement::literalBoolean(b : Boolean) : LiteralBoolean {
- return new LiteralBoolean(b, self.booleanType().toType());
+ return new LiteralBoolean(b, self.typeBoolean());
}
helper SyntaxElement::literalNatural(n : Integer) : LiteralInteger {
- return new LiteralInteger(n, self.naturalType().toType());
+ return new LiteralInteger(n, self.typeNatural());
}
helper SyntaxElement::literalInteger(i : Integer) : LiteralInteger {
- return new LiteralInteger(i, self.integerType().toType());
+ return new LiteralInteger(i, self.typeInteger());
}
helper SyntaxElement::literalString(s : String) : LiteralString {
- return new LiteralString(s, self.stringType().toType());
+ return new LiteralString(s, self.typeString());
}
helper SyntaxElement::literalUnlimited() : LiteralUnlimitedNatural {
- return new LiteralUnlimitedNatural(self.unlimitedNaturalType().toType());
+ return new LiteralUnlimitedNatural(self.typeUnlimitedNatural());
}
// Documented Elements
@@ -179,13 +224,6 @@ helper toType(reference : ElementReference) : Type {
helper BoundElementReference::toUml() : Element {
// TODO: Handle expansion of template bindings.
return self.referent.toUml();
- /*
- if self.isTemplateBinding() then
- self.templateBinding.toUml()
- else
- self.referent.toUml()
- endif;
- */
}
// Constructors
@@ -797,16 +835,6 @@ helper addEdgesToStructuredNode(inout structuredNode : StructuredActivityNode, i
var allOwnedNodes := structuredNode.allOwnedNodes();
var internalEdges := edges[allOwnedNodes->includes(source) and allOwnedNodes->includes(target)];
structuredNode.edge += internalEdges;
- /*
- edges->forEach(edge) {
- edge.ownedComment += object Comment {
- body := nameOf(structuredNode) + ": " +
- if allOwnedNodes->includes(edge.source) then "source " else "" endif +
- if allOwnedNodes->includes(edge.target) then "target " else "" endif ;
- annotatedElement := edge;
- }
- };
- */
return edges - internalEdges;
}
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 3aaf0d42630..bfe872b96d3 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
@@ -423,28 +423,72 @@ helper InvocationExpression::InvocationExpression_mapTarget(inout graph : Expres
if self.isImplicit then {
graph.nodes += action := new DestroyObjectAction(self.feature.expression.type.toUml().oclAsType(Class));
} else {
- var element := self.referent.toUml();
- switch {
- case(element.oclIsKindOf(Operation)) {
- graph.nodes += action := new CallOperationAction(element.oclAsType(Operation));
- graph.resultSource := action.returnPin();
- }
- case(element.oclIsKindOf(Signal)) {
- graph.nodes += action := new SendSignalAction(element.oclAsType(Signal));
- }
- case(element.oclIsKindOf(Behavior)) {
- graph.nodes += action := new CallBehaviorAction(element.oclAsType(Behavior));
- graph.resultSource := action.returnPin();
- }
- case(element.oclIsKindOf(Property)) {
- graph.nodes += action := new ReadLinkAction(element.oclAsType(Property));
- graph.resultSource := action._'output'->at(1);
- }
+ var element :=
+ if self.isCollectionFunctionInvocation() then
+ // Optimize the invocation of a (not in-place) collection function by calling
+ // the corresponding sequence function directly.
+ self.sequenceFunction()
+ else
+ self.referent.toUml()
+ endif;
+
+ switch {
+ case(element = null) {
+ graph.nodes += action := new ValueSpecificationAction(new LiteralNull());
+ graph.resultSource := action.output->at(1);
+ }
+ case(element.oclIsKindOf(Operation)) {
+ graph.nodes += action := new CallOperationAction(element.oclAsType(Operation));
+ graph.resultSource := action.returnPin();
+ }
+ case(element.oclIsKindOf(Signal)) {
+ graph.nodes += action := new SendSignalAction(element.oclAsType(Signal));
+ }
+ case(element.oclIsKindOf(Behavior)) {
+ graph.nodes += action := new CallBehaviorAction(element.oclAsType(Behavior));
+ graph.resultSource := action.returnPin();
+ }
+ case(element.oclIsKindOf(Property)) {
+ graph.nodes += action := new ReadLinkAction(element.oclAsType(Property));
+ graph.resultSource := action.output->at(1);
+ };
};
} endif;
return action;
}
+helper InvocationExpression::isCollectionFunctionInvocation() : Boolean {
+ var referent := self.referent;
+ return referent.isTemplateBinding() and
+ self.collectionFunctionsPackage().equals(referent.template().namespace());
+}
+
+query InvocationExpression::sequenceFunction() : Behavior {
+ var behavior : Behavior := null;
+ var name := self.referent.template().name();
+
+ if name <> "clear" then {
+ var sequenceFunctionName :=
+ switch {
+ case(name = "add") "Including";
+ case(name = "addAll") "Union";
+ case(name = "addAt") "IncludeAt";
+ case(name = "addAllAt") "IncludeAllAt";
+ case(name = "remove") "Excluding";
+ case(name = "removeAll") "Difference";
+ case(name = "removeOne") "ExcludingOne";
+ case(name = "removeAt") "ExcludeAt";
+ case(name = "replace") "Replacing";
+ case(name = "replaceOne") "ReplacingOne";
+ case(name = "replaceAt") "ReplacingAt";
+ else name.firstToUpper();
+ };
+ behavior := self.sequenceFunction(sequenceFunctionName);
+ } endif;
+
+ return behavior;
+}
+
helper InvocationExpression::mapTuple(inout graph : ExpressionGraph, action : Action) : ActivityGraph {
return self.tuple.map toActivityGraph(graph, action, null, null);
}
@@ -539,7 +583,7 @@ 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==" + nameOf(targetNode), self.booleanType().toType());
+ graph.nodes += var testAction ::= new TestIdentityAction("self==" + nameOf(targetNode), self.typeBoolean());
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);
@@ -606,32 +650,36 @@ mapping _Tuple::toActivityGraph(inout graph : ExpressionGraph, action : Action,
// Add collection and bit string conversions, if required.
self.mapConversions(inputGraph, expressionType, input.isCollectionConversion, input.isBitStringConversion);
- var inputPin := action.input->at(i);
- edges += new ObjectFlow(inputGraph.resultSource, inputPin);
-
- // Check for an index on the argument name (as opposed to the argument expression itself).
- var index := input.index;
- if index <> null or invocation.oclIsKindOf(LinkOperationExpression) and inputPin.isOrdered then {
- var indexSource : ActivityNode;
- if index = null then {
- inputGraph.nodes += var valueAction ::= new ValueSpecificationAction(self.literalUnlimited());
- indexSource := valueAction.result;
- } else {
- var indexGraph := index.map toActivityGraph();
- indexGraph.addTo(result);
- indexSource := indexGraph.resultSource;
- if self.isIntegerType(index.type) then {
- inputGraph.nodes += var callAction ::= new CallBehaviorAction(self.integerFunction("ToUnlimitedNatural"));
- inputGraph.edges += new ObjectFlow(inputGraph.resultSource, callAction.argument->at(1));
- indexSource := callAction.result->at(1);
+ // NOTE: For the mapping of CollectionFunctions::clear, the action will be a value specification action,
+ // with no input.
+ if i <= action.input->size() then {
+ var inputPin := action.input->at(i);
+ edges += new ObjectFlow(inputGraph.resultSource, inputPin);
+
+ // Check for an index on the argument name (as opposed to the argument expression itself).
+ var index := input.index;
+ if index <> null or invocation.oclIsKindOf(LinkOperationExpression) and inputPin.isOrdered then {
+ var indexSource : ActivityNode;
+ if index = null then {
+ inputGraph.nodes += var valueAction ::= new ValueSpecificationAction(self.literalUnlimited());
+ indexSource := valueAction.result;
+ } else {
+ var indexGraph := index.map toActivityGraph();
+ indexGraph.addTo(result);
+ indexSource := indexGraph.resultSource;
+ if self.isIntegerType(index.type) then {
+ inputGraph.nodes += var callAction ::= new CallBehaviorAction(self.integerFunction("ToUnlimitedNatural"));
+ inputGraph.edges += new ObjectFlow(inputGraph.resultSource, callAction.argument->at(1));
+ indexSource := callAction.result->at(1);
+ } endif;
} endif;
- } endif;
- // NOTE: This presumes that the "insertAt" or "destroyAt" pin comes directly after
- // the value pin in the list of input pins.
- i := i + 1;
- inputGraph.edges += new ObjectFlow(indexSource, action.input->at(i));
+ // NOTE: This presumes that the "insertAt" or "destroyAt" pin comes directly after
+ // the value pin in the list of input pins.
+ i := i + 1;
+ inputGraph.edges += new ObjectFlow(indexSource, action.input->at(i));
+ } endif;
} endif;
-
+
inputGraph.addTo(subgraph);
i := i + 1;
};
@@ -648,17 +696,22 @@ mapping _Tuple::toActivityGraph(inout graph : ExpressionGraph, action : Action,
outputParameters->forEach(parameter) {
var output := outputs![name = parameter.name()];
if output <> null and not output.expression.isNull() then {
- var outputGraph := object ExpressionGraph{};
+ var outputGraph := object ExpressionGraph{
+ resultSource := action.output->at(i)
+ };
+
var lhs := output.leftHandSide;
var lhsGraph := lhs.map toActivityGraph(objectSourceMap->get(output.name), indexSourceMap->get(output.name), -1);
lhsGraph.addTo(outputGraph);
-
- // Skip the return pin. The return parameter never has an output argument.
- outputGraph.resultSource := action.output->at(i);
- if outputGraph.resultSource = returnPin then {
+
+ if invocation.isCollectionFunctionInvocation() then {
+ graph.resultSource := lhsGraph.resultSource;
+ } else if outputGraph.resultSource = returnPin then {
+ // Unless this is the mapping of an in-place collection function invocation, skip a return pin.
+ // The return value is not normally given through a tuple argument.
i := i + 1;
outputGraph.resultSource := action.output->at(i);
- } endif;
+ } endif endif;
// Add collection and bit string conversion, if required.
self.mapConversions(outputGraph, parameter.type(), output.isCollectionConversion, output.isBitStringConversion);
@@ -813,7 +866,7 @@ helper InstanceCreationExpression::mapTarget(inout graph : ExpressionGraph) : Ac
helper LinkOperationExpression::mapTarget(inout graph : ActivityGraph) : Action {
var association := self.referent.toUml().oclAsType(Association);
- var unlimitedNaturalType := self.unlimitedNaturalType().toType();
+ var unlimitedNaturalType := self.typeUnlimitedNatural();
graph.nodes += var action ::=
if self.isClear then new ClearAssociationAction(association)
else if self.isCreation then new CreateLinkAction(association, unlimitedNaturalType)
@@ -996,7 +1049,7 @@ query SequenceRange::isEmpty() : Boolean {
helper SyntaxElement::mapSequenceRangeLoop(
resultSource1 : ActivityNode, resultSource2 : ActivityNode,
label : String) : ExpressionGraph {
- var integerType := self.integerType().toType();
+ var integerType := self.typeInteger();
var rangeLowerInputPin := new InputPin("rangeLower", integerType, 1, 1);
var rangeUpperInputPin := new InputPin("rangeUpper", integerType, 1, 1);
var accumulatorInputPin := new InputPin("range", integerType, 0, -1);
@@ -1224,7 +1277,7 @@ mapping ForAllOrExistsOrOneExpression::toActivityGraph() : ExpressionGraph
case(self.operation = "one") {
addBehavior(result, self.functionSize());
nodes += var valueAction ::= new ValueSpecificationAction(self.literalInteger(1));
- nodes += var testAction ::= new TestIdentityAction("=1", self.booleanType().toType());
+ nodes += var testAction ::= new TestIdentityAction("=1", self.typeBoolean());
edges += new ObjectFlow(resultSource, testAction.first);
edges += new ObjectFlow(valueAction.result, testAction.second);
resultSource := testAction.result;
@@ -1268,7 +1321,7 @@ mapping IsUniqueExpression::toActivityGraph() : ExpressionGraph
nestedGraph.nodes += var variableSource ::= new ForkNode("each");
nestedGraph.nodes += var callAction := new CallBehaviorAction(self.functionCount());
nestedGraph.nodes += var valueAction := new ValueSpecificationAction(self.literalInteger(1));
- nestedGraph.nodes += var testAction := new TestIdentityAction("=1", self.booleanType().toType());
+ nestedGraph.nodes += var testAction := new TestIdentityAction("=1", self.typeBoolean());
nestedGraph.edges += new ObjectFlow(forkNode, callAction.argument->at(1));
nestedGraph.edges += new ObjectFlow(variableSource, callAction.argument->at(2));
nestedGraph.edges += new ObjectFlow(callAction.result->at(1), testAction.first);
@@ -1387,15 +1440,20 @@ mapping CastExpression::toActivityGraph() : ExpressionGraph
if type = null or
operandType <> null and operandType.conformsTo(self.type) and
- // The following condition is to treat up-casting of
- // naturals to unlimited naturals as a real conversion,
- // because naturals are represented as integers.
- not(self.isNaturalType(operandType) and self.isUnlimitedNaturalType(type)) or
+ // The following condition is to treat up-casting of
+ // naturals to unlimited naturals as a real conversion,
+ // because naturals are represented as integers.
+ not(self.isNaturalType(operandType) and self.isUnlimitedNaturalType(type)) or
// The following condition is an optimization to avoid
// generating an expansion region when the operand is known
// to be null.
- self.operand.isNull() then {
+ self.operand.isNull() or
+
+ // TODO: Implement casts to template parameters.
+ type.isTemplateParameter()
+
+ then {
// Up-cast, no conversion is necessary.
resultSource := operandGraph.resultSource;
@@ -1456,12 +1514,12 @@ helper CastExpression::mapNestedGraph(inout nestedGraph : ExpressionGraph, label
// Natural values are represented as integers.
if operandType = null or self.isUnlimitedNaturalType(operandType) then {
source := self.addClassificationDecision(
- nestedGraph, self.unlimitedNaturalType().toType(), target, source,
+ nestedGraph, self.typeUnlimitedNatural(), target, source,
self.functionUnlimitedNaturalToInteger());
} endif;
if operandType = null or self.isBitStringType(operandType) then {
source := self.addClassificationDecision(
- nestedGraph, self.bitStringType().toType(), target, source,
+ nestedGraph, self.typeBitString(), target, source,
self.functionBitStringToInteger());
} endif;
if operandType = null or
@@ -1483,14 +1541,14 @@ helper CastExpression::mapNestedGraph(inout nestedGraph : ExpressionGraph, label
} endif;
if operandType = null or self.isIntegerType(operandType) then {
source := self.addClassificationDecision(
- nestedGraph, self.integerType().toType(), target, source,
+ nestedGraph, self.typeInteger(), target, source,
self.functionIntegerToUnlimitedNatural());
} endif;
} else if self.isBitStringType(type) then {
if operandType = null or self.isIntegerType(operandType) then {
source := self.addClassificationDecision(
- nestedGraph, self.integerType().toType(), target, source,
+ nestedGraph, self.typeInteger(), target, source,
self.functionIntegerToBitString());
} endif;
if operandType = null or not self.isIntegerType(operandType) then {
@@ -1514,7 +1572,7 @@ helper CastExpression::addClassificationDecision(
conversionFunction : Behavior) : ActivityNode {
graph.nodes += var isClassifiedAction ::=
- new ReadIsClassifiedObjectAction(type.oclAsType(Classifier), false, self.booleanType().toType());
+ new ReadIsClassifiedObjectAction(type.oclAsType(Classifier), false, self.typeBoolean());
graph.nodes += var forkNode ::= new ForkNode(isClassifiedAction._'object'.name);
graph.edges += new ObjectFlow(forkNode, isClassifiedAction._'object');
@@ -1670,10 +1728,16 @@ mapping ClassificationExpression::toActivityGraph() : ExpressionGraph
var operandGraph := self.operand.map toActivityGraph();
operandGraph.addTo(result);
- var classifier := self.referent.toUml().oclAsType(Classifier);
- nodes += var action ::= new ReadIsClassifiedObjectAction(classifier, self.isDirect, self.booleanType().toType());
- edges += new ObjectFlow(operandGraph.resultSource, action._'object');
- resultSource := action.result;
+ if self.referent.isTemplateParameter() then {
+ // TODO: Implement classification check for template parameters.
+ nodes += var valueAction ::= new ValueSpecificationAction(self.literalBoolean(true));
+ resultSource := valueAction.result;
+ } else {
+ var classifier := self.referent.toUml().oclAsType(Classifier);
+ nodes += var action ::= new ReadIsClassifiedObjectAction(classifier, self.isDirect, self.typeBoolean());
+ edges += new ObjectFlow(operandGraph.resultSource, action._'object');
+ resultSource := action.result;
+ } endif;
}
// Equality Expressions
@@ -1702,7 +1766,7 @@ mapping EqualityExpression::toActivityGraph() : ExpressionGraph
helper EqualityExpression::mapOperator(inout graph : ExpressionGraph, operator : String,
operand1Result : ActivityNode, operand2Result : ActivityNode) {
- graph.nodes += var testAction ::= new TestIdentityAction("==", self.booleanType().toType());
+ graph.nodes += var testAction ::= new TestIdentityAction("==", self.typeBoolean());
graph.resultSource := testAction.result;
var operand1Lower := self.operand1.lower;
@@ -1925,7 +1989,7 @@ mapping AssignmentExpression::toActivityGraph() : ExpressionGraph
// Apply Bit String conversion to the right-hand side, if necessary.
self.mapConversions(rhsGraph, null, false,
- self.isIntegerType(rhs.type) and callAction.argument->at(2).type = self.bitStringType().toType());
+ self.isIntegerType(rhs.type) and callAction.argument->at(2).type = self.typeBitString());
rhsGraph.edges += new ObjectFlow(rhsGraph.resultSource, callAction.argument->at(2));
rhsGraph.resultSource := callAction.result->at(1);
@@ -1973,7 +2037,7 @@ helper SyntaxElement::mapPropertyAssignment(property_ : Property, objectSource :
var graph = object ExpressionGraph {};
var featuringClassifier := property_.featuringClassifier![true];
var isReplaceAll := property_.lower = 1 and property_.upper = 1 ;
- var unlimitedNaturalType = self.unlimitedNaturalType().toType();
+ var unlimitedNaturalType = self.typeUnlimitedNatural();
// Create a write action for the property.
graph.nodes += var writeAction ::= new AddStructuralFeatureValueAction(property_, isReplaceAll, unlimitedNaturalType);
@@ -2179,7 +2243,7 @@ helper LeftHandSide::mapFeatureLeftHandSide(inout graph : LhsGraph, objectSource
indexResultSource := indexConversionAction.result->at(1);
} endif;
- var unlimitedNaturalType := self.unlimitedNaturalType().toType();
+ var unlimitedNaturalType := self.typeUnlimitedNatural();
graph.nodes += var removeAction ::= new RemoveStructuralFeatureValueAction(property_, false, unlimitedNaturalType);
graph.edges += new ObjectFlow(objectResultSource, removeAction._'object');
if rhsUpper = 0 then {
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 9772b59c402..4007b1d89d1 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
@@ -884,7 +884,7 @@ mapping ForStatement::toActivityGraph() : StatementActivityGraph
loopNode.bodyOutput += callAction.result->at(1);
// Map the passing through of the upper bound value.
- bodyGraph.nodes += var passthruNode ::= createPassthruNode("upper", self.integerType().toType(), 1, 1);
+ bodyGraph.nodes += var passthruNode ::= createPassthruNode("upper", self.typeInteger(), 1, 1);
bodyGraph.edges += new ObjectFlow(upperFork, passthruNode.structuredNodeInput![true]);
loopNode.bodyOutput += passthruNode.structuredNodeOutput![true];
@@ -1095,7 +1095,7 @@ mapping AcceptBlock::toActivityGraph(parent : AcceptStatement, previousNode : Ac
} endif;
signalNames := signalNames + signal.name;
- nodes += var testAction ::= new ReadIsClassifiedObjectAction(signal, false, self.booleanType().toType());
+ nodes += var testAction ::= new ReadIsClassifiedObjectAction(signal, false, self.typeBoolean());
edges += new ObjectFlow(parent.signalSourceNode, testAction._'object');
var decisionGraph := createControlDecisionGraph(

Back to the top