Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-09-15 10:43:56 +0000
committerEd Willink2016-09-19 11:19:33 +0000
commit48c2bae33afd521db321d47d9348ee827fb0a744 (patch)
tree8474a8b9c6e540cab82a1a3fd33ee1e5e930cbdb
parentdc9a5fa67e4c2888c7c4858a8e6e89c63f06a9ac (diff)
downloadorg.eclipse.qvtd-48c2bae33afd521db321d47d9348ee827fb0a744.tar.gz
org.eclipse.qvtd-48c2bae33afd521db321d47d9348ee827fb0a744.tar.xz
org.eclipse.qvtd-48c2bae33afd521db321d47d9348ee827fb0a744.zip
[500369] Support merged Statements
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java638
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java4
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java31
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java20
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java32
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java237
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java87
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java30
-rw-r--r--plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java5
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java38
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java41
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java11
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java94
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/QVTimperativeDomainUsageAnalysis.java16
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java40
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/BottomPatternAttribution.java54
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/GuardPatternAttribution.java54
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java37
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java2
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeBottomPatternAttribution.java55
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeEnvironmentUtil.java39
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeGuardPatternAttribution.java53
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/SetStatementAttribution.java2
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/BasicQVTiExecutor.java143
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractTracingEvaluationVisitor.java468
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationEnvironment.java4
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java157
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java81
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java4
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiNestedEvaluationEnvironment.java31
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiRootEvaluationEnvironment.java30
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java58
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java4
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/AssignmentComparator.java115
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2MonikerVisitor.java22
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java27
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeASSaverNormalizeVisitor.java32
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeHelper.java81
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java174
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java137
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeUtil.java75
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/StatementComparator.java133
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/Assignment.gifbin255 -> 0 bytes
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/BottomPattern.gifbin211 -> 0 bytes
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/CheckVariableStatement.gif (renamed from plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/VariableAssignment.gif)bin338 -> 338 bytes
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/GuardPattern.gifbin154 -> 0 bytes
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/labeling/QVTimperativeLabelProvider.java79
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/outline/QVTimperativeOutlineTreeProvider.java44
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java342
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java149
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java208
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java123
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java191
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java22
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/ClassesCS2AS.qvti36
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug456900/ClassesCS2AS.qvti17
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2AS.qvti2
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2.qvti2
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2_AS.qvtias21
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug459225/ClassesCS2AS.qvti2
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Constructors/Constructors.qvti2
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Dependencies/Dependencies.qvti8
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Expressions/Expressions.qvti32
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti10
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.ref.qvtias133
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphMinimal/Graph2GraphMinimal.qvti4
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLS.qvti14
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLSas.qvtias162
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti199
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ManualUML2RDBMS/ManualUML2RDBMS.qvti263
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiInterpreterTests.java2
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti254
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti28
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java268
74 files changed, 2227 insertions, 3786 deletions
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
index 4edc27aae..22c592f72 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
@@ -13,9 +13,7 @@ package org.eclipse.qvtd.codegen.qvti.analyzer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
-import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
@@ -45,13 +43,10 @@ import org.eclipse.ocl.examples.codegen.cgmodel.CGValuedElement;
import org.eclipse.ocl.examples.codegen.cgmodel.CGVariable;
import org.eclipse.ocl.examples.codegen.cgmodel.CGVariableExp;
import org.eclipse.ocl.examples.codegen.generator.GenModelException;
-import org.eclipse.ocl.examples.codegen.java.JavaLocalContext;
import org.eclipse.ocl.pivot.CollectionType;
import org.eclipse.ocl.pivot.CompleteClass;
import org.eclipse.ocl.pivot.Element;
-import org.eclipse.ocl.pivot.Import;
import org.eclipse.ocl.pivot.Iteration;
-import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.OperationCallExp;
@@ -60,6 +55,7 @@ import org.eclipse.ocl.pivot.Parameter;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.Type;
import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.VariableExp;
import org.eclipse.ocl.pivot.ids.TypeId;
import org.eclipse.ocl.pivot.internal.complete.StandardLibraryInternal;
@@ -103,25 +99,24 @@ import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.analysis.QVTimperativeDomainUsageAnalysis;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiTransformationAnalysis;
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
@@ -129,16 +124,16 @@ import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisitor<CGNamedElement>
{
- public static class CGMappingCallBindingComparator implements Comparator<CGMappingCallBinding>
+ public static class CGMappingCallBindingComparator implements Comparator<@NonNull CGMappingCallBinding>
{
public static final @NonNull CGMappingCallBindingComparator INSTANCE = new CGMappingCallBindingComparator();
@Override
- public int compare(CGMappingCallBinding o1, CGMappingCallBinding o2) {
+ public int compare(@NonNull CGMappingCallBinding o1, @NonNull CGMappingCallBinding o2) {
MappingCallBinding b1 = (MappingCallBinding) o1.getAst();
MappingCallBinding b2 = (MappingCallBinding) o2.getAst();
- Variable v1 = b1 != null ? b1.getBoundVariable() : null;
- Variable v2 = b2 != null ? b2.getBoundVariable() : null;
+ VariableDeclaration v1 = b1 != null ? b1.getBoundVariable() : null;
+ VariableDeclaration v2 = b2 != null ? b2.getBoundVariable() : null;
String n1 = v1 != null ? v1.getName() : null;
String n2 = v2 != null ? v2.getName() : null;
if (n1 == null) n1 = "";
@@ -147,14 +142,14 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
}
- public static class CGVariableComparator implements Comparator<CGVariable>
+ public static class CGVariableComparator implements Comparator<@NonNull CGVariable>
{
public static final @NonNull CGVariableComparator INSTANCE = new CGVariableComparator();
@Override
- public int compare(CGVariable o1, CGVariable o2) {
- Variable v1 = (Variable) o1.getAst();
- Variable v2 = (Variable) o2.getAst();
+ public int compare(@NonNull CGVariable o1, @NonNull CGVariable o2) {
+ VariableDeclaration v1 = (VariableDeclaration) o1.getAst();
+ VariableDeclaration v2 = (VariableDeclaration) o2.getAst();
String n1 = v1 != null ? v1.getName() : null;
String n2 = v2 != null ? v2.getName() : null;
if (n1 == null) n1 = "";
@@ -171,11 +166,26 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
{
protected final @NonNull Mapping asMapping;
protected final @NonNull CGMapping cgMapping;
+ protected final @NonNull CGMappingExp cgMappingExp;
private @Nullable CGValuedElement cgLeafExp = null;
public PredicateTreeBuilder(@NonNull Mapping asMapping, @NonNull CGMapping cgMapping) {
this.asMapping = asMapping;
this.cgMapping = cgMapping;
+ this.cgMappingExp = QVTiCGModelFactory.eINSTANCE.createCGMappingExp();
+ setAst(cgMappingExp, asMapping);
+ TypeId pivotTypeId = TypeId.BOOLEAN; //pMapping.getTypeId();
+ cgMappingExp.setTypeId(analyzer.getTypeId(pivotTypeId));
+ }
+
+ public void addAccumulator(@NonNull CGAccumulator cgAccumulator) {
+ cgMappingExp.getOwnedAccumulators().add(cgAccumulator);
+ }
+
+ public void addRealizedVariable(@NonNull NewStatement asNewStatement) {
+ List<@NonNull CGValuedElement> cgRealizedVariables = ClassUtil.nullFree(cgMappingExp.getRealizedVariables());
+ CGRealizedVariable cgVariable = getRealizedVariable(asNewStatement);
+ cgRealizedVariables.add(cgVariable);
}
/**
@@ -187,7 +197,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
* This method supports building a nest of if/let expressions top-down, continually appending to the 'leaf' which is
* the then-expression of an if, or the in-expression of a let.
*/
- private void appendCheckedLetVariable(@NonNull Variable asVariable, @NonNull OCLExpression asInit) {
+ private void appendCheckedLetVariable(@NonNull VariableDeclaration asVariable, @NonNull OCLExpression asInit) {
Type sourceType = ClassUtil.nonNullState(asInit.getType());
Type targetType = ClassUtil.nonNullState(asVariable.getType());
boolean needsNullTest = !asInit.isIsRequired() && asVariable.isIsRequired();
@@ -307,181 +317,28 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
cgLeafExp = cgElement;
}
- public void doBottoms(@NonNull CGMappingExp cgMappingExp) {
- List<@NonNull BottomPattern> pBottomPatterns = new ArrayList<>();
- {
- BottomPattern pBottomPattern = asMapping.getBottomPattern();
- if (pBottomPattern != null) {
- pBottomPatterns.add(pBottomPattern);
- }
- for (@NonNull Domain pDomain : ClassUtil.nullFree(asMapping.getDomain())) {
- if (pDomain instanceof ImperativeDomain) {
- pBottomPattern = ((ImperativeDomain)pDomain).getBottomPattern();
- if (pBottomPattern != null) {
- pBottomPatterns.add(pBottomPattern);
- }
- }
- }
- }
- for (@NonNull BottomPattern pBottomPattern : pBottomPatterns) {
- for (@NonNull Variable asVariable : ClassUtil.nullFree(pBottomPattern.getVariable())) {
- OCLExpression asInit = asVariable.getOwnedInit();
- if (asVariable instanceof ConnectionVariable) {
- CGAccumulator cgAccumulator = CGModelFactory.eINSTANCE.createCGAccumulator();
- cgAccumulator.setAst(asVariable);
- cgAccumulator.setName(asVariable.getName());
- if (asInit != null) {
- CGValuedElement cgInit = doVisit(CGValuedElement.class, asInit);
- cgAccumulator.setTypeId(cgInit.getTypeId());
- cgAccumulator.setInit(cgInit);
- // cgAccumulator.setRequired(true);
- }
- else {
- cgAccumulator.setTypeId(analyzer.getTypeId(asVariable.getTypeId()));
- }
- cgAccumulator.setNonNull();
- cgMappingExp.getOwnedAccumulators().add(cgAccumulator);
- getVariablesStack().putVariable(asVariable, cgAccumulator);
- }
- else {
- if (asInit != null) {
- appendCheckedLetVariable(asVariable, asInit);
- }
- }
+ public void doBottoms() {
+ List<@NonNull CGGuardVariable> cgFreeVariables = new ArrayList<>();
+ for (@NonNull Domain pDomain : ClassUtil.nullFree(asMapping.getDomain())) {
+ for (@NonNull GuardVariable pGuardVariable : ClassUtil.nullFree(((ImperativeDomain)pDomain).getOwnedGuardVariables())) {
+ cgFreeVariables.add(getGuardVariable(pGuardVariable));
}
}
- for (@NonNull BottomPattern pBottomPattern : pBottomPatterns) {
- List<@NonNull Assignment> assignment = ClassUtil.nullFree(pBottomPattern.getAssignment());
- for (@NonNull Assignment pAssignment : assignment) {
- if (pAssignment instanceof VariableAssignment) {
- VariableAssignment asVariableAssignment = (VariableAssignment) pAssignment;
- Variable asVariable = asVariableAssignment.getTargetVariable();
- OCLExpression asInit = asVariableAssignment.getValue();
- assert (asVariable != null) && (asInit != null);
- appendCheckedLetVariable(asVariable, asInit);
- }
- }
+ for (@NonNull InConnectionVariable pGuardVariable : ClassUtil.nullFree(asMapping.getInoutVariables())) {
+ cgFreeVariables.add(getGuardVariable(pGuardVariable));
}
- for (@NonNull BottomPattern pBottomPattern : pBottomPatterns) {
- for (@NonNull Predicate asPredicate : ClassUtil.nullFree(pBottomPattern.getPredicate())) {
- appendSubTree(doVisit(CGValuedElement.class, asPredicate));
- }
- }
- List<@NonNull NewStatement> asNewStatements = new ArrayList<>();
+ Collections.sort(cgFreeVariables, NameUtil.NAMEABLE_COMPARATOR);
+ cgMapping.getFreeVariables().addAll(cgFreeVariables);
+ CGSequence cgSequence = QVTiCGModelFactory.eINSTANCE.createCGSequence();
+ List<CGValuedElement> cgMappingStatements = cgSequence.getStatements();
for (@NonNull Statement asStatement : ClassUtil.nullFree(asMapping.getOwnedStatements())) {
- if (asStatement instanceof NewStatement) {
- NewStatement asNewStatement = (NewStatement) asStatement;
- OCLExpression asInit = asNewStatement.getOwnedInit();
- if (asInit == null) {
- asNewStatements.add(asNewStatement);
- }
- else {
- appendCheckedLetVariable(asNewStatement, asInit);
- }
- }
- }
- Collections.sort(asNewStatements, NameUtil.NAMEABLE_COMPARATOR);
- List<@NonNull CGValuedElement> cgRealizedVariables = ClassUtil.nullFree(cgMappingExp.getRealizedVariables());
- for (@NonNull NewStatement asNewStatement : asNewStatements) {
- CGRealizedVariable cgVariable = getRealizedVariable(asNewStatement);
- cgRealizedVariables.add(cgVariable);
- }
- for (@NonNull BottomPattern pBottomPattern : pBottomPatterns) {
- List<@NonNull Assignment> assignment = ClassUtil.nullFree(pBottomPattern.getAssignment());
- for (@NonNull Assignment pAssignment : assignment) {
- assert pAssignment instanceof VariableAssignment;
+ CGNamedElement cgElement = asStatement.accept(QVTiAS2CGVisitor.this);
+ if (cgElement != null) { // FIXME some statements do a more complex appendSubTree
+ cgMappingStatements.add((CGValuedElement) cgElement);
}
}
appendSubTree(cgMappingExp);
- }
-
- public void doGuards() {
- List<@NonNull GuardPattern> guardPatterns = new ArrayList<@NonNull GuardPattern>();
- {
- GuardPattern pGuardPattern = asMapping.getGuardPattern();
- if (pGuardPattern != null) {
- guardPatterns.add(pGuardPattern);
- }
- for (@NonNull Domain pDomain : ClassUtil.nullFree(asMapping.getDomain())) {
- if (pDomain instanceof ImperativeDomain) {
- GuardPattern guardPattern = ((ImperativeDomain)pDomain).getGuardPattern();
- if (guardPattern != null) {
- guardPatterns.add(guardPattern);
- }
- }
- }
- }
- Set<@NonNull Variable> predicatedVariables = new HashSet<@NonNull Variable>();
- for (@NonNull GuardPattern pGuardPattern : guardPatterns) {
- for (Predicate predicate : pGuardPattern.getPredicate()) {
- if (predicate instanceof VariablePredicate) {
- Variable targetVariable = ((VariablePredicate)predicate).getTargetVariable();
- assert targetVariable != null;
- predicatedVariables.add(targetVariable);
- }
- };
- }
- List<@NonNull Variable> pGuardVariables = new ArrayList<@NonNull Variable>();
- for (@NonNull GuardPattern pGuardPattern : guardPatterns) {
- // pGuardPattern.getPredicate();
- for (@NonNull Variable pGuardVariable : ClassUtil.nullFree(pGuardPattern.getVariable())) {
- if (!predicatedVariables.contains(pGuardVariable)) {
- pGuardVariables.add(pGuardVariable);
- }
- }
- }
- Collections.sort(pGuardVariables, new Comparator<@NonNull NamedElement>()
- {
- @Override
- public int compare(@NonNull NamedElement o1, @NonNull NamedElement o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
- List<@NonNull CGGuardVariable> cgFreeVariables = new ArrayList<@NonNull CGGuardVariable>();
- // List<CGFinalVariable> cgBoundVariables = new ArrayList<CGFinalVariable>();
- for (@NonNull Variable pGuardVariable : pGuardVariables) {
- OCLExpression initExpression = pGuardVariable.getOwnedInit();
- if (initExpression == null) {
- CGGuardVariable cgUnboundVariable = getGuardVariable(pGuardVariable);
- cgFreeVariables.add(cgUnboundVariable);
- }
- else {
- CGFinalVariable cgBoundVariable = (CGFinalVariable) getVariable(pGuardVariable);
- CGValuedElement cgInit = doVisit(CGValuedElement.class, initExpression);
- cgBoundVariable.setInit(cgInit);
- JavaLocalContext<@NonNull ?> localContext = globalContext.getLocalContext(cgMapping);
- if (localContext != null) {
- // FIXME localContext.addLocalVariable(cgBoundVariable);
- }
- // cgBoundVariables.add(cgBoundVariable);
- }
- }
- Collections.sort(cgFreeVariables, new Comparator<@NonNull CGGuardVariable>()
- {
- @Override
- public int compare(@NonNull CGGuardVariable o1, @NonNull CGGuardVariable o2) {
- String n1 = o1.getName();
- String n2 = o2.getName();
- return n1.compareTo(n2);
- }
- });
- /* Collections.sort(cgBoundVariables, new Comparator<CGFinalVariable>()
- {
- @Override
- public int compare(CGFinalVariable o1, CGFinalVariable o2) {
- String n1 = o1.getName();
- String n2 = o2.getName();
- return n1.compareTo(n2);
- }
- }); */
- cgMapping.getFreeVariables().addAll(cgFreeVariables);
- // cgMappingExp.getBoundVariables().addAll(cgBoundVariables);
- // List<CGPredicate> cgGuardExpressions = cgMappingExp.getPredicates();
- for (@NonNull GuardPattern pGuardPattern : guardPatterns) {
- for (@NonNull Predicate asPredicate : ClassUtil.nullFree(pGuardPattern.getPredicate())) {
- appendSubTree(doVisit(CGValuedElement.class, asPredicate));
- }
- }
+ cgMappingExp.setBody(cgSequence);
}
@Override
@@ -493,6 +350,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
protected final @NonNull QVTiAnalyzer analyzer;
protected final @NonNull QVTiGlobalContext globalContext;
protected final @NonNull StandardLibraryInternal standardLibrary;
+ private @Nullable PredicateTreeBuilder bodyBuilder;
public QVTiAS2CGVisitor(@NonNull QVTiAnalyzer analyzer, @NonNull QVTiGlobalContext globalContext) {
super(analyzer);
@@ -552,7 +410,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
if (cgSource == null) { // FIXME workaround for BUG 481664
Transformation asTransformation = QVTbaseUtil.getContainingTransformation(asOperationCallExp);
if (asTransformation != null) {
- Variable asThis = QVTbaseUtil.getContextVariable(standardLibrary, asTransformation);
+ VariableDeclaration asThis = QVTbaseUtil.getContextVariable(standardLibrary, asTransformation);
VariableExp asThisExp = PivotUtil.createVariableExp(asThis);
cgSource = doVisit(CGValuedElement.class, asThisExp);
}
@@ -598,6 +456,11 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
}
+ private @NonNull PredicateTreeBuilder getBodyBuilder() {
+ assert bodyBuilder != null;
+ return bodyBuilder;
+ }
+
protected @Nullable EClassifier getEClassifier(@Nullable Type type) {
if (type == null) {
return null;
@@ -627,7 +490,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
return cgFunctionParameter;
}
- public @NonNull CGGuardVariable getGuardVariable(@NonNull Variable asVariable) {
+ public @NonNull CGGuardVariable getGuardVariable(@NonNull VariableDeclaration asVariable) {
CGGuardVariable cgGuardVariable = (CGGuardVariable) getVariablesStack().getParameter(asVariable);
assert cgGuardVariable == null;
boolean isConnectionVariable = asVariable instanceof ConnectionVariable;
@@ -671,14 +534,19 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
return cgVariable;
}
- protected @NonNull CGTypedModel getTypedModel(@NonNull Variable pVariable) {
- Area pArea = ClassUtil.nonNullState(QVTimperativeUtil.getContainingArea(pVariable));
+ protected @NonNull CGTypedModel getTypedModel(@NonNull VariableDeclaration pVariable) {
+ if (pVariable instanceof GuardVariable) {
+ TypedModel referredTypedModel = ClassUtil.nonNullState(((GuardVariable)pVariable).getReferredTypedModel());
+ return ClassUtil.nonNullState(analyzer.getTypedModel(referredTypedModel));
+ }
+ Domain pDomain = QVTimperativeUtil.getContainingDomain(pVariable);
TypedModel asTypedModel = null;
- if (pArea instanceof Domain) {
- asTypedModel = ClassUtil.nonNullState(((Domain)pArea).getTypedModel());
+ if (pDomain != null) {
+ asTypedModel = ClassUtil.nonNullState(pDomain.getTypedModel());
}
else {
- Transformation pTransformation = ((Mapping)pArea).getTransformation();
+ Transformation pTransformation = QVTimperativeUtil.getContainingTransformation(pVariable);
+ assert pTransformation != null;
asTypedModel = ClassUtil.nonNullState(pTransformation.getModelParameter(null));
}
return ClassUtil.nonNullState(analyzer.getTypedModel(asTypedModel));
@@ -686,7 +554,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
@Override
public @Nullable CGNamedElement visitAddStatement(@NonNull AddStatement asAddStatement) {
- Variable asVariable = asAddStatement.getTargetVariable();
+ ConnectionVariable asVariable = asAddStatement.getTargetVariable();
if (asVariable == null) {
return null;
}
@@ -703,33 +571,30 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitAssignment(@NonNull Assignment object) {
- return visiting(object);
- }
-
- @Override
public @Nullable CGNamedElement visitBaseModel(@NonNull BaseModel object) {
return visiting(object);
}
@Override
- public @Nullable CGNamedElement visitBottomPattern(@NonNull BottomPattern object) {
- return visiting(object);
- }
-
- @Override
- public @Nullable CGNamedElement visitBottomStatement(@NonNull BottomStatement object) {
- return visitStatement(object);
+ public @Nullable CGNamedElement visitCheckStatement(@NonNull CheckStatement asPredicate) {
+ CGIfExp cgPredicate = CGModelFactory.eINSTANCE.createCGIfExp();
+ cgPredicate.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
+ cgPredicate.setRequired(true);
+ OCLExpression asConditionExpression = asPredicate.getConditionExpression();
+ assert asConditionExpression != null;
+ cgPredicate.setCondition(doVisit(CGValuedElement.class, asConditionExpression));
+ CGConstantExp cgElse = analyzer.createCGConstantExp(asConditionExpression, analyzer.getBoolean(false));
+ setAst(cgElse, asConditionExpression);
+ cgElse.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
+ cgElse.setRequired(true);
+ cgPredicate.setElseExpression(cgElse);
+ getBodyBuilder().appendSubTree(cgPredicate);
+ return null;
}
@Override
- public @Nullable CGNamedElement visitConnectionVariable(@NonNull ConnectionVariable asConnectionVariable) {
- CGVariable cgVariable = getVariable(asConnectionVariable);
- CGValuedElement initValue = doVisit(CGValuedElement.class, asConnectionVariable.getOwnedInit());
- cgVariable.setInit(initValue);
- cgVariable.setTypeId(initValue.getTypeId());
- cgVariable.setRequired(initValue.isRequired());
- return cgVariable;
+ public @Nullable CGNamedElement visitConnectionVariable(@NonNull ConnectionVariable object) {
+ return visiting(object);
}
@Override
@@ -772,8 +637,9 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitGuardPattern(@NonNull GuardPattern object) {
+ public @Nullable CGNamedElement visitGuardVariable(@NonNull GuardVariable object) {
return visiting(object);
+ // return getVariable(asVariable);
}
@Override
@@ -787,13 +653,15 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitImperativePattern(@NonNull ImperativePattern object) {
- return visiting(object);
+ public @Nullable CGNamedElement visitInConnectionVariable(@NonNull InConnectionVariable object) {
+ return visiting(object); // Really should not be happening.
+ /* CGVariable cgVariable = getVariable(asConnectionVariable);
+ return cgVariable; */
}
@Override
- public @Nullable CGNamedElement visitImport(@NonNull Import object) {
- return visiting(object);
+ public @Nullable CGNamedElement visitLoopVariable(@NonNull LoopVariable asVariable) {
+ return visiting(asVariable);
}
@Override
@@ -802,36 +670,23 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
CGMapping cgMapping = QVTiCGModelFactory.eINSTANCE.createCGMapping();
setAst(cgMapping, pMapping);
analyzer.addMapping(pMapping, cgMapping);
- TypeId pivotTypeId = TypeId.BOOLEAN; //pMapping.getTypeId();
- CGMappingExp cgMappingExp = QVTiCGModelFactory.eINSTANCE.createCGMappingExp();
- setAst(cgMappingExp, pMapping);
- cgMappingExp.setTypeId(analyzer.getTypeId(pivotTypeId));
- PredicateTreeBuilder bodyBuilder = new PredicateTreeBuilder(pMapping, cgMapping);
- bodyBuilder.doGuards();
- bodyBuilder.doBottoms(cgMappingExp);
+ PredicateTreeBuilder bodyBuilder2 = bodyBuilder = new PredicateTreeBuilder(pMapping, cgMapping);
+ bodyBuilder2.doBottoms();
- CGSequence cgSequence = QVTiCGModelFactory.eINSTANCE.createCGSequence();
- List<CGValuedElement> cgMappingStatements = cgSequence.getStatements();
- for (Statement asStatement : pMapping.getOwnedStatements()) {
- if (!(asStatement instanceof NewStatement)) { // FIXME
- CGValuedElement cgMappingStatement = doVisit(CGValuedElement.class, asStatement);
- cgMappingStatements.add(cgMappingStatement);
- }
- }
- cgMappingExp.setBody(cgSequence);
- List<CGGuardVariable> cgFreeVariables = cgMapping.getFreeVariables();
- List<CGGuardVariable> sortedVariables = new ArrayList<CGGuardVariable>(cgFreeVariables);
+ List<@NonNull CGGuardVariable> cgFreeVariables = ClassUtil.nullFree(cgMapping.getFreeVariables());
+ List<@NonNull CGGuardVariable> sortedVariables = new ArrayList<>(cgFreeVariables);
Collections.sort(sortedVariables, CGVariableComparator.INSTANCE);
cgFreeVariables.clear();
cgFreeVariables.addAll(sortedVariables);
+ bodyBuilder = null;
return cgMapping;
}
@Override
- public @Nullable CGNamedElement visitMappingCall(@NonNull MappingCall asMappingCall) {
+ public CGNamedElement visitMappingCall(@NonNull MappingCall asMappingCall) {
CGMappingCall cgMappingCall = QVTiCGModelFactory.eINSTANCE.createCGMappingCall();
setAst(cgMappingCall, asMappingCall);
- List<CGMappingCallBinding> cgMappingCallBindings = new ArrayList<CGMappingCallBinding>();
+ List<@NonNull CGMappingCallBinding> cgMappingCallBindings = new ArrayList<>();
for (MappingCallBinding asMappingCallBinding : asMappingCall.getBinding()) {
CGMappingCallBinding cgMappingCallBinding = doVisit(CGMappingCallBinding.class, asMappingCallBinding);
cgMappingCallBindings.add(cgMappingCallBinding);
@@ -843,7 +698,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
@Override
public @Nullable CGNamedElement visitMappingCallBinding(@NonNull MappingCallBinding asMappingCallBinding) {
- Variable asBoundVariable = asMappingCallBinding.getBoundVariable();
+ VariableDeclaration asBoundVariable = asMappingCallBinding.getBoundVariable();
CGMappingCallBinding cgMappingCallBinding = QVTiCGModelFactory.eINSTANCE.createCGMappingCallBinding();
// setPivot(cgMappingCallBinding, asMappingCallBinding);
cgMappingCallBinding.setName(asBoundVariable.getName());
@@ -856,11 +711,11 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitMappingLoop(@NonNull MappingLoop asMappingLoop) {
+ public CGNamedElement visitMappingLoop(@NonNull MappingLoop asMappingLoop) {
CGMappingLoop cgMappingLoop = QVTiCGModelFactory.eINSTANCE.createCGMappingLoop();
- List<Variable> asIterators = asMappingLoop.getOwnedIterators();
+ List<LoopVariable> asIterators = asMappingLoop.getOwnedIterators();
if (asIterators.size() > 0) {
- Variable asIterator = asIterators.get(0);
+ LoopVariable asIterator = asIterators.get(0);
if (asIterator != null) {
CGIterator cgIterator = getIterator(asIterator);
cgIterator.setTypeId(analyzer.getTypeId(asIterator.getTypeId()));
@@ -889,15 +744,47 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitMappingStatement(@NonNull MappingStatement object) {
- return visitStatement(object);
+ public CGNamedElement visitMappingStatement(@NonNull MappingStatement object) {
+ return visiting(object);
}
@Override
- public @Nullable CGNamedElement visitNewStatement(@NonNull NewStatement object) {
- // CGExecutorType cgExecutorType = analyzer.createExecutorType(pTypeExp.getReferredType());
- // cgTypeExp.setExecutorType(cgExecutorType);
- return visiting(object);
+ public @Nullable CGNamedElement visitNewStatement(@NonNull NewStatement asNewStatement) {
+ OCLExpression asInit = asNewStatement.getOwnedInit();
+ if (asInit == null) {
+ getBodyBuilder().addRealizedVariable(asNewStatement);
+ }
+ else {
+ getBodyBuilder().appendCheckedLetVariable(asNewStatement, asInit);
+ }
+ return null;
+ }
+
+ @Override
+ public @Nullable CGNamedElement visitOutConnectionVariable(@NonNull OutConnectionVariable asVariable) {
+ /* CGVariable cgVariable = getVariable(asConnectionVariable);
+ CGValuedElement initValue = doVisit(CGValuedElement.class, asConnectionVariable.getOwnedInit());
+ cgVariable.setInit(initValue);
+ cgVariable.setTypeId(initValue.getTypeId());
+ cgVariable.setRequired(initValue.isRequired());
+ return cgVariable; */
+ OCLExpression asInit = asVariable.getOwnedInit();
+ CGAccumulator cgAccumulator = CGModelFactory.eINSTANCE.createCGAccumulator();
+ cgAccumulator.setAst(asVariable);
+ cgAccumulator.setName(asVariable.getName());
+ if (asInit != null) {
+ CGValuedElement cgInit = doVisit(CGValuedElement.class, asInit);
+ cgAccumulator.setTypeId(cgInit.getTypeId());
+ cgAccumulator.setInit(cgInit);
+ // cgAccumulator.setRequired(true);
+ }
+ else {
+ cgAccumulator.setTypeId(analyzer.getTypeId(asVariable.getTypeId()));
+ }
+ cgAccumulator.setNonNull();
+ getBodyBuilder().addAccumulator(cgAccumulator);
+ getVariablesStack().putVariable(asVariable, cgAccumulator);
+ return null;
}
@Override
@@ -906,42 +793,123 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGIfExp visitPredicate(@NonNull Predicate asPredicate) {
- CGIfExp cgPredicate = CGModelFactory.eINSTANCE.createCGIfExp();
- cgPredicate.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
- cgPredicate.setRequired(true);
- OCLExpression asConditionExpression = asPredicate.getConditionExpression();
- assert asConditionExpression != null;
- cgPredicate.setCondition(doVisit(CGValuedElement.class, asConditionExpression));
- CGConstantExp cgElse = analyzer.createCGConstantExp(asConditionExpression, analyzer.getBoolean(false));
- setAst(cgElse, asConditionExpression);
- cgElse.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
- cgElse.setRequired(true);
- cgPredicate.setElseExpression(cgElse);
- return cgPredicate;
+ public @Nullable CGNamedElement visitPredicate(@NonNull Predicate object) {
+ return visiting(object);
}
- /* @Override
- public @Nullable CGNamedElement visitMiddlePropertyAssignment(@NonNull MiddlePropertyAssignment asPropertyAssignment) {
-// Property asProperty = ClassUtil.nonNullModel(asPropertyAssignment.getTargetProperty());
- CGMiddlePropertyAssignment cgPropertyAssignment = QVTiCGModelFactory.eINSTANCE.createCGMiddlePropertyAssignment();
-// setPivot(cgPropertyAssignment, asPredicate);
- cgPropertyAssignment.setSlotValue(doVisit(CGValuedElement.class, asPropertyAssignment.getSlotExpression()));
- Property asProperty = asPropertyAssignment.getTargetProperty();
- cgPropertyAssignment.setReferredProperty(asProperty);
-// cgPredicate.setName(asPredicate.getName());
- cgPropertyAssignment.setTypeId(analyzer.getTypeId(TypeId.OCL_VOID));
-// cgMappingCallBinding.setValueName(localnameasMappingCallBinding.getBoundVariable().getName());
- cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asPropertyAssignment.getValue()));
- EStructuralFeature eStructuralFeature = (EStructuralFeature) asProperty.getESObject();
- if (eStructuralFeature != null) {
- try {
- genModelHelper.getGetAccessor(eStructuralFeature);
- cgPropertyAssignment.setEStructuralFeature(eStructuralFeature);
- } catch (GenModelException e) {
+ @Override
+ public CGNamedElement visitPredicateVariable(@NonNull PredicateVariable asVariable) {
+ if (!asVariable.isIsChecked()) {
+ /* CGVariable cgVariable = getVariable(asVariable);
+ CGValuedElement initValue = doVisit(CGValuedElement.class, asVariable.getOwnedInit());
+ cgVariable.setInit(initValue);
+ cgVariable.setTypeId(initValue.getTypeId());
+ cgVariable.setRequired(initValue.isRequired());
+ return cgVariable; */
+ OCLExpression asInit = asVariable.getOwnedInit();
+ if (asInit != null) {
+ getBodyBuilder().appendCheckedLetVariable(asVariable, asInit);
}
}
- return cgPropertyAssignment;
+ else {
+ // CGVariable cgVariable = getVariable(asVariable);
+ // CGValuedElement initValue = doVisit(CGValuedElement.class, asVariable.getOwnedInit());
+ // cgVariable.setInit(initValue);
+ // cgVariable.setTypeId(initValue.getTypeId());
+ // cgVariable.setRequired(initValue.isRequired());
+ // FIXME predicate
+ // return cgVariable;
+ // }
+ //
+ // @Override
+ // public @Nullable CGNamedElement visitVariablePredicate(@NonNull VariablePredicate asPredicate) {
+ OCLExpression asExpression = asVariable.getOwnedInit();
+ assert asExpression != null;
+ //
+ CGValuedElement cgExpression = doVisit(CGValuedElement.class, asExpression);
+ cgExpression.setName("temp1_" + asVariable.getName());
+ //
+ CGFinalVariable cgUncastVariable = CGModelFactory.eINSTANCE.createCGFinalVariable();
+ cgUncastVariable.setName("temp2_" + asVariable.getName());
+ cgUncastVariable.setInit(cgExpression);
+ cgUncastVariable.setTypeId(cgExpression.getTypeId());
+ cgUncastVariable.setRequired(cgExpression.isRequired());
+ //
+ CGLetExp cgOuterLetExp = CGModelFactory.eINSTANCE.createCGLetExp();
+ setAst(cgOuterLetExp, asVariable);
+ cgOuterLetExp.setInit(cgUncastVariable);
+ cgOuterLetExp.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
+ cgOuterLetExp.setRequired(true);
+ //
+ CGIfExp cgPredicate = CGModelFactory.eINSTANCE.createCGIfExp();
+ cgPredicate.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
+ cgPredicate.setRequired(true);
+ CGConstantExp cgElse = analyzer.createCGConstantExp(asExpression, analyzer.getBoolean(false));
+ setAst(cgElse, asVariable);
+ cgElse.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
+ cgElse.setRequired(true);
+ cgPredicate.setElseExpression(cgElse);
+ CGIsKindOfExp cgIsKindOfExp = CGModelFactory.eINSTANCE.createCGIsKindOfExp();
+ cgIsKindOfExp.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
+ cgIsKindOfExp.setRequired(true);
+ CGVariableExp cgUncastVariableExp1 = CGModelFactory.eINSTANCE.createCGVariableExp();
+ setAst(cgUncastVariableExp1, asVariable);
+ cgUncastVariableExp1.setReferredVariable(cgUncastVariable);
+ cgUncastVariableExp1.setTypeId(cgUncastVariable.getTypeId());
+ cgUncastVariableExp1.setRequired(cgUncastVariable.isRequired());
+ cgIsKindOfExp.setSource(cgUncastVariableExp1);
+
+ CGExecutorType cgExecutorType = analyzer.createExecutorType(ClassUtil.nonNullState(asVariable.getType()));
+ cgIsKindOfExp.setExecutorType(cgExecutorType);
+ cgPredicate.setCondition(cgIsKindOfExp);
+ cgOuterLetExp.setIn(cgPredicate);
+
+ CGVariableExp cgUncastVariableExp2 = CGModelFactory.eINSTANCE.createCGVariableExp();
+ setAst(cgUncastVariableExp2, asVariable);
+ cgUncastVariableExp2.setReferredVariable(cgUncastVariable);
+ cgUncastVariableExp2.setTypeId(cgUncastVariable.getTypeId());
+ cgUncastVariableExp2.setRequired(cgUncastVariable.isRequired());
+ CGCastExp cgCastExp = CGModelFactory.eINSTANCE.createCGCastExp();
+ cgCastExp.setSource(cgUncastVariableExp2);
+ cgCastExp.setExecutorType(cgExecutorType);
+ TypeId asTypeId = cgExecutorType.getASTypeId();
+ assert asTypeId != null;
+ cgCastExp.setTypeId(analyzer.getTypeId(asTypeId));
+
+ CGFinalVariable cgCastVariable = (CGFinalVariable) createCGVariable(asVariable); // FIXME Lose cast
+ cgCastVariable.setInit(cgCastExp);
+
+ CGLetExp cgCastLetExp = CGModelFactory.eINSTANCE.createCGLetExp();
+ setAst(cgCastLetExp, asVariable);
+ cgCastLetExp.setInit(cgCastVariable);
+ cgCastLetExp.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
+ cgCastLetExp.setRequired(true);
+
+ cgPredicate.setThenExpression(cgCastLetExp);
+ getBodyBuilder().appendSubTree(cgCastLetExp);
+ }
+ return null;
+ }
+
+ /* @Override
+ public @Nullable CGNamedElement visitCheckVariableStatement(@NonNull CheckVariableStatement asCheckVariableStatement) {
+ /* VariableDeclaration asVariable = asCheckVariableStatement.getTargetVariable();
+ if (asVariable == null) {
+ return null;
+ }
+ CGVariable cgVariable = getVariable(asVariable);
+ OCLExpression asInitValue = asCheckVariableStatement.getOwnedInit();
+ assert !(cgVariable instanceof CGConnectionVariable);
+ CGValuedElement initValue = doVisit(CGValuedElement.class, asInitValue);
+ cgVariable.setInit(initValue);
+ cgVariable.setTypeId(initValue.getTypeId());
+ cgVariable.setRequired(initValue.isRequired());
+ return cgVariable; * /
+ VariableDeclaration asVariable = asCheckVariableStatement.getTargetVariable();
+ OCLExpression asInit = asCheckVariableStatement.getOwnedInit();
+ assert (asVariable != null) && (asInit != null);
+ getBodyBuilder().appendCheckedLetVariable(asVariable, asInit);
+ return null;
} */
@Override
@@ -958,7 +926,10 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
// Property asProperty = ClassUtil.nonNullModel(asPropertyAssignment.getTargetProperty());
CGMiddlePropertyAssignment cgPropertyAssignment = QVTiCGModelFactory.eINSTANCE.createCGMiddlePropertyAssignment();
setAst(cgPropertyAssignment, asSetStatement);
- cgPropertyAssignment.setSlotValue(doVisit(CGValuedElement.class, asSetStatement.getSlotExpression()));
+ VariableDeclaration asVariable = asSetStatement.getTargetVariable();
+ assert asVariable != null;
+ CGVariable cgVariable = getVariable(asVariable);
+ cgPropertyAssignment.setSlotValue(analyzer.createCGVariableExp(cgVariable));
Property asProperty = QVTimperativeUtil.getTargetProperty(asSetStatement);
cgPropertyAssignment.setReferredProperty(asProperty);
// cgPredicate.setName(asPredicate.getName());
@@ -1012,7 +983,10 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
cgPropertyAssignment = QVTiCGModelFactory.eINSTANCE.createCGPropertyAssignment();
}
setAst(cgPropertyAssignment, asSetStatement);
- cgPropertyAssignment.setSlotValue(doVisit(CGValuedElement.class, asSetStatement.getSlotExpression()));
+ VariableDeclaration asVariable = asSetStatement.getTargetVariable();
+ assert asVariable != null;
+ CGVariable cgVariable = getVariable(asVariable);
+ cgPropertyAssignment.setSlotValue(analyzer.createCGVariableExp(cgVariable));
cgPropertyAssignment.setReferredProperty(asTargetProperty);
// cgPredicate.setName(asPredicate.getName());
cgPropertyAssignment.setTypeId(analyzer.getTypeId(TypeId.OCL_VOID));
@@ -1026,7 +1000,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitStatement(@NonNull Statement object) {
+ public CGNamedElement visitStatement(@NonNull Statement object) {
return visiting(object);
}
@@ -1063,97 +1037,23 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitVariable(@NonNull Variable asVariable) {
- CGVariable cgVariable = getVariable(asVariable);
+ public @Nullable CGNamedElement visitVariable(@NonNull Variable object) {
+ return visiting(object); // Really should not be happening.
+ /* CGVariable cgVariable = getVariable(asVariable);
CGValuedElement initValue = doVisit(CGValuedElement.class, asVariable.getOwnedInit());
cgVariable.setInit(initValue);
cgVariable.setTypeId(initValue.getTypeId());
cgVariable.setRequired(initValue.isRequired());
- return cgVariable;
+ return cgVariable; */
}
@Override
- public @Nullable CGNamedElement visitVariableAssignment(@NonNull VariableAssignment asVariableAssignment) {
- Variable asVariable = asVariableAssignment.getTargetVariable();
- if (asVariable == null) {
- return null;
- }
- CGVariable cgVariable = getVariable(asVariable);
- OCLExpression asInitValue = asVariableAssignment.getValue();
- assert !(cgVariable instanceof CGConnectionVariable);
- CGValuedElement initValue = doVisit(CGValuedElement.class, asInitValue);
- cgVariable.setInit(initValue);
- cgVariable.setTypeId(initValue.getTypeId());
- cgVariable.setRequired(initValue.isRequired());
- return cgVariable;
+ public @Nullable CGNamedElement visitVariableDeclaration(@NonNull VariableDeclaration object) {
+ return visiting(object); // Really should not be happening.
}
@Override
- public @Nullable CGNamedElement visitVariablePredicate(@NonNull VariablePredicate asPredicate) {
- OCLExpression asExpression = asPredicate.getConditionExpression();
- assert asExpression != null;
- Variable asVariable = asPredicate.getTargetVariable();
- //
- CGValuedElement cgExpression = doVisit(CGValuedElement.class, asExpression);
- cgExpression.setName("temp1_" + asVariable.getName());
- //
- CGFinalVariable cgUncastVariable = CGModelFactory.eINSTANCE.createCGFinalVariable();
- cgUncastVariable.setName("temp2_" + asVariable.getName());
- cgUncastVariable.setInit(cgExpression);
- cgUncastVariable.setTypeId(cgExpression.getTypeId());
- cgUncastVariable.setRequired(cgExpression.isRequired());
- //
- CGLetExp cgOuterLetExp = CGModelFactory.eINSTANCE.createCGLetExp();
- setAst(cgOuterLetExp, asPredicate);
- cgOuterLetExp.setInit(cgUncastVariable);
- cgOuterLetExp.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
- cgOuterLetExp.setRequired(true);
- //
- CGIfExp cgPredicate = CGModelFactory.eINSTANCE.createCGIfExp();
- cgPredicate.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
- cgPredicate.setRequired(true);
- CGConstantExp cgElse = analyzer.createCGConstantExp(asExpression, analyzer.getBoolean(false));
- setAst(cgElse, asPredicate);
- cgElse.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
- cgElse.setRequired(true);
- cgPredicate.setElseExpression(cgElse);
- CGIsKindOfExp cgIsKindOfExp = CGModelFactory.eINSTANCE.createCGIsKindOfExp();
- cgIsKindOfExp.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
- cgIsKindOfExp.setRequired(true);
- CGVariableExp cgUncastVariableExp1 = CGModelFactory.eINSTANCE.createCGVariableExp();
- setAst(cgUncastVariableExp1, asVariable);
- cgUncastVariableExp1.setReferredVariable(cgUncastVariable);
- cgUncastVariableExp1.setTypeId(cgUncastVariable.getTypeId());
- cgUncastVariableExp1.setRequired(cgUncastVariable.isRequired());
- cgIsKindOfExp.setSource(cgUncastVariableExp1);
-
- CGExecutorType cgExecutorType = analyzer.createExecutorType(ClassUtil.nonNullState(asVariable.getType()));
- cgIsKindOfExp.setExecutorType(cgExecutorType);
- cgPredicate.setCondition(cgIsKindOfExp);
- cgOuterLetExp.setIn(cgPredicate);
-
- CGVariableExp cgUncastVariableExp2 = CGModelFactory.eINSTANCE.createCGVariableExp();
- setAst(cgUncastVariableExp2, asVariable);
- cgUncastVariableExp2.setReferredVariable(cgUncastVariable);
- cgUncastVariableExp2.setTypeId(cgUncastVariable.getTypeId());
- cgUncastVariableExp2.setRequired(cgUncastVariable.isRequired());
- CGCastExp cgCastExp = CGModelFactory.eINSTANCE.createCGCastExp();
- cgCastExp.setSource(cgUncastVariableExp2);
- cgCastExp.setExecutorType(cgExecutorType);
- TypeId asTypeId = cgExecutorType.getASTypeId();
- assert asTypeId != null;
- cgCastExp.setTypeId(analyzer.getTypeId(asTypeId));
-
- CGFinalVariable cgCastVariable = (CGFinalVariable) createCGVariable(asVariable); // FIXME Lose cast
- cgCastVariable.setInit(cgCastExp);
-
- CGLetExp cgCastLetExp = CGModelFactory.eINSTANCE.createCGLetExp();
- setAst(cgCastLetExp, asPredicate);
- cgCastLetExp.setInit(cgCastVariable);
- cgCastLetExp.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
- cgCastLetExp.setRequired(true);
-
- cgPredicate.setThenExpression(cgCastLetExp);
- return cgCastLetExp;
+ public @Nullable CGNamedElement visitVariableStatement(@NonNull VariableStatement object) {
+ return visiting(object);
}
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java
index ba409dde4..d96300930 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java
@@ -20,7 +20,7 @@ import org.eclipse.ocl.examples.codegen.cgmodel.CGVariableExp;
import org.eclipse.ocl.examples.codegen.generator.TypeDescriptor;
import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.TypedElement;
-import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
import org.eclipse.qvtd.codegen.qvticgmodel.CGEcoreContainerAssignment;
@@ -142,7 +142,7 @@ public class QVTiBoxingAnalyzer extends BoxingAnalyzer implements QVTiCGModelVis
@Override
public Object visitCGMappingCallBinding(@NonNull CGMappingCallBinding cgMappingCallBinding) {
MappingCallBinding mappingCallBinding = (MappingCallBinding)cgMappingCallBinding.getAst();
- Variable boundVariable = mappingCallBinding.getBoundVariable();
+ VariableDeclaration boundVariable = mappingCallBinding.getBoundVariable();
assert boundVariable != null;
if (boundVariable instanceof ConnectionVariable) {
//
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
index 96cf4d679..9e204661b 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
@@ -57,7 +57,7 @@ import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.SetType;
import org.eclipse.ocl.pivot.ShadowExp;
import org.eclipse.ocl.pivot.ShadowPart;
-import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.evaluation.Executor;
import org.eclipse.ocl.pivot.ids.ClassId;
import org.eclipse.ocl.pivot.ids.CollectionTypeId;
@@ -99,8 +99,8 @@ import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
@@ -123,7 +123,7 @@ import com.google.common.collect.Iterables;
/**
* A QVTiCG2JavaVisitor supports generation of Java code from an optimized QVTi CG transformation tree.
*/
-public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerator> implements QVTiCGModelVisitor<Boolean>
+public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerator> implements QVTiCGModelVisitor<@NonNull Boolean>
{
/**
* The run-time API version.
@@ -320,13 +320,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
CGValuedElement cgSlot = getExpression(cgPropertyAssignment.getSlotValue());
CGValuedElement cgInit = getExpression(cgPropertyAssignment.getInitValue());
EPackage ePackage = ClassUtil.nonNullModel(eStructuralFeature.getEContainingClass().getEPackage());
- boolean isHazardous = false;
- Element asSetStatement = cgPropertyAssignment.getAst();
- Mapping asMapping = QVTimperativeUtil.getContainingMapping(asSetStatement);
- if ((asMapping != null) && (asSetStatement instanceof SetStatement)) {
- isHazardous = transformationAnalysis.isHazardousWrite(asMapping, (SetStatement)asSetStatement);
- }
- if (isHazardous || isIncremental) {
+ if (isIncremental || ((SetStatement)cgPropertyAssignment.getAst()).isIsEmit()) {
js.append("objectManager.assigned(");
if (isIncremental) {
js.append("this, ");
@@ -347,13 +341,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
CGValuedElement cgSlot = getExpression(cgPropertyAssignment.getSlotValue());
CGValuedElement cgInit = getExpression(cgPropertyAssignment.getInitValue());
EPackage ePackage = ClassUtil.nonNullModel(eStructuralFeature.getEContainingClass().getEPackage());
- boolean isHazardous = false;
- Element asSetStatement = cgPropertyAssignment.getAst();
- Mapping asMapping = QVTimperativeUtil.getContainingMapping(asSetStatement);
- if ((asMapping != null) && (asSetStatement instanceof SetStatement)) {
- isHazardous = transformationAnalysis.isHazardousWrite(asMapping, (SetStatement)asSetStatement);
- }
- if (isHazardous || isIncremental) {
+ if (isIncremental || ((SetStatement)cgPropertyAssignment.getAst()).isIsEmit()) {
js.append("objectManager.assigned(");
if (isIncremental) {
js.append("this, ");
@@ -864,7 +852,6 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
String savedLocalPrefix = localPrefix;
try {
localPrefix = hasMappingClass ? cgMapping.getTransformation().getName() : localPrefix;
- js.append("// predicates and unrealized variables\n");
if (!cgBody.isInlined()) {
cgBody.accept(this);
}
@@ -1129,7 +1116,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
protected @Nullable TypeDescriptor needsTypeCheck(@NonNull CGMappingCallBinding cgMappingCallBinding) {
MappingCallBinding mappingCallBinding = (MappingCallBinding)cgMappingCallBinding.getAst();
- Variable boundVariable = mappingCallBinding.getBoundVariable();
+ VariableDeclaration boundVariable = mappingCallBinding.getBoundVariable();
assert boundVariable != null;
if (boundVariable instanceof ConnectionVariable) {
return null;
@@ -1175,7 +1162,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
isHazardous = true;
}
for (Domain domain : asMapping.getDomain()) {
- if ((domain instanceof Area) && (((Area)domain).getCheckedProperties().size() > 0)) {
+ if (((ImperativeDomain)domain).getCheckedProperties().size() > 0) {
isHazardous = true;
break;
}
@@ -1791,7 +1778,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
}
}
List<@NonNull CGPropertyAssignment> cgPropertyAssignments = ClassUtil.nullFree(cgMappingExp.getAssignments());
- if (cgPropertyAssignments.size()> 0) {
+ if (cgPropertyAssignments.size() > 0) {
js.append("// property assignments\n");
for (@NonNull CGPropertyAssignment cgAssignment : cgPropertyAssignments) {
cgAssignment.accept(this);
@@ -1955,7 +1942,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
}
@Override
- public @Nullable Boolean visitCGSequence(@NonNull CGSequence cgSequence) {
+ public @NonNull Boolean visitCGSequence(@NonNull CGSequence cgSequence) {
for (@NonNull CGValuedElement cgStatement : ClassUtil.nullFree(cgSequence.getStatements())) {
cgStatement.accept(this);
}
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java
index a0dab8210..4c3fef17c 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java
@@ -31,6 +31,7 @@ import org.eclipse.ocl.pivot.Type;
import org.eclipse.ocl.pivot.TypeExp;
import org.eclipse.ocl.pivot.TypedElement;
import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.VariableExp;
import org.eclipse.ocl.pivot.ids.IdManager;
import org.eclipse.ocl.pivot.ids.IdResolver;
@@ -47,6 +48,7 @@ import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Region;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.SchedulerConstants;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
@@ -78,7 +80,7 @@ public abstract class AbstractRegion2Mapping
/**
* The QVTi variable for each connection.
*/
- protected Map<@NonNull NodeConnection, @NonNull Variable> connection2variable = null;
+ protected Map<@NonNull NodeConnection, @NonNull ConnectionVariable> connection2variable = null;
public AbstractRegion2Mapping(@NonNull QVTs2QVTiVisitor visitor, @NonNull Region region) {
this.visitor = visitor;
@@ -118,21 +120,21 @@ public abstract class AbstractRegion2Mapping
return PivotUtil.createNavigationCallExp(asSource, asProperty);
}
- protected @NonNull ConnectionVariable createConnectionVariable(@NonNull NodeConnection connection) {
+ protected @NonNull InConnectionVariable createInConnectionVariable(@NonNull NodeConnection connection) {
Type asType = getConnectionSourcesType(connection);
String name = connection.getName();
assert name != null;
- return helper.createConnectionVariable(getSafeName(name), asType, null);
+ return helper.createInConnectionVariable(getSafeName(name), asType, true);
}
protected void createConnectionGuardVariables() {
List<@NonNull NodeConnection> intermediateConnections = region.getIntermediateConnections();
if (intermediateConnections.size() > 0) {
- connection2variable = new HashMap<@NonNull NodeConnection, @NonNull Variable>();
+ connection2variable = new HashMap<>();
for (@NonNull NodeConnection connection : intermediateConnections) {
- ConnectionVariable connectionVariable = createConnectionVariable(connection);
+ InConnectionVariable connectionVariable = createInConnectionVariable(connection);
connection2variable.put(connection, connectionVariable);
- mapping.getGuardPattern().getVariable().add(connectionVariable);
+ mapping.getInoutVariables().add(connectionVariable);
}
}
}
@@ -243,9 +245,9 @@ public abstract class AbstractRegion2Mapping
return asType;
}
- public @NonNull Variable getConnectionVariable(@NonNull NodeConnection connection) {
+ public @NonNull ConnectionVariable getConnectionVariable(@NonNull NodeConnection connection) {
assert connection2variable != null;
- Variable connectionVariable = connection2variable.get(connection);
+ ConnectionVariable connectionVariable = connection2variable.get(connection);
assert connectionVariable != null;
return connectionVariable;
}
@@ -256,7 +258,7 @@ public abstract class AbstractRegion2Mapping
public abstract @NonNull List<@NonNull Node> getGuardNodes();
- public abstract @NonNull Variable getGuardVariable(@NonNull Node node);
+ public abstract @NonNull VariableDeclaration getGuardVariable(@NonNull Node node);
/* private @Nullable OCLExpression getInitExpression(@NonNull Node node) {
List<Edge> incomingEdges = node.getIncomingEdges();
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java
index 4149b4f2f..547ab246c 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java
@@ -21,11 +21,13 @@ import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.CollectionType;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Node;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.NodeConnection;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Region;
+import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
@@ -35,18 +37,18 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
{
protected AbstractScheduledRegion2Mapping(@NonNull QVTs2QVTiVisitor visitor, @NonNull Region region) {
super(visitor, region);
- connection2variable = new HashMap<@NonNull NodeConnection, @NonNull Variable>();
+ connection2variable = new HashMap<>();
}
- protected @NonNull MappingStatement createCall(@NonNull Region calledRegion, @Nullable Map<@NonNull Variable, @NonNull OCLExpression> guardVariable2expression) {
+ protected @NonNull MappingStatement createCall(@NonNull Region calledRegion, @Nullable Map<@NonNull VariableDeclaration, @NonNull OCLExpression> guardVariable2expression) {
// Iterable<Connection> connectionRegions = getConnectionRegions(calledRegion);
// assert !calledRegion.isConnectionRegion();
AbstractRegion2Mapping calledRegion2Mapping = visitor.getRegion2Mapping(calledRegion);
Mapping calledMapping = calledRegion2Mapping.getMapping();
- Map<@NonNull Variable, @NonNull OCLExpression> loopVariables = new HashMap<@NonNull Variable, @NonNull OCLExpression>();
- List<@NonNull MappingCallBinding> mappingCallBindings = new ArrayList<@NonNull MappingCallBinding>();
+ Map<@NonNull LoopVariable, @NonNull OCLExpression> loopVariables = new HashMap<>();
+ List<@NonNull MappingCallBinding> mappingCallBindings = new ArrayList<>();
for (@NonNull Node calledGuardNode : calledRegion2Mapping.getGuardNodes()) {
- Variable guardVariable = calledRegion2Mapping.getGuardVariable(calledGuardNode);
+ VariableDeclaration guardVariable = calledRegion2Mapping.getGuardVariable(calledGuardNode);
NodeConnection callingConnection = calledGuardNode.getIncomingPassedConnection();
if (callingConnection != null) {
OCLExpression connectionExpression = null;
@@ -54,7 +56,7 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
connectionExpression = guardVariable2expression.get(guardVariable);
}
if (connectionExpression == null) {
- Variable connectionVariable = connection2variable.get(callingConnection);
+ ConnectionVariable connectionVariable = connection2variable.get(callingConnection);
if (connectionVariable != null) {
connectionExpression = PivotUtil.createVariableExp(connectionVariable);
}
@@ -83,13 +85,13 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
mappingCallBindings.add(QVTimperativeUtil.createMappingCallBinding(calledConnectionVariable, sourceExpression));
} */
for (@NonNull NodeConnection intermediateConnection : calledRegion.getIntermediateConnections()) {
- Variable calledConnectionVariable = calledRegion2Mapping.getConnectionVariable(intermediateConnection);
+ ConnectionVariable calledConnectionVariable = calledRegion2Mapping.getConnectionVariable(intermediateConnection);
OCLExpression connectionExpression = null;
if (guardVariable2expression != null) {
connectionExpression = guardVariable2expression.get(calledConnectionVariable);
}
if (connectionExpression == null) {
- Variable callingConnectionVariable = connection2variable.get(intermediateConnection);
+ ConnectionVariable callingConnectionVariable = connection2variable.get(intermediateConnection);
assert callingConnectionVariable != null;
OCLExpression sourceExpression = PivotUtil.createVariableExp(callingConnectionVariable);
Type calledType = calledConnectionVariable.getType();
@@ -97,7 +99,7 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
assert calledType != null;
assert callingType != null;
if (getCollectionDepth(calledType) < getCollectionDepth(callingType)) {
- Variable loopVariable = PivotUtil.createVariable("loop" + loopVariables.size(), calledType, true, sourceExpression);
+ LoopVariable loopVariable = helper.createLoopVariable("loop" + loopVariables.size(), calledType);//, true, sourceExpression);
loopVariables.put(loopVariable, sourceExpression);
sourceExpression = PivotUtil.createVariableExp(loopVariable);
}
@@ -107,8 +109,8 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
}
Collections.sort(mappingCallBindings, QVTimperativeUtil.MappingCallBindingComparator.INSTANCE);
MappingStatement mappingCallStatement = calledRegion2Mapping.createMappingCall(mappingCallBindings);
- for (Map./*@NonNull*/Entry<@NonNull Variable, @NonNull OCLExpression> loopEntry : loopVariables.entrySet()) {
- @NonNull Variable loopVariable = loopEntry.getKey();
+ for (Map./*@NonNull*/Entry<@NonNull LoopVariable, @NonNull OCLExpression> loopEntry : loopVariables.entrySet()) {
+ @NonNull LoopVariable loopVariable = loopEntry.getKey();
@NonNull OCLExpression loopSource = loopEntry.getValue();
mappingCallStatement = QVTimperativeUtil.createMappingLoop(loopSource, loopVariable, mappingCallStatement);
}
@@ -176,17 +178,17 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
} */
private @NonNull MappingCallBinding createMappingCallBinding(@NonNull OCLExpression sourceExpression, @NonNull Node targetNode,
- @NonNull Map<@NonNull Variable, @NonNull OCLExpression> loopVariables) {
+ @NonNull Map<@NonNull LoopVariable, @NonNull OCLExpression> loopVariables) {
Type type = sourceExpression.getType();
if (type instanceof CollectionType) {
Type elementType = ((CollectionType)type).getElementType();
assert elementType != null;
- Variable loopVariable = PivotUtil.createVariable("loop" + loopVariables.size(), elementType, true, sourceExpression);
+ LoopVariable loopVariable = helper.createLoopVariable("loop" + loopVariables.size(), elementType);//, true, sourceExpression);
loopVariables.put(loopVariable, sourceExpression);
sourceExpression = PivotUtil.createVariableExp(loopVariable);
}
AbstractRegion2Mapping calledRegion2Mapping = visitor.getRegion2Mapping(targetNode.getRegion());
- Variable guardVariable = calledRegion2Mapping.getGuardVariable(targetNode);
+ VariableDeclaration guardVariable = calledRegion2Mapping.getGuardVariable(targetNode);
return QVTimperativeUtil.createMappingCallBinding(guardVariable, sourceExpression);
}
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java
index d7be00a8a..63102ad87 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java
@@ -78,26 +78,26 @@ import org.eclipse.qvtd.compiler.internal.qvtp2qvts.RegionUtil;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.SchedulerConstants;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Function;
-import org.eclipse.qvtd.pivot.qvtbase.Predicate;
-import org.eclipse.qvtd.pivot.qvtbase.QVTbaseFactory;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
+import org.eclipse.qvtd.pivot.qvtimperative.Statement;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.util.AbstractExtendingQVTimperativeVisitor;
-import org.eclipse.qvtd.pivot.qvtimperative.utilities.AssignmentComparator;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
+import org.eclipse.qvtd.pivot.qvtimperative.utilities.StatementComparator;
import com.google.common.collect.Iterables;
@@ -167,7 +167,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
if (node.isExplicitNull()) {
return helper.createNullLiteralExp();
}
- Variable theVariable = node2variable.get(node);
+ VariableDeclaration theVariable = node2variable.get(node);
if (theVariable == null) {
TypedElement oldTypedElement = node.getTypedElements().iterator().next();
assert oldTypedElement != null;
@@ -243,21 +243,11 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
return newVariable;
}
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + region;
- }
-
- @Override
- public @NonNull OCLExpression visiting(@NonNull Visitable visitable) {
- throw new UnsupportedOperationException(getClass().getSimpleName() + ": " + visitable.getClass().getSimpleName());
- }
-
public @Nullable OCLExpression getExpression(@NonNull Node node) {
if (node.isExplicitNull()) {
return helper.createNullLiteralExp();
}
- Variable variable = node2variable.get(node);
+ VariableDeclaration variable = node2variable.get(node);
if (variable != null) {
return PivotUtil.createVariableExp(variable);
}
@@ -277,7 +267,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
if (clonedElement instanceof VariableExp) {
VariableDeclaration referredVariable = ((VariableExp)clonedElement).getReferredVariable();
if (referredVariable instanceof Variable) {
- node2variable.put(node, (Variable) referredVariable);
+ node2variable.put(node, referredVariable);
}
}
return clonedElement;
@@ -318,6 +308,18 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
return false;
}
+ @Override
+ public String toString() {
+ return getClass().getSimpleName() + " " + region;
+ }
+
+ @Override
+ public @NonNull OCLExpression visiting(@NonNull Visitable visitable) {
+ throw new UnsupportedOperationException(getClass().getSimpleName() + ": " + visitable.getClass().getSimpleName());
+ }
+
+
+
// public boolean isConditional(@NonNull Node node) {
// return conditionalNodes.contains(node);
// }
@@ -405,7 +407,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
if ((iSource == null) && (referredOperation instanceof Function)) {
SchedulerConstants scheduler = getRegion().getMultiRegion().getSchedulerConstants();
StandardLibrary standardLibrary = scheduler.getStandardLibrary();
- Variable thisVariable = QVTbaseUtil.getContextVariable(standardLibrary, visitor.getTransformation());
+ VariableDeclaration thisVariable = QVTbaseUtil.getContextVariable(standardLibrary, visitor.getTransformation());
iSource = PivotUtil.createVariableExp(thisVariable);
}
return helper.createOperationCallExp(iSource, referredOperation, iArguments);
@@ -490,25 +492,23 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
if (pTransformation != null) {
Variable pThisVariable = QVTbaseUtil.getContextVariable(standardLibrary, pTransformation);
if (pVariableExp.getReferredVariable() == pThisVariable) {
- Variable iThisVariable = QVTbaseUtil.getContextVariable(standardLibrary, visitor.getTransformation());
+ VariableDeclaration iThisVariable = QVTbaseUtil.getContextVariable(standardLibrary, visitor.getTransformation());
return PivotUtil.createVariableExp(iThisVariable);
}
}
}
if (node != null) {
- Variable iVariable = getVariable(node);
+ VariableDeclaration iVariable = basicGetVariable(node);
assert iVariable != null;
return PivotUtil.createVariableExp(iVariable);
}
else {
System.err.println("Creating unexpected variable for " + pVariable + " in " + region);
- BottomPattern bottomPattern = mapping.getBottomPattern();
- assert bottomPattern != null;
Type variableType = pVariable.getType();
assert variableType != null;
String safeName = getSafeName(ClassUtil.nonNullState(pVariable.getName()));
- Variable iVariable = PivotUtil.createVariable(safeName, variableType, pVariable.isIsRequired(), null);
- bottomPattern.getVariable().add(iVariable);
+ PredicateVariable iVariable = helper.createLocalOrPredicateVariable(safeName, variableType, pVariable.isIsRequired(), helper.createNullLiteralExp());
+ mapping.getOwnedStatements().add(iVariable);
// Variable oldVariable = node2variable.put(node, iVariable);
// assert oldVariable == null;
return PivotUtil.createVariableExp(iVariable);
@@ -523,14 +523,14 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
if (node.isExplicitNull()) {
return helper.createNullLiteralExp();
}
- Variable theVariable = node2variable.get(node);
+ VariableDeclaration theVariable = node2variable.get(node);
if (theVariable == null) {
TypedElement oldTypedElement = node.getTypedElements().iterator().next();
assert oldTypedElement != null;
if ((oldTypedElement instanceof Variable) && (((Variable)oldTypedElement).getOwnedInit() == null)) {
// for (@NonNull Edge edge : node.getIncomingEdges()) {
// if (edge.isArgument() || edge.isCast()) {
- theVariable = createBottomVariable(node, null);
+ theVariable = createBottomVariable(node, helper.createNullLiteralExp()); // FIXME is this possible?
// break;
// }
// }
@@ -557,7 +557,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
/**
* Mapping from the scheduled Nodes to their QVTi variables.
*/
- private final @NonNull Map<@NonNull Node, @NonNull Variable> node2variable = new HashMap<>();
+ private final @NonNull Map<@NonNull Node, @NonNull VariableDeclaration> node2variable = new HashMap<>();
/**
* Mapping from the TypedModel to its ImperativeDomain.
@@ -577,32 +577,9 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
createNavigablePredicates();
createExternalPredicates();
createRealizedVariables();
+ createPollingDependencies();
createPropertyAssignments();
createAddStatements();
- createPollingDependencies();
- }
-
- /**
- * Add asPredicate to the bottom pattern if any bottom variable is referenced, otherwise add to the guard pattern.
- */
- protected void addPredicate(@NonNull Predicate asPredicate) {
- boolean isBottom = false;
- for (TreeIterator<EObject> tit = asPredicate.eAllContents(); tit.hasNext(); ) {
- EObject eObject = tit.next();
- if (eObject instanceof VariableExp) {
- VariableDeclaration variable = ((VariableExp)eObject).getReferredVariable();
- if ((variable != null) && (variable.eContainer() instanceof BottomPattern)) {
- isBottom = true;
- break;
- }
- }
- }
- if (isBottom) {
- mapping.getBottomPattern().getPredicate().add(asPredicate);
- }
- else {
- mapping.getGuardPattern().getPredicate().add(asPredicate);
- }
}
/* @Override
@@ -696,8 +673,11 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
}
} */
- private @NonNull Variable createBottomVariable(@NonNull Node node, @Nullable OCLExpression initExpression) {
- Area area = getArea(node.getClassDatumAnalysis());
+ public @Nullable VariableDeclaration basicGetVariable(@NonNull Node node) {
+ return node2variable.get(node);
+ }
+
+ private @NonNull VariableStatement createBottomVariable(@NonNull Node node, @NonNull OCLExpression initExpression) {
Type variableType = node.getCompleteClass().getPrimaryClass();
assert variableType != null;
boolean isRequired = true;
@@ -706,21 +686,15 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
isRequired = false;
}
}
- if ((initExpression != null) && initExpression.isIsRequired()) {
+ if (initExpression.isIsRequired()) {
isRequired = true;
}
- Variable variable = PivotUtil.createVariable(getSafeName(node), variableType, isRequired, null);
-
-
- BottomPattern bottomPattern = area.getBottomPattern();
- bottomPattern.getVariable().add(variable);
- if (initExpression != null) {
- VariableAssignment variableAssignment = helper.createVariableAssignment(variable, initExpression);
- mapping.getBottomPattern().getAssignment().add(variableAssignment);
- }
- Variable oldVariable = node2variable.put(node, variable);
+ String safeName = getSafeName(node);
+ VariableStatement newVariable = helper.createLocalOrPredicateVariable(safeName, variableType, isRequired, initExpression);
+ mapping.getOwnedStatements().add(newVariable);
+ VariableDeclaration oldVariable = node2variable.put(node, newVariable);
assert oldVariable == null;
- return variable;
+ return newVariable;
}
private void createClassSetStatements(@NonNull Iterable<@NonNull List<@NonNull NavigableEdge>> classAssignments) {
@@ -728,10 +702,11 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
for (@NonNull NavigableEdge edge : edges) {
Node sourceNode = edge.getSource();
Node targetNode = edge.getTarget();
- OCLExpression slotVariableExp = createVariableExp(sourceNode);
+ VariableDeclaration slotVariable = getVariable(sourceNode);
Property property = edge.getProperty();
OCLExpression targetVariableExp = createVariableExp(targetNode);
- SetStatement setStatement = QVTimperativeUtil.createSetStatement((Variable) ((VariableExp)slotVariableExp).getReferredVariable(), property, targetVariableExp);
+ boolean isEmit = isHazardousWrite(property, sourceNode.getClassDatumAnalysis().getTypedModel());
+ SetStatement setStatement = QVTimperativeUtil.createSetStatement(slotVariable, property, targetVariableExp, isEmit);
mapping.getOwnedStatements().add(setStatement);
}
}
@@ -745,7 +720,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
for (@NonNull NodeConnection connection : connection2variable.keySet()) {
Node sourceNode = connection.getSource(region);
OCLExpression variableExpression = createVariableExp(sourceNode);
- ConnectionVariable connectionVariable = (ConnectionVariable)connection2variable.get(connection);
+ ConnectionVariable connectionVariable = connection2variable.get(connection);
assert connectionVariable != null;
createAddStatement(connectionVariable, variableExpression);
}
@@ -834,21 +809,21 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
assert targetExpression != null;
conditionExpression = helper.createOperationCallExp(conditionExpression, name, targetExpression);
}
- Predicate asPredicate = QVTbaseFactory.eINSTANCE.createPredicate();
+ CheckStatement asPredicate = QVTimperativeFactory.eINSTANCE.createCheckStatement();
asPredicate.setConditionExpression(conditionExpression);
- addPredicate(asPredicate);
+ mapping.getOwnedStatements().add(asPredicate);
}
}
}
- private @NonNull Variable createGuardVariable(@NonNull Node guardNode) {
- Area area = getArea(guardNode.getClassDatumAnalysis());
- GuardPattern guardPattern = area.getGuardPattern();
- assert guardPattern != null;
+ private @NonNull GuardVariable createGuardVariable(@NonNull Node guardNode) {
+ ClassDatumAnalysis classDatumAnalysis = guardNode.getClassDatumAnalysis();
+ ImperativeDomain area = getArea(classDatumAnalysis);
Type variableType = guardNode.getCompleteClass().getPrimaryClass();
- Variable guardVariable = PivotUtil.createVariable(getSafeName(guardNode), variableType, true, null);
- guardPattern.getVariable().add(guardVariable);
- Variable oldVariable = node2variable.put(guardNode, guardVariable);
+ TypedModel iTypedModel = ClassUtil.nonNullState(visitor.getQVTiTypedModel(classDatumAnalysis.getTypedModel()));
+ GuardVariable guardVariable = helper.createGuardVariable(getSafeName(guardNode), iTypedModel, variableType, true);
+ area.getOwnedGuardVariables().add(guardVariable);
+ VariableDeclaration oldVariable = node2variable.put(guardNode, guardVariable);
assert oldVariable == null;
return guardVariable;
}
@@ -917,7 +892,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
private void createMappingStatements(@NonNull Map<@NonNull Region, @NonNull Map<@NonNull Node, @NonNull Node>> calls) {
List<@NonNull MappingStatement> mappingStatements = new ArrayList<>();
- Map<@NonNull Variable, @NonNull OCLExpression> loopVariables = null;
+ Map<@NonNull LoopVariable, @NonNull OCLExpression> loopVariables = null;
for (Map.Entry<@NonNull Region, @NonNull Map<@NonNull Node, @NonNull Node>> entry : calls.entrySet()) {
@NonNull Region calledRegion = entry.getKey();
AbstractRegion2Mapping calledRegion2Mapping = visitor.getRegion2Mapping(calledRegion);
@@ -933,11 +908,11 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
}
Type elementType = ((CollectionType)type).getElementType();
assert elementType != null;
- Variable loopVariable = PivotUtil.createVariable("loop" + loopVariables.size(), elementType, true, sourceExpression);
+ LoopVariable loopVariable = helper.createLoopVariable("loop" + loopVariables.size(), elementType);//, true, sourceExpression);
loopVariables.put(loopVariable, sourceExpression);
sourceExpression = PivotUtil.createVariableExp(loopVariable);
}
- Variable guardVariable = calledRegion2Mapping.getGuardVariable(targetNode);
+ VariableDeclaration guardVariable = calledRegion2Mapping.getGuardVariable(targetNode);
mappingCallBindings.add(QVTimperativeUtil.createMappingCallBinding(guardVariable, sourceExpression));
// mappingCallBindings.add(QVTimperativeUtil.createMappingLoop(source, iterator, mappingStatement);
}
@@ -962,8 +937,8 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
Collections.sort(mappingCallBindings, QVTimperativeUtil.MappingCallBindingComparator.INSTANCE);
MappingStatement mappingCallStatement = calledRegion2Mapping.createMappingCall(mappingCallBindings);
if (loopVariables != null) {
- for (Map.Entry<@NonNull Variable, @NonNull OCLExpression> loopEntry : loopVariables.entrySet()) {
- @NonNull Variable loopVariable = loopEntry.getKey();
+ for (Map.Entry<@NonNull LoopVariable, @NonNull OCLExpression> loopEntry : loopVariables.entrySet()) {
+ @NonNull LoopVariable loopVariable = loopEntry.getKey();
@NonNull OCLExpression loopSource = loopEntry.getValue();
mappingCallStatement = QVTimperativeUtil.createMappingLoop(loopSource, loopVariable, mappingCallStatement);
}
@@ -1002,15 +977,15 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
OCLExpression sourceExp = createVariableExp(sourceNode);
OCLExpression source2targetExp = createCallExp(sourceExp, property);
if (!targetNode.isExplicitNull()) {
- Variable nodeVariable = node2variable.get(targetNode);
+ VariableDeclaration nodeVariable = node2variable.get(targetNode);
assert nodeVariable == null;
createBottomVariable(targetNode, source2targetExp);
}
else {
OCLExpression targetExp = helper.createNullLiteralExp();
OCLExpression conditionExpression = helper.createOperationCallExp(source2targetExp, "=", targetExp);
- Predicate asPredicate = helper.createPredicate(conditionExpression);
- addPredicate(asPredicate);
+ CheckStatement asPredicate = helper.createCheckStatement(conditionExpression);
+ mapping.getOwnedStatements().add(asPredicate);
}
}
//
@@ -1031,8 +1006,8 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
else {
matchesExp = helper.createOperationCallExp(targetExp, "=", source2targetExp);
}
- Predicate asPredicate = helper.createPredicate(matchesExp);
- addPredicate(asPredicate);
+ CheckStatement asPredicate = helper.createCheckStatement(matchesExp);
+ mapping.getOwnedStatements().add(asPredicate);
}
}
/* Set<@NonNull Node> reachableNodes = new HashSet<>(guardNodes);
@@ -1129,19 +1104,13 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
for (@NonNull TypedModel qvtpTypedModel : anyUsage.getTypedModels()) {
TypedModel qvtiTypedModel = visitor.getQVTiTypedModel(qvtpTypedModel);
ImperativeDomain domain = typedModel2domain.get(qvtiTypedModel);
- Area imperativeArea = domain != null ? (Area)domain : mapping;
- Iterable<@NonNull NavigableEdge> checkedEdges = region.getCheckedEdges(qvtpTypedModel);
- if (checkedEdges != null) {
- List<Property> checkedProperties = imperativeArea.getCheckedProperties();
- for (NavigableEdge checkedEdge : checkedEdges) {
- checkedProperties.add(checkedEdge.getProperty());
- }
- }
- Iterable<@NonNull NavigableEdge> enforcedEdges = region.getEnforcedEdges(qvtpTypedModel);
- if (enforcedEdges != null) {
- List<@NonNull Property> enforcedProperties = ClassUtil.nullFree(imperativeArea.getEnforcedProperties());
- for (@NonNull NavigableEdge enforcedEdge : enforcedEdges) {
- enforcedProperties.add(enforcedEdge.getProperty());
+ if (domain != null) {
+ Iterable<@NonNull NavigableEdge> checkedEdges = region.getCheckedEdges(qvtpTypedModel);
+ if (checkedEdges != null) {
+ List<Property> checkedProperties = domain.getCheckedProperties();
+ for (NavigableEdge checkedEdge : checkedEdges) {
+ checkedProperties.add(checkedEdge.getProperty());
+ }
}
}
}
@@ -1149,23 +1118,23 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
private void createPropertyAssignments() {
Map<@NonNull Node, @NonNull List<@NonNull NavigableEdge>> classAssignments = null;
- BottomPattern bottomPattern = mapping.getBottomPattern();
for (@NonNull NavigableEdge edge : NavigationEdgeSorter.getSortedAssignments(region.getRealizedNavigationEdges())) {
Node sourceNode = edge.getSource();
Node targetNode = edge.getTarget();
if (targetNode.isDataType()) {
- OCLExpression slotVariableExp = createVariableExp(sourceNode);
+ VariableDeclaration asVariable = getVariable(sourceNode);
Property property = edge.getProperty();
OCLExpression valueExp = expressionCreator.getExpression(targetNode);
if (valueExp == null) {
valueExp = expressionCreator.getExpression(targetNode); // FIXME debugging
}
if (valueExp != null) {
- SetStatement propertyAssignment = QVTimperativeUtil.createSetStatement((Variable) ((VariableExp)slotVariableExp).getReferredVariable(), property, valueExp);
+ boolean isEmit = isHazardousWrite(property, sourceNode.getClassDatumAnalysis().getTypedModel());
+ SetStatement propertyAssignment = QVTimperativeUtil.createSetStatement(asVariable, property, valueExp, isEmit);
mapping.getOwnedStatements().add(propertyAssignment);
}
else {
- System.err.println("No assignment in " + this + " to " + slotVariableExp + "." + property);
+ System.err.println("No assignment in " + this + " to " + asVariable + "." + property);
}
}
else {
@@ -1186,8 +1155,22 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
createClassSetStatements(values);
}
@SuppressWarnings("null")
- @NonNull EList<@NonNull Assignment> bottomAssignments = bottomPattern.getAssignment();
- ECollections.sort(bottomAssignments, new AssignmentComparator(bottomAssignments));
+ @NonNull EList<@NonNull Statement> statements = mapping.getOwnedStatements();
+ ECollections.sort(statements, new StatementComparator(statements));
+ }
+
+ private boolean isHazardousWrite(@NonNull Property asProperty, @NonNull TypedModel typedModel) {
+ Iterable<@NonNull NavigableEdge> enforcedEdges = region.getEnforcedEdges(typedModel);
+ if (enforcedEdges != null) {
+ Property asOppositeProperty = asProperty.getOpposite();
+ for (@NonNull NavigableEdge enforcedEdge : enforcedEdges) {
+ Property edgeProperty = enforcedEdge.getProperty();
+ if ((edgeProperty == asProperty) || (edgeProperty == asOppositeProperty)) {
+ return true;
+ }
+ }
+ }
+ return false;
}
private void createRealizedVariables() {
@@ -1208,7 +1191,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
NewStatement newStatement = QVTimperativeUtil.createNewStatement(getSafeName(newNode), iTypedModel, classDatumAnalysis.getCompleteClass().getPrimaryClass());
newStatement.setOwnedInit(constructor);
mapping.getOwnedStatements().add(newStatement);
- Variable oldVariable = node2variable.put(newNode, newStatement);
+ VariableDeclaration oldVariable = node2variable.put(newNode, newStatement);
assert oldVariable == null;
}
}
@@ -1253,11 +1236,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
return helper.createNullLiteralExp();
}
else {
- Variable variable = node2variable.get(node);
- if (variable == null) {
- OCLExpression initExpression = node.getTypedElements().iterator().next().accept(expressionCreator);
- variable = createBottomVariable(node, initExpression);
- }
+ VariableDeclaration variable = getVariable(node);
return PivotUtil.createVariableExp(variable);
}
}
@@ -1296,7 +1275,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
return recursiveDepth;
} */
- private @NonNull Area getArea(@NonNull ClassDatumAnalysis classDatumAnalysis) {
+ private @NonNull ImperativeDomain getArea(@NonNull ClassDatumAnalysis classDatumAnalysis) {
TypedModel qvtpTypedModel = classDatumAnalysis.getTypedModel();
ImperativeDomain coreDomain = typedModel2domain.get(qvtpTypedModel);
if (coreDomain != null) {
@@ -1304,15 +1283,8 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
}
TypedModel qvtiTypedModel = visitor.qvtpTypedModel2qvtiTypedModel.get(qvtpTypedModel); // FIXME shouldn't happen
coreDomain = typedModel2domain.get(qvtiTypedModel);
- if (coreDomain != null) {
- return coreDomain;
- }
- // for (Domain domain : mapping.getDomain()) {
- // if (domain.getTypedModel() == qvtiTypedModel) {
- // return (ImperativeDomain)domain;
- // }
- // }
- return mapping;
+ assert coreDomain != null;
+ return coreDomain;
}
@Override
@@ -1321,11 +1293,11 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
}
@Override
- public @NonNull Variable getGuardVariable(@NonNull Node node) {
+ public @NonNull VariableDeclaration getGuardVariable(@NonNull Node node) {
// Area area = getArea(mapping, node.getClassDatumAnalysis().getDomainUsage());
// String name = getName(node);
// Variable variable = NameUtil.getNameable(area.getGuardPattern().getVariable(),name);
- Variable variable = node2variable.get(node);
+ VariableDeclaration variable = node2variable.get(node);
assert variable != null;
return variable;
}
@@ -1345,8 +1317,13 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
return createVariableExp(sourceNode);
}
- public @Nullable Variable getVariable(@NonNull Node node) {
- return node2variable.get(node);
+ protected @NonNull VariableDeclaration getVariable(Node node) {
+ VariableDeclaration variable = node2variable.get(node);
+ if (variable == null) {
+ OCLExpression initExpression = node.getTypedElements().iterator().next().accept(expressionCreator);
+ variable = createBottomVariable(node, initExpression);
+ }
+ return variable;
}
private boolean isIfExp(@NonNull Node node) {
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java
index 32d83c181..459696dcb 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java
@@ -22,7 +22,7 @@ import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.OperationCallExp;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.VariableExp;
import org.eclipse.ocl.pivot.ids.IdManager;
import org.eclipse.ocl.pivot.ids.OperationId;
@@ -34,16 +34,14 @@ import org.eclipse.qvtd.compiler.internal.qvtp2qvts.CyclicScheduledRegion;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Node;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.NodeConnection;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Region;
-import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
-import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
import com.google.common.collect.Iterables;
@@ -72,36 +70,32 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
/**
* The guard variable for the recursed type.
*/
- private final @NonNull Variable guardVariable;
+ private final @NonNull InConnectionVariable guardVariable;
/**
* The local accumulation variable for the recursed type. Already processed values may be present.
*/
- private final @NonNull ConnectionVariable localVariable;
+ private final @NonNull OutConnectionVariable localVariable;
/**
* The filtered local accumulation variable for the recursed type. Already processed values have been removed.
*/
- private @Nullable ConnectionVariable newVariable;
+ private @Nullable OutConnectionVariable newVariable;
/**
* The accumulated output variable for the recursed type.
*/
- private ConnectionVariable accumulatedVariable;
+ private InConnectionVariable accumulatedVariable;
public RecursionContext(@NonNull Node headNode) {
this.classDatumAnalysis = headNode.getClassDatumAnalysis();
this.index = classDatumAnalysis2recursion.size();
//
- // Create/locate the domain and guard pattern for the guard.
- //
- GuardPattern guardPattern = getGuardPattern(classDatumAnalysis);
- //
// Create the domain guard variable.
//
org.eclipse.ocl.pivot.Class elementType = classDatumAnalysis.getCompleteClass().getPrimaryClass();
- guardVariable = PivotUtil.createVariable(getSafeName(headNode), elementType, false, null);
- guardPattern.getVariable().add(guardVariable);
+ guardVariable = helper.createInConnectionVariable(getSafeName(headNode), elementType, false);
+ mapping.getInoutVariables().add(guardVariable);
Iterable<@NonNull NodeConnection> outgoingConnections = headNode.getOutgoingPassedConnections();
assert Iterables.size(outgoingConnections) == 1;
@@ -127,14 +121,14 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
// incoming2outgoing.put(incomingConnection, internallyPassedConnection);
Type asType = getConnectionSourcesType(incomingConnection);
String localName = "«local" + (index > 0 ? Integer.toString(index) : "") + "»";
- localVariable = helper.createConnectionVariable(localName, asType, null);
- mapping.getBottomPattern().getVariable().add(localVariable);
+ localVariable = helper.createOutConnectionVariable(localName, asType, true, null);
+ mapping.getOwnedStatements().add(localVariable);
connection2variable.put(outgoingConnection, localVariable);
//
if ((asType instanceof CollectionType) && ((CollectionType)asType).isUnique()) {
String newName = "«new" + (index > 0 ? Integer.toString(index) : "") + "»";
- ConnectionVariable newVariable2 = newVariable = helper.createConnectionVariable(newName, asType, null);
- mapping.getBottomPattern().getVariable().add(newVariable2);
+ OutConnectionVariable newVariable2 = newVariable = helper.createOutConnectionVariable(newName, asType, true, null);
+ mapping.getOwnedStatements().add(newVariable2);
connection2variable.put(outgoingConnection, newVariable2);
}
else {
@@ -155,7 +149,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
return classDatumAnalysis;
}
- public @NonNull Variable getGuardVariable() {
+ public @NonNull ConnectionVariable getGuardVariable() {
return guardVariable;
}
@@ -173,8 +167,8 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
// Select a/the outgoing recursive intermediate connection.
//
NodeConnection intermediateConnection = accumulatedConnection;
- ConnectionVariable accumulatedVariable2 = accumulatedVariable = createConnectionVariable(intermediateConnection);
- mapping.getGuardPattern().getVariable().add(accumulatedVariable2);
+ InConnectionVariable accumulatedVariable2 = accumulatedVariable = createInConnectionVariable(intermediateConnection);
+ mapping.getInoutVariables().add(accumulatedVariable2);
connection2variable.put(intermediateConnection, accumulatedVariable2);
}
}
@@ -193,7 +187,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
/**
* Cache of the domains created for each recursiing typed model
*/
- private final @NonNull Map<@NonNull TypedModel, @NonNull ImperativeDomain> typedModel2domain = new HashMap<>();
+ // private final @NonNull Map<@NonNull TypedModel, @NonNull ImperativeDomain> typedModel2domain = new HashMap<>();
public CyclicScheduledRegion2Mapping(@NonNull QVTs2QVTiVisitor visitor, @NonNull CyclicScheduledRegion region) {
super(visitor, region);
@@ -230,13 +224,13 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
protected void createConnectionGuardVariables() {
List<@NonNull NodeConnection> intermediateConnections = region.getIntermediateConnections();
for (@NonNull NodeConnection intermediateConnection : intermediateConnections) {
- Variable connectionVariable = connection2variable.get(intermediateConnection);
+ InConnectionVariable connectionVariable = (InConnectionVariable) connection2variable.get(intermediateConnection);
if (connectionVariable == null) {
String name = intermediateConnection.getName();
assert name != null;
- connectionVariable = helper.createConnectionVariable(name, getConnectionSourcesType(intermediateConnection), null);
+ connectionVariable = helper.createInConnectionVariable(name, getConnectionSourcesType(intermediateConnection), true);
connection2variable.put(intermediateConnection, connectionVariable);
- mapping.getGuardPattern().getVariable().add(connectionVariable);
+ mapping.getInoutVariables().add(connectionVariable);
}
}
}
@@ -275,22 +269,22 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
List<@NonNull MappingStatement> mappingStatements = new ArrayList<>();
for (@NonNull Region callableRegion : region.getCallableChildren()) {
AbstractRegion2Mapping calledRegion2Mapping = visitor.getRegion2Mapping(callableRegion);
- Map<@NonNull Variable, @NonNull OCLExpression> guardVariable2expression = new HashMap<@NonNull Variable, @NonNull OCLExpression>();
+ Map<@NonNull VariableDeclaration, @NonNull OCLExpression> guardVariable2expression = new HashMap<>();
for (@NonNull Node calledHeadNode : callableRegion.getHeadNodes()) {
NodeConnection headConnection = calledHeadNode.getIncomingConnection();
assert headConnection != null;
Node callingHeadNode = Iterables.get(headConnection.getSourceNodes(), 0);
- Variable callingHeadVariable = getGuardVariable(callingHeadNode);
- Variable calledHeadVariable = calledRegion2Mapping.getGuardVariable(calledHeadNode);
+ ConnectionVariable callingHeadVariable = getGuardVariable(callingHeadNode);
+ VariableDeclaration calledHeadVariable = calledRegion2Mapping.getGuardVariable(calledHeadNode);
guardVariable2expression.put(calledHeadVariable, PivotUtil.createVariableExp(callingHeadVariable));
}
for (@NonNull NodeConnection intermediateConnection : callableRegion.getIntermediateConnections()) {
RecursionContext recursion = classDatumAnalysis2recursion.get(intermediateConnection.getClassDatumAnalysis());
if (recursion != null) {
- Variable callingLocalVariable = recursion.getLocalVariable();
+ ConnectionVariable callingLocalVariable = recursion.getLocalVariable();
// NodeConnection tailConnection = recursion.getAccumulatedConnection();
// if (tailConnection != null) {
- Variable calledTailVariable = calledRegion2Mapping.getConnectionVariable(intermediateConnection);
+ ConnectionVariable calledTailVariable = calledRegion2Mapping.getConnectionVariable(intermediateConnection);
guardVariable2expression.put(calledTailVariable, PivotUtil.createVariableExp(callingLocalVariable));
// }
}
@@ -334,10 +328,10 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
//
// Create the recursive call recursing all the recursive connections.
//
- Map<@NonNull Variable, @NonNull OCLExpression> guardVariable2expression = new HashMap<@NonNull Variable, @NonNull OCLExpression>();
+ Map<@NonNull VariableDeclaration, @NonNull OCLExpression> guardVariable2expression = new HashMap<>();
for (@NonNull RecursionContext recursion : classDatumAnalysis2recursion.values()) {
- Variable guardVariable = recursion.getGuardVariable();
- Variable newVariable = recursion.getNewVariable();
+ ConnectionVariable guardVariable = recursion.getGuardVariable();
+ ConnectionVariable newVariable = recursion.getNewVariable();
if (newVariable == null) {
newVariable = recursion.getLocalVariable();
}
@@ -353,31 +347,8 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
return getHeadNodes();
}
- public @NonNull GuardPattern getGuardPattern(@NonNull ClassDatumAnalysis classDatumAnalysis) {
- //
- // Create/locate the domain and guard pattern for the guard.
- //
- TypedModel typedModel = visitor.getQVTiTypedModel(classDatumAnalysis.getTypedModel());
- GuardPattern guardPattern;
- if (typedModel != null) {
- ImperativeDomain domain = typedModel2domain.get(typedModel);
- if (domain == null) {
- domain = QVTimperativeUtil.createImperativeDomain(typedModel);
- domain.setIsCheckable(true);
- mapping.getDomain().add(domain);
- typedModel2domain.put(typedModel, domain);
- }
- guardPattern = domain.getGuardPattern();
- }
- else {
- guardPattern = mapping.getGuardPattern();
- }
- assert guardPattern != null;
- return guardPattern;
- }
-
@Override
- public @NonNull Variable getGuardVariable(@NonNull Node node) {
+ public @NonNull ConnectionVariable getGuardVariable(@NonNull Node node) {
assert getHeadNodes().contains(node);
ClassDatumAnalysis classDatumAnalysis = node.getClassDatumAnalysis();
RecursionContext recursion = classDatumAnalysis2recursion.get(classDatumAnalysis);
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java
index 005d9a191..983702ecf 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java
@@ -51,10 +51,10 @@ import org.eclipse.qvtd.compiler.internal.qvtp2qvts.RootCompositionRegion;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.SchedulerConstants;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
@@ -62,12 +62,12 @@ public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
/**
* Mapping from the type to allInstances variable.
*/
- private final @NonNull Map<@NonNull ClassDatumAnalysis, @NonNull Variable> classDatumAnalysis2variable = new HashMap<@NonNull ClassDatumAnalysis, @NonNull Variable>();
+ private final @NonNull Map<@NonNull ClassDatumAnalysis, @NonNull PredicateVariable> classDatumAnalysis2variable = new HashMap<>();
/**
* Mapping from the scheduled Nodes to their QVTi variables.
*/
- private final @NonNull Map<@NonNull Node, @NonNull Variable> node2variable = new HashMap<@NonNull Node, @NonNull Variable>();
+ private final @NonNull Map<@NonNull Node, @NonNull Variable> node2variable = new HashMap<>();
// private Variable rootsVariable = null;
// private final @NonNull Map<@NonNull NodeConnection, @NonNull ConnectionVariable> connection2variable = new HashMap<@NonNull NodeConnection, @NonNull ConnectionVariable>();
@@ -110,7 +110,7 @@ public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
private @NonNull OCLExpression createObjectsOfKindExpression(@NonNull Node resultNode) { // FIXME compute input typed model
ClassDatumAnalysis classDatumAnalysis = resultNode.getClassDatumAnalysis();
- Variable allInstancesVariable = classDatumAnalysis2variable.get(classDatumAnalysis);
+ PredicateVariable allInstancesVariable = classDatumAnalysis2variable.get(classDatumAnalysis);
if (allInstancesVariable == null) {
Type collectionType = classDatumAnalysis.getCompleteClass().getPrimaryClass();
Type elementType = ((CollectionType)collectionType).getElementType();
@@ -123,26 +123,26 @@ public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
VariableExp modelExp = helper.createVariableExp(contextVariable);
TypeExp typeExp = helper.createTypeExp(elementType);
OCLExpression asSource = helper.createOperationCallExp(modelExp, "objectsOfKind", typeExp);
- allInstancesVariable = PivotUtil.createVariable(resultNode.getName(), asSource);
- mapping.getBottomPattern().getVariable().add(allInstancesVariable);
+ Type sourceType = asSource.getType();
+ assert sourceType != null;
+ allInstancesVariable = helper.createLocalOrPredicateVariable(resultNode.getName(), sourceType, true, asSource);
+ mapping.getOwnedStatements().add(allInstancesVariable);
classDatumAnalysis2variable.put(classDatumAnalysis, allInstancesVariable);
}
return helper.createVariableExp(allInstancesVariable);
}
- private @NonNull ConnectionVariable createRootConnectionVariable(@NonNull ImperativePattern pattern, @NonNull String name, @NonNull Type type, @Nullable OCLExpression initExpression) {
+ private @NonNull ConnectionVariable createRootConnectionVariable(@NonNull String name, @NonNull Type type, @Nullable OCLExpression initExpression) {
// Type variableType = visitor.getEnvironmentFactory().getCompleteEnvironment().getSetType(node.getCompleteClass().getPrimaryClass(), true, null, null);
// assert variableType != null;
- ConnectionVariable variable = helper.createConnectionVariable(getSafeName(name), type, initExpression);
- pattern.getVariable().add(variable);
+ OutConnectionVariable variable = helper.createOutConnectionVariable(getSafeName(name), type, true, initExpression);
+ mapping.getOwnedStatements().add(variable);
// Variable oldVariable = node2variable.put(node, variable);
// assert oldVariable == null;
return variable;
}
private void createRootConnectionVariables() {
- BottomPattern bottomPattern = mapping.getBottomPattern();
- assert bottomPattern != null;
List<@NonNull NodeConnection> rootConnections = new ArrayList<@NonNull NodeConnection>(region.getRootConnections());
Collections.sort(rootConnections, NameUtil.NAMEABLE_COMPARATOR);
for (@NonNull NodeConnection rootConnection : rootConnections) {
@@ -158,14 +158,14 @@ public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
case 1: initExpression = getFilteredExpression(initExpression, (NavigableEdge) incomingEdges.get(0)); break;
default: assert false;
}
- connection2variable.put(rootConnection, createRootConnectionVariable(bottomPattern, name, commonType, initExpression));
+ connection2variable.put(rootConnection, createRootConnectionVariable(name, commonType, initExpression));
}
else if (commonType instanceof CollectionType) {
CollectionLiteralExp initExpression = PivotFactory.eINSTANCE.createCollectionLiteralExp();
initExpression.setType(commonType);
initExpression.setKind(TypeUtil.getCollectionKind((CollectionType) commonType));
initExpression.setIsRequired(true);
- connection2variable.put(rootConnection, createRootConnectionVariable(bottomPattern, name, commonType, initExpression));
+ connection2variable.put(rootConnection, createRootConnectionVariable(name, commonType, initExpression));
}
else {
CollectionLiteralExp initExpression = PivotFactory.eINSTANCE.createCollectionLiteralExp();
@@ -173,7 +173,7 @@ public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
initExpression.setType(setType);
initExpression.setKind(CollectionKind.SET);
initExpression.setIsRequired(true);
- connection2variable.put(rootConnection, createRootConnectionVariable(bottomPattern, name, setType, initExpression));
+ connection2variable.put(rootConnection, createRootConnectionVariable(name, setType, initExpression));
}
}
}
diff --git a/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java b/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java
index af5e0c1c4..5a065f048 100644
--- a/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java
+++ b/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java
@@ -27,7 +27,6 @@ import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEnvironmentFactory;
@@ -78,7 +77,7 @@ public class QVTiMainTab extends MainTab implements QVTiLaunchConstants
for (Domain domain : mapping.getDomain()) {
if (domain instanceof ImperativeDomain) {
ImperativeDomain coreDomain = (ImperativeDomain)domain;
- BottomPattern bottomPattern = coreDomain.getBottomPattern();
+ /* BottomPattern bottomPattern = coreDomain.getBottomPattern();
assert bottomPattern != null;
TypedModel typedModel = coreDomain.getTypedModel();
assert typedModel != null;
@@ -100,7 +99,7 @@ public class QVTiMainTab extends MainTab implements QVTiLaunchConstants
}
}
}
- }
+ } */
}
}
}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java
index 33c269009..b31dc32cc 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java
@@ -41,23 +41,8 @@ implements QVTimperativeVisitor<IStepper>
}
@Override
- public @Nullable IStepper visitAssignment(org.eclipse.qvtd.pivot.qvtimperative.@NonNull Assignment object) {
- return visitElement(object);
- }
-
- @Override
- public @Nullable IStepper visitBottomPattern(org.eclipse.qvtd.pivot.qvtimperative.@NonNull BottomPattern object) {
- return visitImperativePattern(object);
- }
-
- @Override
public @Nullable IStepper visitConnectionVariable(org.eclipse.qvtd.pivot.qvtimperative.@NonNull ConnectionVariable object) {
- return visitVariable(object);
- }
-
- @Override
- public @Nullable IStepper visitGuardPattern(org.eclipse.qvtd.pivot.qvtimperative.@NonNull GuardPattern object) {
- return visitImperativePattern(object);
+ return visitVariableDeclaration(object);
}
@Override
@@ -71,11 +56,6 @@ implements QVTimperativeVisitor<IStepper>
}
@Override
- public @Nullable IStepper visitImperativePattern(org.eclipse.qvtd.pivot.qvtimperative.@NonNull ImperativePattern object) {
- return visitPattern(object);
- }
-
- @Override
public @Nullable IStepper visitMapping(org.eclipse.qvtd.pivot.qvtimperative.@NonNull Mapping object) {
return visitRule(object);
}
@@ -102,12 +82,7 @@ implements QVTimperativeVisitor<IStepper>
@Override
public @Nullable IStepper visitNewStatement(org.eclipse.qvtd.pivot.qvtimperative.@NonNull NewStatement object) {
- return visitVariable(object);
- }
-
- @Override
- public @Nullable IStepper visitSetStatement(org.eclipse.qvtd.pivot.qvtimperative.@NonNull SetStatement object) {
- return visitBottomStatement(object);
+ return visitVariableStatement(object);
}
@Override
@@ -116,12 +91,7 @@ implements QVTimperativeVisitor<IStepper>
}
@Override
- public @Nullable IStepper visitVariableAssignment(org.eclipse.qvtd.pivot.qvtimperative.@NonNull VariableAssignment object) {
- return visitAssignment(object);
- }
-
- @Override
- public @Nullable IStepper visitVariablePredicate(org.eclipse.qvtd.pivot.qvtimperative.@NonNull VariablePredicate object) {
- return visitPredicate(object);
+ public @Nullable IStepper visitVariableStatement(org.eclipse.qvtd.pivot.qvtimperative.@NonNull VariableStatement object) {
+ return visitStatement(object);
}
}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java
index 57ffe3474..df429ef86 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java
@@ -13,23 +13,25 @@ package org.eclipse.qvtd.debug.stepper;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.debug.stepper.NonStepper;
-import org.eclipse.ocl.examples.debug.stepper.PostStepper;
import org.eclipse.ocl.examples.debug.vm.evaluator.IStepper;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Predicate;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
@@ -46,32 +48,32 @@ public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
}
@Override
- public @Nullable IStepper visitAssignment(@NonNull Assignment object) {
- return PostStepper.INSTANCE;
+ public @Nullable IStepper visitCheckStatement(@NonNull CheckStatement object) {
+ return NonStepper.INSTANCE;
}
@Override
- public @Nullable IStepper visitBottomPattern(@NonNull BottomPattern object) {
+ public @Nullable IStepper visitConnectionVariable(@NonNull ConnectionVariable object) {
return NonStepper.INSTANCE;
}
@Override
- public IStepper visitBottomStatement(@NonNull BottomStatement object) {
+ public @Nullable IStepper visitDomain(@NonNull Domain object) {
return NonStepper.INSTANCE;
}
@Override
- public @Nullable IStepper visitConnectionVariable(@NonNull ConnectionVariable object) {
+ public @Nullable IStepper visitGuardVariable(@NonNull GuardVariable asVariable) {
return NonStepper.INSTANCE;
}
@Override
- public @Nullable IStepper visitDomain(@NonNull Domain object) {
+ public @Nullable IStepper visitInConnectionVariable(@NonNull InConnectionVariable object) {
return NonStepper.INSTANCE;
}
@Override
- public @Nullable IStepper visitGuardPattern(@NonNull GuardPattern object) {
+ public @Nullable IStepper visitLoopVariable(@NonNull LoopVariable asVariable) {
return NonStepper.INSTANCE;
}
@@ -106,11 +108,26 @@ public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
}
@Override
+ public @Nullable IStepper visitOutConnectionVariable(@NonNull OutConnectionVariable object) {
+ return NonStepper.INSTANCE;
+ }
+
+ @Override
public @Nullable IStepper visitPredicate(@NonNull Predicate object) {
return NonStepper.INSTANCE;
}
@Override
+ public @Nullable IStepper visitPredicateVariable(@NonNull PredicateVariable asVariable) {
+ return NonStepper.INSTANCE;
+ }
+
+ @Override
+ public @Nullable IStepper visitSetStatement(@NonNull SetStatement object) {
+ return NonStepper.INSTANCE;
+ }
+
+ @Override
public @Nullable IStepper visitStatement(@NonNull Statement object) {
return PreStepper.INSTANCE;
}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java
index b0d062a00..5a718fa06 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java
@@ -38,8 +38,6 @@ import org.eclipse.qvtd.debug.QVTiBreakpoint;
import org.eclipse.qvtd.debug.core.QVTiDebugCore;
import org.eclipse.qvtd.debug.core.QVTiEvaluationContext;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
-import org.eclipse.qvtd.pivot.qvtbase.Pattern;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
@@ -79,13 +77,6 @@ public class QVTiVMVirtualMachine extends VMVirtualMachine
s.append(((Domain)eObject).getName());
return true;
}
- else if (eObject instanceof Pattern) {
- if (appendElementSignature(s, eObject.eContainer())) {
- s.append(" ");
- }
- s.append(eObject instanceof GuardPattern ? "«guard»" : "«bottom»");
- return true;
- }
else if (eObject instanceof MappingCall) {
if (appendElementSignature(s, eObject.eContainer())) {
s.append("::");
@@ -151,7 +142,7 @@ public class QVTiVMVirtualMachine extends VMVirtualMachine
private static @NonNull VMStackFrameData createStackFrame(@NonNull UnitLocation location, boolean includeVars) {
VMEvaluationEnvironment evalEnv = location.getEvalEnv();
NamedElement module = location.getModule();
- String moduleName = (module != null) ? module.getName() : null;
+ String moduleName = module.getName();
if (moduleName == null) moduleName = "<null>"; //$NON-NLS-1$
Element element = location.getElement();
StringBuilder s = new StringBuilder();
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java
index 2c8a2e31d..2108f77fb 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java
@@ -77,15 +77,15 @@ import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsageAnalysis;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
+import org.eclipse.qvtd.pivot.qvtimperative.Statement;
import org.eclipse.qvtd.pivot.qvtimperative.util.AbstractExtendingQVTimperativeVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
@@ -127,7 +127,7 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
protected @NonNull DomainUsage doSetStatement(@NonNull Property property, @NonNull SetStatement object) {
- DomainUsage slotUsage = visit(object.getSlotExpression());
+ DomainUsage slotUsage = visit(object.getTargetVariable());
DomainUsage valueUsage = visit(object.getValue());
DomainUsage knownSourceUsage = getRootAnalysis().property2containingClassUsage.get(property);
if (knownSourceUsage != null) {
@@ -250,7 +250,7 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
for (Domain domain : rule.getDomain()) {
if (domain instanceof ImperativeDomain) {
DomainUsage usage = visit(domain.getTypedModel());
- for (Variable variable : ((ImperativeDomain)domain).getGuardPattern().getVariable()) {
+ for (GuardVariable variable : ((ImperativeDomain)domain).getOwnedGuardVariables()) {
if (variable != null) {
DomainUsage variableUsage = visit(variable.getType());
if (variableUsage != primitiveUsage) {
@@ -264,7 +264,18 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
if (rule instanceof Mapping) {
DomainUsage middleUsage = getRootAnalysis().getMiddleUsage();
- for (Variable variable : ((Mapping)rule).getGuardPattern().getVariable()) {
+ for (GuardVariable variable : ((Mapping)rule).getOwnedGuardVariables()) {
+ if (variable != null) {
+ DomainUsage variableUsage = visit(variable.getType());
+ // if (variableUsage != primitiveUsage) {
+ if (!variableUsage.isInput() && !variableUsage.isOutput() && !variableUsage.isPrimitive()) {
+ variableUsage = middleUsage;
+ }
+ assert variableUsage != null;
+ setUsage(variable, variableUsage);
+ }
+ }
+ for (ConnectionVariable variable : ((Mapping)rule).getInoutVariables()) {
if (variable != null) {
DomainUsage variableUsage = visit(variable.getType());
// if (variableUsage != primitiveUsage) {
@@ -361,17 +372,8 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
- public @NonNull DomainUsage visitBottomPattern(@NonNull BottomPattern object) {
- for (Variable variable : object.getVariable()) {
- visit(variable);
- }
- for (Assignment assignment : object.getAssignment()) {
- visit(assignment);
- }
- for (Predicate predicate : object.getPredicate()) {
- visit(predicate);
- }
- return getDomainUsage(object);
+ public @NonNull DomainUsage visitCheckStatement(@NonNull CheckStatement object) {
+ return visit(object.getConditionExpression());
}
@Override
@@ -460,23 +462,14 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
- public @NonNull DomainUsage visitGuardPattern(@NonNull GuardPattern object) {
- DomainUsage domainUsage = getDomainUsage(object);
- // for (Variable variable : object.getVariable()) { // In visitTransformation
- // setUsage(variable, domainUsage);
- // }
- for (Predicate predicate : object.getPredicate()) {
- visit(predicate);
- }
- return domainUsage;
+ public @NonNull DomainUsage visitGuardVariable(@NonNull GuardVariable object) {
+ return visit(object.getReferredTypedModel());
}
@Override
public @NonNull DomainUsage visitImperativeDomain(@NonNull ImperativeDomain object) {
DomainUsage usage = visit(object.getTypedModel());
setUsage(object, usage);
- visit(object.getGuardPattern());
- visit(object.getBottomPattern());
return usage;
}
@@ -567,6 +560,17 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
+ public @NonNull DomainUsage visitMapping(@NonNull Mapping object) {
+ for (Domain domain : object.getDomain()) {
+ visit(domain);
+ }
+ for (Statement predicate : object.getOwnedStatements()) {
+ visit(predicate);
+ }
+ return getRootAnalysis().getNoneUsage();
+ }
+
+ @Override
public @NonNull DomainUsage visitNewStatement(@NonNull NewStatement object) {
return visit(object.getReferredTypedModel());
}
@@ -722,6 +726,15 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
+ public @NonNull DomainUsage visitPredicateVariable(@NonNull PredicateVariable object) {
+ OCLExpression ownedInit = object.getOwnedInit();
+ if (ownedInit != null) {
+ return visit(ownedInit);
+ }
+ return visit(object.getType());
+ }
+
+ @Override
public @NonNull DomainUsage visitPrimitiveType(@NonNull PrimitiveType object) {
return getRootAnalysis().getPrimitiveUsage();
}
@@ -745,14 +758,6 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
- public @NonNull DomainUsage visitRule(@NonNull Rule object) {
- for (Domain domain : object.getDomain()) {
- visit(domain);
- }
- return getRootAnalysis().getNoneUsage();
- }
-
- @Override
public @NonNull DomainUsage visitSelfType(@NonNull SelfType object) {
return ClassUtil.nonNullState(selfUsage);
}
@@ -883,9 +888,9 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
if (ownedInit != null) {
return visit(ownedInit);
}
- Area area = QVTimperativeUtil.getContainingArea(object);
- if (area instanceof Domain) {
- return visit(area);
+ Domain domain = QVTimperativeUtil.getContainingDomain(object);
+ if (domain != null) {
+ return visit(domain);
}
else {
return visit(object.getType());
@@ -893,13 +898,6 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
- public @NonNull DomainUsage visitVariableAssignment(@NonNull VariableAssignment object) {
- DomainUsage valueUsage = visit(object.getValue());
- DomainUsage variableUsage = visit(object.getTargetVariable());
- return intersection(variableUsage, valueUsage);
- }
-
- @Override
public @NonNull DomainUsage visitVariableDeclaration(@NonNull VariableDeclaration object) {
return visit(object.getType());
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/QVTimperativeDomainUsageAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/QVTimperativeDomainUsageAnalysis.java
index 4b986e7b1..e3dba4385 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/QVTimperativeDomainUsageAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/QVTimperativeDomainUsageAnalysis.java
@@ -15,7 +15,6 @@ import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.OperationCallExp;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.VariableExp;
import org.eclipse.ocl.pivot.internal.complete.StandardLibraryInternal;
import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
@@ -23,13 +22,13 @@ import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
/**
@@ -55,7 +54,7 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
@Override
public @NonNull DomainUsage visitConnectionVariable(@NonNull ConnectionVariable object) {
- return visitVariable(object);
+ return visitVariableDeclaration(object);
}
@Override
@@ -67,9 +66,7 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
public @NonNull DomainUsage visitMapping(@NonNull Mapping object) {
DomainUsage usage = getNoneUsage();
setUsage(object, usage);
- visitRule(object);
- visit(object.getGuardPattern());
- visit(object.getBottomPattern());
+ super.visitMapping(object);
for (Statement mappingStatement : object.getOwnedStatements()) {
visit(mappingStatement);
}
@@ -94,7 +91,7 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
@Override
public @NonNull DomainUsage visitMappingLoop(@NonNull MappingLoop object) {
DomainUsage sourceUsage = visit(object.getOwnedSource());
- for (Variable iterator : object.getOwnedIterators()) {
+ for (LoopVariable iterator : object.getOwnedIterators()) {
if (iterator != null) {
setUsage(iterator, sourceUsage);
}
@@ -136,9 +133,4 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
}
return super.visitVariableExp(object);
}
-
- @Override
- public @NonNull DomainUsage visitVariablePredicate(@NonNull VariablePredicate object) {
- return visitPredicate(object);
- }
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java
index b8506c013..65af23c9e 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java
@@ -31,12 +31,12 @@ import org.eclipse.ocl.pivot.DataType;
import org.eclipse.ocl.pivot.Detail;
import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.NullLiteralExp;
-import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.OperationCallExp;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.StandardLibrary;
import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.ids.OperationId;
import org.eclipse.ocl.pivot.internal.complete.StandardLibraryInternal;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
@@ -52,7 +52,6 @@ import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsageAnalysis;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
@@ -380,9 +379,9 @@ public class RootDomainUsageAnalysis extends AbstractDomainUsageAnalysis impleme
// if ("s.name := sn".equals(eObject.toString())) {
// eObject.toString();
// }
- OCLExpression slotExpression = setStatement.getSlotExpression();
- assert slotExpression != null;
- DomainUsage domainUsage = getUsage(slotExpression);
+ VariableDeclaration targetVariable = setStatement.getTargetVariable();
+ assert targetVariable != null;
+ DomainUsage domainUsage = getUsage(targetVariable);
if (!domainUsage.isOutput() && !domainUsage.isMiddle()) {
Property targetProperty = QVTimperativeUtil.getTargetProperty(setStatement);
// System.out.println("Dirty " + targetProperty + " for " + eObject);
@@ -525,27 +524,24 @@ public class RootDomainUsageAnalysis extends AbstractDomainUsageAnalysis impleme
if (asCallExp.getOwnedSource().getTypeValue() instanceof DataType) {
return getPrimitiveUsage();
}
- Area area = QVTimperativeUtil.getContainingArea(asCallExp);
- if (area instanceof ImperativeDomain) {
- DomainUsage areaUsage = getUsage(area);
+ Domain aDomain = QVTimperativeUtil.getContainingDomain(asCallExp);
+ if (aDomain instanceof ImperativeDomain) {
+ DomainUsage areaUsage = getUsage(aDomain);
return intersection(sourceUsage, areaUsage);
}
- else if (area instanceof Mapping) {
- DomainUsage inputUsage = getNoneUsage();
- for (Domain domain : ((Mapping)area).getDomain()) {
- if (!domain.isIsEnforceable()) {
- inputUsage = union(inputUsage, getUsage(domain));
- }
- }
- if (inputUsage != getNoneUsage()) {
- return intersection(sourceUsage, inputUsage);
- }
- else { // Att root so no domains, use input
- return intersection(sourceUsage, getInputUsage());
+ Mapping mapping = QVTimperativeUtil.getContainingMapping(asCallExp);
+ assert mapping != null;
+ DomainUsage inputUsage = getNoneUsage();
+ for (Domain domain : mapping.getDomain()) {
+ if (!domain.isIsEnforceable()) {
+ inputUsage = union(inputUsage, getUsage(domain));
}
}
- else {
- return sourceUsage;
+ if (inputUsage != getNoneUsage()) {
+ return intersection(sourceUsage, inputUsage);
+ }
+ else { // Att root so no domains, use input
+ return intersection(sourceUsage, getInputUsage());
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/BottomPatternAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/BottomPatternAttribution.java
deleted file mode 100644
index b9761b4e8..000000000
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/BottomPatternAttribution.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Willink Transformations and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * E.D.Willink - initial API and implementation
- *******************************************************************************/
-package org.eclipse.qvtd.pivot.qvtimperative.attributes;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.ocl.pivot.internal.scoping.AbstractAttribution;
-import org.eclipse.ocl.pivot.internal.scoping.EnvironmentView;
-import org.eclipse.ocl.pivot.internal.scoping.ScopeView;
-import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
-
-public class BottomPatternAttribution extends AbstractAttribution
-{
- public static final BottomPatternAttribution INSTANCE = new BottomPatternAttribution();
-
- @Override
- public ScopeView computeLookup(@NonNull EObject target, @NonNull EnvironmentView environmentView, @NonNull ScopeView scopeView) {
- Area area = ((BottomPattern)target).getArea();
- if (area instanceof Mapping) {
- Mapping mapping = (Mapping)area;;
- Transformation transformation = QVTbaseUtil.getContainingTransformation(mapping);
- if (transformation != null) {
- for (TypedModel typedModel : transformation.getModelParameter()) {
- for (org.eclipse.ocl.pivot.Package pPackage : typedModel.getUsedPackage()) {
- environmentView.addNamedElement(pPackage);
- environmentView.addNamedElements(pPackage.getOwnedClasses());
- }
- }
- }
- QVTimperativeEnvironmentUtil.addMiddleBottomVariables(environmentView, mapping);
- }
- else {
- ImperativeDomain domain = (ImperativeDomain)area;
- TypedModel typedModel = domain.getTypedModel();
- Mapping mapping = (Mapping) domain.getRule();
- QVTimperativeEnvironmentUtil.addSideBottomVariables(environmentView, mapping, typedModel);
- }
- return scopeView.getParent();
- }
-}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/GuardPatternAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/GuardPatternAttribution.java
deleted file mode 100644
index 08103f872..000000000
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/GuardPatternAttribution.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2014 Willink Transformations and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * E.D.Willink - initial API and implementation
- *******************************************************************************/
-package org.eclipse.qvtd.pivot.qvtimperative.attributes;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.ocl.pivot.internal.scoping.AbstractAttribution;
-import org.eclipse.ocl.pivot.internal.scoping.EnvironmentView;
-import org.eclipse.ocl.pivot.internal.scoping.ScopeView;
-import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
-
-public class GuardPatternAttribution extends AbstractAttribution
-{
- public static final GuardPatternAttribution INSTANCE = new GuardPatternAttribution();
-
- @Override
- public ScopeView computeLookup(@NonNull EObject target, @NonNull EnvironmentView environmentView, @NonNull ScopeView scopeView) {
- Area area = ((GuardPattern)target).getArea();
- if (area instanceof Mapping) {
- Mapping mapping = (Mapping)area;;
- Transformation transformation = QVTbaseUtil.getContainingTransformation(mapping);
- if (transformation != null) {
- for (TypedModel typedModel : transformation.getModelParameter()) {
- for (org.eclipse.ocl.pivot.Package pPackage : typedModel.getUsedPackage()) {
- environmentView.addNamedElement(pPackage);
- environmentView.addNamedElements(pPackage.getOwnedClasses());
- }
- }
- }
- QVTimperativeEnvironmentUtil.addMiddleGuardVariables(environmentView, mapping);
- }
- else {
- ImperativeDomain domain = (ImperativeDomain)area;
- TypedModel typedModel = domain.getTypedModel();
- Mapping mapping = (Mapping) domain.getRule();
- QVTimperativeEnvironmentUtil.addSideGuardVariables(environmentView, mapping, typedModel);
- }
- return scopeView.getParent();
- }
-}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java
index 9c805bccb..6a7e3920c 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java
@@ -11,6 +11,7 @@
package org.eclipse.qvtd.pivot.qvtimperative.attributes;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.ocl.pivot.internal.scoping.AbstractAttribution;
import org.eclipse.ocl.pivot.internal.scoping.EnvironmentView;
@@ -19,9 +20,9 @@ import org.eclipse.qvtd.pivot.qvtbase.QVTbasePackage;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
-import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
public class MappingAttribution extends AbstractAttribution
@@ -35,13 +36,43 @@ public class MappingAttribution extends AbstractAttribution
return null;
}
Mapping mapping = (Mapping)target;
- if (scopeView.getContainmentFeature() == QVTimperativePackage.Literals.MAPPING__OWNED_STATEMENTS) {
+ EStructuralFeature containmentFeature = scopeView.getContainmentFeature();
+ /* if ((containmentFeature == QVTimperativePackage.Literals.MAPPING__GUARD_PREDICATES)
+ || (containmentFeature == QVTimperativePackage.Literals.MAPPING__OWNED_PREDICATE_VARIABLES)
+ || (containmentFeature == QVTimperativePackage.Literals.MAPPING__OWNED_LOCAL_VARIABLES)) {
EObject child = scopeView.getChild();
for (Statement asStatement : mapping.getOwnedStatements()) {
if (asStatement == child) {
break;
}
- if (asStatement instanceof NewStatement) {
+ if (asStatement instanceof VariableStatement) {
+ environmentView.addNamedElement(asStatement);
+ }
+ }
+ QVTimperativeEnvironmentUtil.addMiddleGuardVariables(environmentView, mapping);
+ QVTimperativeEnvironmentUtil.addSideGuardVariables(environmentView, mapping, null);
+ QVTimperativeEnvironmentUtil.addMiddleBottomVariables(environmentView, mapping);
+ QVTimperativeEnvironmentUtil.addSideBottomVariables(environmentView, mapping, null);
+ Transformation transformation = QVTimperativeUtil.getContainingTransformation(mapping);
+ if (transformation != null) {
+ for (TypedModel typedModel : transformation.getModelParameter()) {
+ for (org.eclipse.ocl.pivot.Package usedPackage : typedModel.getUsedPackage()) {
+ if (usedPackage != null) {
+ environmentView.addNamedElement(usedPackage);
+ environmentView.addAllTypes(usedPackage);
+ }
+ }
+ }
+ }
+
+ }
+ else*/ if (containmentFeature == QVTimperativePackage.Literals.MAPPING__OWNED_STATEMENTS) {
+ EObject child = scopeView.getChild();
+ for (Statement asStatement : mapping.getOwnedStatements()) {
+ if (asStatement == child) {
+ break;
+ }
+ if (asStatement instanceof VariableStatement) {
environmentView.addNamedElement(asStatement);
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java
index 4ad41c6fb..1fc4da938 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingCallBindingAttribution.java
@@ -31,7 +31,7 @@ public class MappingCallBindingAttribution extends EmptyAttribution
MappingCall mappingCall = mappingCallBinding.getMappingCall();
if (mappingCall != null) {
EStructuralFeature targetReference = environmentView.getReference();
- if (targetReference.getEType() == PivotPackage.Literals.VARIABLE) {
+ if (targetReference.getEType() == PivotPackage.Literals.VARIABLE_DECLARATION) {
Mapping referredMapping = mappingCall.getReferredMapping();
if (referredMapping != null) {
QVTimperativeEnvironmentUtil.addMiddleGuardVariables(environmentView, referredMapping);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeBottomPatternAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeBottomPatternAttribution.java
deleted file mode 100644
index 53062c796..000000000
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeBottomPatternAttribution.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2016 Willink Transformations and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * E.D.Willink - initial API and implementation
- *******************************************************************************/
-package org.eclipse.qvtd.pivot.qvtimperative.attributes;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.ocl.pivot.internal.scoping.AbstractAttribution;
-import org.eclipse.ocl.pivot.internal.scoping.EnvironmentView;
-import org.eclipse.ocl.pivot.internal.scoping.ScopeView;
-import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
-
-public class QVTimperativeBottomPatternAttribution extends AbstractAttribution
-{
- public static final QVTimperativeBottomPatternAttribution INSTANCE = new QVTimperativeBottomPatternAttribution();
-
- @Override
- public ScopeView computeLookup(@NonNull EObject target, @NonNull EnvironmentView environmentView, @NonNull ScopeView scopeView) {
- Area area = ((BottomPattern)target).getArea();
- Mapping mapping;
- if (area instanceof Mapping) {
- mapping = (Mapping)area;;
- }
- else {
- ImperativeDomain domain = (ImperativeDomain)area;
- mapping = (Mapping) domain.getRule();
- }
- QVTimperativeEnvironmentUtil.addMiddleBottomVariables(environmentView, mapping);
- if (!environmentView.hasFinalResult() && (area instanceof Mapping)) {
- Transformation transformation = QVTbaseUtil.getContainingTransformation(mapping);
- if (transformation != null) {
- for (TypedModel typedModel : transformation.getModelParameter()) {
- for (org.eclipse.ocl.pivot.Package pPackage : typedModel.getUsedPackage()) {
- environmentView.addNamedElement(pPackage);
- environmentView.addNamedElements(pPackage.getOwnedClasses());
- }
- }
- }
- }
- return scopeView.getParent();
- }
-}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeEnvironmentUtil.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeEnvironmentUtil.java
index 4fc0fd539..30011034d 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeEnvironmentUtil.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeEnvironmentUtil.java
@@ -15,12 +15,10 @@ import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.internal.scoping.EnvironmentView;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
-import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
public class QVTimperativeEnvironmentUtil
{
@@ -38,38 +36,25 @@ public class QVTimperativeEnvironmentUtil
private static void addMiddleVariables(@NonNull EnvironmentView environmentView, @NonNull Mapping mapping, boolean bottomToo) {
if (bottomToo) {
- BottomPattern bottomPattern = mapping.getBottomPattern();
- if (bottomPattern != null) {
- environmentView.addNamedElements(bottomPattern.getVariable());
- }
for (Statement asStatement : mapping.getOwnedStatements()) {
- if (asStatement instanceof NewStatement) {
+ if (asStatement instanceof VariableStatement) {
environmentView.addNamedElement(asStatement);
}
}
}
- GuardPattern guardPattern = mapping.getGuardPattern();
- if (guardPattern != null) {
- environmentView.addNamedElements(guardPattern.getVariable());
- }
+ environmentView.addNamedElements(mapping.getOwnedGuardVariables());
+ environmentView.addNamedElements(mapping.getInoutVariables());
for (Domain aDomain : mapping.getDomain()) {
if (aDomain instanceof ImperativeDomain) {
ImperativeDomain domain = (ImperativeDomain)aDomain;
if (bottomToo) {
- BottomPattern bottomPattern = domain.getBottomPattern();
- if (bottomPattern != null) {
- environmentView.addNamedElements(bottomPattern.getVariable());
- }
for (Statement asStatement : mapping.getOwnedStatements()) {
- if (asStatement instanceof NewStatement) {
+ if (asStatement instanceof VariableStatement) {
environmentView.addNamedElement(asStatement);
}
}
}
- guardPattern = domain.getGuardPattern();
- if (guardPattern != null) {
- environmentView.addNamedElements(guardPattern.getVariable());
- }
+ environmentView.addNamedElements(domain.getOwnedGuardVariables());
}
}
}
@@ -92,20 +77,14 @@ public class QVTimperativeEnvironmentUtil
ImperativeDomain domain = (ImperativeDomain)aDomain;
if ((typedModel == null) || (domain.getTypedModel() == typedModel)) {
if (bottomToo) {
- BottomPattern bottomPattern = domain.getBottomPattern();
- if (bottomPattern != null) {
- environmentView.addNamedElements(bottomPattern.getVariable());
- }
for (Statement asStatement : mapping.getOwnedStatements()) {
- if (asStatement instanceof NewStatement) {
+ if (asStatement instanceof VariableStatement) {
environmentView.addNamedElement(asStatement);
}
}
}
- GuardPattern guardPattern = domain.getGuardPattern();
- if (guardPattern != null) {
- environmentView.addNamedElements(guardPattern.getVariable());
- }
+ environmentView.addNamedElements(domain.getOwnedGuardVariables());
+ environmentView.addNamedElements(mapping.getInoutVariables());
break;
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeGuardPatternAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeGuardPatternAttribution.java
deleted file mode 100644
index 187a43441..000000000
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/QVTimperativeGuardPatternAttribution.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2015 Willink Transformations and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * E.D.Willink - initial API and implementation
- *******************************************************************************/
-package org.eclipse.qvtd.pivot.qvtimperative.attributes;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.ocl.pivot.internal.scoping.AbstractAttribution;
-import org.eclipse.ocl.pivot.internal.scoping.EnvironmentView;
-import org.eclipse.ocl.pivot.internal.scoping.ScopeView;
-import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
-
-public class QVTimperativeGuardPatternAttribution extends AbstractAttribution
-{
- public static final QVTimperativeGuardPatternAttribution INSTANCE = new QVTimperativeGuardPatternAttribution();
-
- @Override
- public ScopeView computeLookup(@NonNull EObject target, @NonNull EnvironmentView environmentView, @NonNull ScopeView scopeView) {
- Area area = ((GuardPattern)target).getArea();
- Mapping mapping;
- if (area instanceof Mapping) {
- mapping = (Mapping)area;;
- Transformation transformation = QVTbaseUtil.getContainingTransformation(mapping);
- if (transformation != null) {
- for (TypedModel typedModel : transformation.getModelParameter()) {
- for (org.eclipse.ocl.pivot.Package pPackage : typedModel.getUsedPackage()) {
- environmentView.addNamedElement(pPackage);
- environmentView.addNamedElements(pPackage.getOwnedClasses());
- }
- }
- }
- }
- else {
- ImperativeDomain domain = (ImperativeDomain)area;
- mapping = (Mapping) domain.getRule();
- }
- QVTimperativeEnvironmentUtil.addMiddleGuardVariables(environmentView, mapping);
- return scopeView.getParent();
- }
-}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/SetStatementAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/SetStatementAttribution.java
index 93e4dca10..25c860853 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/SetStatementAttribution.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/SetStatementAttribution.java
@@ -26,7 +26,7 @@ public class SetStatementAttribution extends EmptyAttribution
public ScopeView computeLookup(@NonNull EObject target, @NonNull EnvironmentView environmentView, @NonNull ScopeView scopeView) {
SetStatement asSetStatement = (SetStatement)target;
if (environmentView.getRequiredType() == PivotPackage.Literals.PROPERTY) { // FIXME should be detecting ancestor
- environmentView.addElementsOfScope(asSetStatement.getSlotExpression().getType(), scopeView);
+ environmentView.addElementsOfScope(asSetStatement.getTargetVariable().getType(), scopeView);
return null;
}
else {
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/BasicQVTiExecutor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/BasicQVTiExecutor.java
index 00ae2d915..e026c84ec 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/BasicQVTiExecutor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/BasicQVTiExecutor.java
@@ -34,38 +34,29 @@ import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.Type;
import org.eclipse.ocl.pivot.TypedElement;
import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.evaluation.EvaluationEnvironment;
import org.eclipse.ocl.pivot.evaluation.EvaluationVisitor;
-import org.eclipse.ocl.pivot.ids.CollectionTypeId;
import org.eclipse.ocl.pivot.internal.complete.StandardLibraryInternal;
import org.eclipse.ocl.pivot.internal.evaluation.AbstractExecutor;
import org.eclipse.ocl.pivot.internal.messages.PivotMessagesInternal;
import org.eclipse.ocl.pivot.labels.ILabelGenerator;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.NameUtil;
-import org.eclipse.ocl.pivot.utilities.ValueUtil;
-import org.eclipse.ocl.pivot.values.CollectionValue;
import org.eclipse.ocl.pivot.values.InvalidValueException;
import org.eclipse.ocl.pivot.values.NullValue;
-import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Function;
-import org.eclipse.qvtd.pivot.qvtbase.Predicate;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer;
import org.eclipse.qvtd.runtime.evaluation.InvocationFailedException;
@@ -138,111 +129,6 @@ public class BasicQVTiExecutor extends AbstractExecutor implements QVTiExecutor
super.dispose();
}
- protected void doCommits(@NonNull Mapping mapping, @NonNull EvaluationVisitor undecoratedVisitor) {
- //
- // property and connection assignments
- //
- BottomPattern middleBottomPattern = mapping.getBottomPattern();
- for (Assignment assignment : middleBottomPattern.getAssignment()) {
- if (!(assignment instanceof VariableAssignment)) {
- assignment.accept(undecoratedVisitor);
- }
- }
- }
-
- protected boolean doPredicatesAndEvaluations(@NonNull Mapping mapping, @NonNull EvaluationVisitor undecoratedVisitor) {
- //
- // middle guard predicates
- //
- GuardPattern middleGuardPattern = mapping.getGuardPattern();
- // assert middleGuardPattern.getVariable().isEmpty(); middle guards are connection variables
- for (@NonNull Predicate predicate : ClassUtil.nullFree(middleGuardPattern.getPredicate())) {
- // If the predicate is not true, the binding is not valid
- Object result = predicate.accept(undecoratedVisitor);
- if (result != Boolean.TRUE) {
- return false;
- }
- }
- for (@NonNull Domain domain : ClassUtil.nullFree(mapping.getDomain())) {
- if (!domain.isIsEnforceable()) {
- ImperativeDomain checkableDomain = (ImperativeDomain)domain;
- GuardPattern checkableGuardPattern = checkableDomain.getGuardPattern();
- assert checkableGuardPattern.getPredicate().isEmpty();
- BottomPattern checkableBottomPattern = checkableDomain.getBottomPattern();
- assert checkableBottomPattern.getAssignment().isEmpty();
- assert checkableBottomPattern.getPredicate().isEmpty();
- // assert checkableBottomPattern.getVariable().isEmpty();
- for (@NonNull Variable rVar : ClassUtil.nullFree(checkableBottomPattern.getVariable())) {
- OCLExpression ownedInit = rVar.getOwnedInit();
- assert ownedInit == null;
- }
- }
- else {
- ImperativeDomain enforceableDomain = (ImperativeDomain)domain;
- GuardPattern enforceableGuardPattern = enforceableDomain.getGuardPattern();
- assert enforceableGuardPattern.getPredicate().isEmpty();
- BottomPattern enforceableBottomPattern = enforceableDomain.getBottomPattern();
- assert enforceableBottomPattern.getAssignment().isEmpty();
- assert enforceableBottomPattern.getPredicate().isEmpty();
- for (@NonNull Variable rVar : ClassUtil.nullFree(enforceableBottomPattern.getVariable())) {
- OCLExpression ownedInit = rVar.getOwnedInit();
- if (ownedInit != null) {
- Object initValue = ownedInit.accept(undecoratedVisitor);
- replace(rVar, initValue, true);
- }
- }
- }
- }
- BottomPattern middleBottomPattern = mapping.getBottomPattern();
- //
- // variable declarations/initializations
- //
- for (@NonNull Variable rVar : ClassUtil.nullFree(middleBottomPattern.getVariable())) {
- if (rVar instanceof ConnectionVariable) {
- CollectionValue.Accumulator accumulator = ValueUtil.createCollectionAccumulatorValue((CollectionTypeId) rVar.getTypeId());
- OCLExpression ownedInit = rVar.getOwnedInit();
- if (ownedInit != null) {
- Object initValue = ownedInit.accept(undecoratedVisitor);
- accumulator = ValueUtil.createCollectionAccumulatorValue((CollectionTypeId) ownedInit.getTypeId());
- if (initValue != null) {
- for (Object value : (Iterable<?>)initValue) {
- accumulator.add(value);
- }
- }
- }
- else {
- accumulator = ValueUtil.createCollectionAccumulatorValue((CollectionTypeId) rVar.getTypeId());
- }
- replace(rVar, accumulator, false);
- }
- else {
- OCLExpression ownedInit = rVar.getOwnedInit();
- if (ownedInit != null) {
- Object initValue = ownedInit.accept(undecoratedVisitor);
- replace(rVar, initValue, false);
- }
- }
- }
- //
- // variable assignments
- //
- for (@NonNull Assignment assignment : ClassUtil.nullFree(middleBottomPattern.getAssignment())) {
- if (assignment instanceof VariableAssignment) {
- assignment.accept(undecoratedVisitor);
- }
- }
- //
- // middle bottom predicates
- //
- for (@NonNull Predicate predicate : ClassUtil.nullFree(middleBottomPattern.getPredicate())) {
- // If the predicate is not true, the binding is not valid
- Object result = predicate.accept(undecoratedVisitor);
- if (result != Boolean.TRUE) {
- return false;
- }
- }
- return true;
- }
@Override
public Boolean execute() {
@@ -358,7 +244,7 @@ public class BasicQVTiExecutor extends AbstractExecutor implements QVTiExecutor
try {
int index = 0;
for (MappingCallBinding binding : mappingCall.getBinding()) {
- Variable boundVariable = ClassUtil.nonNullState(binding.getBoundVariable());
+ VariableDeclaration boundVariable = ClassUtil.nonNullState(binding.getBoundVariable());
replace(boundVariable, boundValues[index++], !(boundVariable instanceof ConnectionVariable));
}
calledMapping.accept(undecoratedVisitor);
@@ -373,35 +259,24 @@ public class BasicQVTiExecutor extends AbstractExecutor implements QVTiExecutor
@Override
public @Nullable Object internalExecuteMapping(@NonNull Mapping mapping, @NonNull EvaluationVisitor undecoratedVisitor) {
try {
- //
- // Check the predicates
- //
- if (!doPredicatesAndEvaluations(mapping, undecoratedVisitor)) {
- return false;
+ for (Statement statement : mapping.getOwnedStatements()) {
+ Object result = statement.accept(undecoratedVisitor);
+ if (result != Boolean.TRUE) {
+ return false;
+ }
}
+ return true;
}
catch (InvocationFailedException e) {
throw e;
}
catch (Throwable e) {
- // Mapping failure are just mappings that never happened.
+ // Mapping failures are just mappings that never happened.
if (debugExceptions) {
AbstractTransformer.EXCEPTIONS.println("Execution failure in " + mapping.getName() + " : " + e);
}
return false;
}
- //
- // Perform the instance model addition and property assignment only after all expressions have been evaluated
- // possibly throwing a not-ready exception that bypasses premature commits.
- //
- doCommits(mapping, undecoratedVisitor);
- //
- // Invoke any corrolaries
- //
- for (Statement statement : mapping.getOwnedStatements()) {
- statement.accept(undecoratedVisitor);
- }
- return true;
}
@Override
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractTracingEvaluationVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractTracingEvaluationVisitor.java
deleted file mode 100644
index ebaa45d0e..000000000
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractTracingEvaluationVisitor.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2016 The University of York, Willink Transformations and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Horacio Hoyos - initial API and implementation
- ******************************************************************************/
-package org.eclipse.qvtd.pivot.qvtimperative.evaluation;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.log4j.FileAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.ocl.pivot.Element;
-import org.eclipse.ocl.pivot.OCLExpression;
-import org.eclipse.ocl.pivot.Variable;
-import org.eclipse.ocl.pivot.internal.evaluation.BasicEvaluationVisitor;
-import org.eclipse.ocl.pivot.internal.prettyprint.PrettyPrinter;
-import org.eclipse.ocl.pivot.values.InvalidValueException;
-import org.eclipse.qvtd.pivot.qvtbase.Predicate;
-import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
-import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
-import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
-import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
-import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
-import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
-
-/**
- * The Class QVTiTracingEvaluationVisitor is a decorator visitor that prints
- * AST, variable values and other information useful for debugging.
- *
- * @author Horacio Hoyos
- */
-public abstract class QVTiAbstractTracingEvaluationVisitor extends QVTiEvaluationVisitorDecorator
-{
-
- protected static Logger logger = Logger.getLogger("QVTiTrace");
-
- /** The Constant DEFAULT_INDENT. */
- protected static final String DEFAULT_INDENT = " ";
-
- /** The verbose level low. */
- static int VERBOSE_LEVEL_LOW = 0;
-
- /** The verbose level med. */
- static int VERBOSE_LEVEL_MED = 1;
-
- /** The verbose level high. */
- static int VERBOSE_LEVEL_HIGH = 2;
-
- /** The verbose level. */
- protected static int verboseLevel = VERBOSE_LEVEL_LOW;
-
- /** The indent level. */
- private int indentLevel = 0;
-
-
- /**
- * Instantiates a new QVTi tracing evaluation visitor.
- *
- * @param decorated the decorated
- */
- public QVTiAbstractTracingEvaluationVisitor(@NonNull IQVTiEvaluationVisitor decorated) {
-
- this(decorated, 0);
- if (logger.getAppender("QVTTrace") == null) {
- FileAppender appender = new FileAppender();
- // configure the appender here, with file location, etc
- appender.setFile("QVTTrace.log");
- appender.setName("QVTTrace");
- appender.setLayout(new PatternLayout(PatternLayout.DEFAULT_CONVERSION_PATTERN));
- appender.setAppend(false);
- appender.activateOptions();
- logger.addAppender(appender);
- }
- logger.setAdditivity(false);
- logger.setLevel(Level.DEBUG);
- }
-
- /**
- * Instantiates a new QVTi tracing evaluation visitor.
- *
- * @param decorated the decorated
- * @param indentLevel the indent level
- */
- protected QVTiAbstractTracingEvaluationVisitor(@NonNull IQVTiEvaluationVisitor decorated, int indentLevel) {
-
- super(decorated);
- this.indentLevel = indentLevel;
- }
-
-
- /**
- * Gets the verbose level.
- *
- * @return the verbose level
- */
- public int getVerboseLevel() {
- return verboseLevel;
- }
-
-
- /**
- * Sets the verbose level.
- *
- * @param verboseLevel the new verbose level
- */
- public void setVerboseLevel(int verboseLevel) {
- QVTiAbstractTracingEvaluationVisitor.verboseLevel = verboseLevel;
- }
-
- /**
- * Gets the indent.
- *
- * @return the indent
- */
- protected @NonNull String getIndent() {
-
- StringBuilder outputBuffer = new StringBuilder(indentLevel);
- for (int i = 0; i < indentLevel; i++){
- outputBuffer.append(DEFAULT_INDENT);
- }
- return outputBuffer.toString();
- }
-
- // @Override
- // public @NonNull Pattern getRegexPattern(@NonNull String regex) {
- // return delegate.getRegexPattern(regex);
- // }
-
- /**
- * Safe print.
- *
- * @param element the element
- * @return the string
- */
- protected @NonNull String safePrint(@Nullable Element element) {
- return element != null ? PrettyPrinter.print(element) : "null";
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitAssignment(org.eclipse.qvtd.pivot.qvtcorebase.Assignment)
- */
- @Override
- public @Nullable Object visitAssignment(@NonNull Assignment assignment) {
-
- indentLevel++;
- try {
- Object value = safeVisit(assignment.getValue());
- // Unbox to asign to ecore type
- value = delegate.getEnvironmentFactory().getIdResolver().unboxedValueOf(value);
- logger.info(getIndent() + "VisitAssignment " + prettyPrint(assignment.getESObject())
- + " := " + prettyPrint(value));
- } catch (InvalidValueException ex) {
- logger.info(getIndent() + "VisitAssignment " + prettyPrint(assignment.getESObject())
- + " := Invalid expression" );
- }
- Object result = delegate.visitAssignment(assignment);
- indentLevel--;
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitGuardPattern(org.eclipse.qvtd.pivot.qvtcorebase.GuardPattern)
- */
- @Override
- public @Nullable Object visitGuardPattern(@NonNull GuardPattern guardPattern) {
-
- if (guardPattern.getArea() instanceof ImperativeDomain) {
- logger.info(getIndent() + "Visiting CoreDomain GuardPattern");
- }
- if (guardPattern.getArea() instanceof Mapping) {
- logger.info(getIndent() + "Visiting Mapping GuardPattern");
- }
- indentLevel++;
- // Some variables are assigned after visit
- List<Variable> nullVars = new ArrayList<Variable>();
- for (@SuppressWarnings("null")@NonNull Variable v : guardPattern.getVariable()) {
- if (delegate.getEvaluationEnvironment().getValueOf(v) == null) {
- nullVars.add(v);
- OCLExpression initExp = v.getOwnedInit();
- if (initExp != null) {
- indentLevel++;
- logger.info(getIndent() + "Variable " + v.getName() + " init value:" + safePrint(initExp));
- indentLevel--;
- }
- } else {
- logger.info(getIndent() + "Variable " + v.getName() + ": " + prettyPrint(delegate.getEvaluationEnvironment().getValueOf(v)));
- }
- }
- Object result = delegate.visitGuardPattern(guardPattern);
- if (result == Boolean.TRUE) {
- for (Variable v : nullVars) {
- logger.info(getIndent() + "Variable " + v.getName() + ": " + prettyPrint(delegate.getEvaluationEnvironment().getValueOf(v)));
- }
- }
- if (guardPattern.getPredicate().size() == 0) {
- logger.info(getIndent() + "GuardPattern has no predicates.");
- } else {
- logger.info(getIndent() + "GuardPattern result: " + result);
- }
- indentLevel--;
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitCoreDomain(org.eclipse.qvtd.pivot.qvtcorebase.CoreDomain)
- */
- @Override
- public @Nullable Object visitImperativeDomain(@NonNull ImperativeDomain coreDomain) {
- logger.info(getIndent() + "ImperativeDomain " + coreDomain.getName());
- indentLevel++;
- Object result = delegate.visitImperativeDomain(coreDomain);
- indentLevel--;
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitImperativeModel(org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel)
- */
- @Override
- public @Nullable Object visitImperativeModel(@NonNull ImperativeModel imperativeModel) {
-
- return delegate.visitImperativeModel(imperativeModel);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ocl.pivot.util.AbstractExtendingVisitor#visitIteratorExp(org.eclipse.ocl.pivot.IteratorExp)
- */
- @Override
- public @Nullable Object visitIteratorExp(org.eclipse.ocl.pivot.@NonNull IteratorExp object) {
-
- return delegate.visitIteratorExp(object);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitMapping(org.eclipse.qvtd.pivot.qvtimperative.Mapping)
- */
- @Override
- public @Nullable Object visitMapping(@NonNull Mapping mapping) {
-
- logger.info(getIndent() + "Mapping " + mapping.getName());
- indentLevel++;
- Object result = delegate.visitMapping(mapping);
- indentLevel--;
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitMappingCall(org.eclipse.qvtd.pivot.qvtimperative.MappingCall)
- */
- @Override
- public @Nullable Object visitMappingCall(@NonNull MappingCall mappingCall) {
- logger.info(getIndent() + "Visiting MappingCall, calling: " + mappingCall.getReferredMapping().getName());
- indentLevel++;
- Object result = delegate.visitMappingCall(mappingCall);
- indentLevel--;
- return result;
- }
-
- @Override
- public @Nullable Object visitMappingLoop(@NonNull MappingLoop mappingLoop) {
- logger.info(getIndent() + "Visiting MappingLoop, binding: " + mappingLoop.getOwnedIterators().get(0).getName());
- indentLevel++;
- Object result = delegate.visitMappingLoop(mappingLoop);
- indentLevel--;
- return result;
- }
-
- @Override
- public @Nullable Object visitMappingStatement(@NonNull MappingStatement mappingStatement) {
- return visitStatement(mappingStatement);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitPropertyAssignment(org.eclipse.qvtd.pivot.qvtcorebase.PropertyAssignment)
- */
- @Override
- public @Nullable Object visitSetStatement(@NonNull SetStatement setStatement) {
-
- try {
- Object value = safeVisit(setStatement.getValue());
- // Unbox to asign to ecore type
- value = delegate.getEnvironmentFactory().getIdResolver().unboxedValueOf(value);
- logger.info(getIndent() + "VisitSetStatement " + setStatement.getSlotExpression()
- + "." + QVTimperativeUtil.getTargetProperty(setStatement).getName() + " = " + prettyPrint(value));
- } catch (InvalidValueException ex) {
- logger.info(getIndent() + "VisitSetStatement " + setStatement.getSlotExpression()
- + "." + QVTimperativeUtil.getTargetProperty(setStatement).getName() + " = InvalidValueException" );
- }
- //indentLevel++;
- Object result = delegate.visitSetStatement(setStatement);
- //indentLevel--;
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitTransformation(org.eclipse.qvtd.pivot.qvtbase.Transformation)
- */
- @Override
- public @Nullable Object visitTransformation(@NonNull Transformation transformation) {
- logger.info("---- Transformation " + transformation.getName() + " ----");
- indentLevel++;
- Object result = delegate.visitTransformation(transformation);
- indentLevel--;
- logger.info("---- Transformation End ----");
- return result;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitPredicate(org.eclipse.qvtd.pivot.qvtbase.Predicate)
- */
- @Override
- public @Nullable Object visitPredicate(@NonNull Predicate predicate) {
-
- OCLExpression exp = predicate.getConditionExpression();
- Object value = safeVisit(exp);
- logger.info(getIndent() + "Predicate " + safePrint(exp) + " is " + String.valueOf(value));
- return delegate.visitPredicate(predicate);
-
- }
-
- @Override
- public @Nullable Object visitStatement(@NonNull Statement statement) {
- return visiting(statement);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitVariableAssignment(org.eclipse.qvtd.pivot.qvtcorebase.VariableAssignment)
- */
- @Override
- public @Nullable Object visitVariableAssignment(@NonNull VariableAssignment variableAssignment) {
- Variable v = variableAssignment.getTargetVariable();
- logger.info(getIndent() + "VisitVariableAssignment " + v
- + ": " + ((BasicEvaluationVisitor)delegate).safeVisit(variableAssignment.getValue()));
- indentLevel++;
- Object result = delegate.visitVariableAssignment(variableAssignment);
- indentLevel--;
- return result;
- }
-
-
- @Override
- public @Nullable Object visitVariablePredicate(@NonNull VariablePredicate variablePredicate) {
- Variable v = variablePredicate.getTargetVariable();
- logger.info(getIndent() + "VisitVariablePredicate " + v
- + ": " + ((BasicEvaluationVisitor)delegate).safeVisit(variablePredicate.getConditionExpression()));
- indentLevel++;
- Object result = delegate.visitVariablePredicate(variablePredicate);
- indentLevel--;
- return result;
- }
-
- /**
- * Pretty print Objects. EObjects are printed at 1 level depth (i.e. no
- * navigation through associations). Other objects are printed as Strings
- *
- * @param object the object
- * @return the string
- */
- protected String prettyPrint(Object object) {
-
- List<String> lines = new ArrayList<String>();
- if (object instanceof EObject) {
- EObject eo = (EObject) object;
- EClass eClass = eo.eClass();
- lines.add(eClass.getName() + " [" + Integer.toHexString(eo.hashCode()) + "] {"); //
- indentLevel++;
- for (EStructuralFeature feature : eClass.getEAllStructuralFeatures()) {
- Object value = eo.eGet(feature);
- String line = getIndent() + feature.getName() + " = ";
- if (value instanceof Collection<?>) {
- int size = ((Collection<?>)value).size();
- if (size > 0) {
- line += "[" + ((EObject)((Iterable<@NonNull ?>) value).iterator().next()).eClass().getName() + "] x " + size;
- } else {
- line += "[ ]";
- }
- } else if (value instanceof EObject) {
- eClass = ((EObject) value).eClass();
- line += eClass.getName() + " [" + Integer.toHexString(value.hashCode()) + "]";
- } else {
- if (value == null) {
- line += "[ null ]";
- } else {
- line += String.valueOf(value);
- }
- }
- lines.add(line);
- }
- lines.add(getIndent() + "}");
- indentLevel--;
- StringBuilder sb = new StringBuilder();
- for (String line : lines) {
- sb.append(line).append('\n');
- }
- sb.delete(sb.length()-1, sb.length());
- return sb.toString();
- } else {
- return String.valueOf(object);
- }
- }
-
- protected String prettyPrintUnident(Object object) {
- List<String> lines = new ArrayList<String>();
- if (object instanceof EObject) {
- EObject eo = (EObject) object;
- EClass eClass = eo.eClass();
- lines.add(eClass.getName() + " [" + Integer.toHexString(eo.hashCode()) + "] {"); //
- indentLevel++;
- for (EStructuralFeature feature : eClass.getEAllStructuralFeatures()) {
- Object value = eo.eGet(feature);
- String line = DEFAULT_INDENT + feature.getName() + " = ";
- if (value instanceof Collection<?>) {
- int size = ((Collection<?>)value).size();
- if (size > 0) {
- line += "[" + ((EObject)((Iterable<@NonNull ?>) value).iterator().next()).eClass().getName() + "] x " + size;
- } else {
- line += "[ ]";
- }
- } else if (value instanceof EObject) {
- eClass = ((EObject) value).eClass();
- line += eClass.getName() + " [" + Integer.toHexString(value.hashCode()) + "]";
- } else {
- if (value == null) {
- line += "[ null ]";
- } else {
- line += String.valueOf(value);
- }
- }
- lines.add(line);
- }
- lines.add(DEFAULT_INDENT + "}");
- indentLevel--;
- StringBuilder sb = new StringBuilder();
- for (String line : lines) {
- sb.append(line).append('\n');
- }
- sb.delete(sb.length()-1, sb.length());
- return sb.toString();
- } else {
- return String.valueOf(object);
- }
-
-
- }
-}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationEnvironment.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationEnvironment.java
index 4193644d9..bbd866d70 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationEnvironment.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationEnvironment.java
@@ -11,11 +11,8 @@
package org.eclipse.qvtd.pivot.qvtimperative.evaluation;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.evaluation.EvaluationEnvironment;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
public interface QVTiEvaluationEnvironment extends EvaluationEnvironment.EvaluationEnvironmentExtension
{
@@ -23,5 +20,4 @@ public interface QVTiEvaluationEnvironment extends EvaluationEnvironment.Evaluat
@NonNull QVTiExecutor getExecutor();
@NonNull QVTiRootEvaluationEnvironment getRootEvaluationEnvironment();
@NonNull Transformation getTransformation();
- @Nullable DomainUsage getUsageFor(@NonNull Element element);
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java
index ab912e34d..854bb6771 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java
@@ -20,7 +20,8 @@ import org.eclipse.ocl.pivot.Import;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
+import org.eclipse.ocl.pivot.ids.CollectionTypeId;
import org.eclipse.ocl.pivot.internal.evaluation.BasicEvaluationVisitor;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.NameUtil;
@@ -28,6 +29,7 @@ import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.ocl.pivot.utilities.ValueUtil;
import org.eclipse.ocl.pivot.values.CollectionValue;
import org.eclipse.ocl.pivot.values.CollectionValue.Accumulator;
+import org.eclipse.ocl.pivot.values.InvalidValueException;
import org.eclipse.qvtd.pivot.qvtbase.BaseModel;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Function;
@@ -38,24 +40,24 @@ import org.eclipse.qvtd.pivot.qvtbase.Rule;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
import org.eclipse.qvtd.runtime.evaluation.InvocationFailedException;
@@ -102,30 +104,25 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
if (targetVariable != null) {
OCLExpression valueExpression = connectionStatement.getValue();
if (valueExpression != null) {
- return doConnectionAccumulation(targetVariable, valueExpression);
+ doConnectionAccumulation(targetVariable, valueExpression);
+ return true;
}
}
return null;
}
@Override
- public @Nullable Object visitAssignment(@NonNull Assignment object) {
- return visiting(object);
- }
-
- @Override
public @Nullable Object visitBaseModel(@NonNull BaseModel object) {
return visiting(object);
}
@Override
- public @Nullable Object visitBottomPattern(@NonNull BottomPattern object) {
- return visiting(object);
- }
-
- @Override
- public @Nullable Object visitBottomStatement(@NonNull BottomStatement object) {
- return visitStatement(object); // MappingStatement is abstract
+ public @Nullable Object visitCheckStatement(@NonNull CheckStatement predicate) {
+ // Each predicate has a conditionExpression that is an OCLExpression
+ OCLExpression exp = predicate.getConditionExpression();
+ // The predicated is visited with a nested environment
+ Object expResult = exp.accept(undecoratedVisitor);
+ return expResult;
}
@Override
@@ -149,7 +146,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
@Override
- public @Nullable Object visitGuardPattern(@NonNull GuardPattern object) {
+ public @Nullable Object visitGuardVariable(@NonNull GuardVariable object) {
return visiting(object);
}
@@ -167,12 +164,19 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
@Override
- public @Nullable Object visitImperativePattern(@NonNull ImperativePattern object) {
+ public @Nullable Object visitImport(@NonNull Import object) {
return visiting(object);
}
@Override
- public @Nullable Object visitImport(@NonNull Import object) {
+ public Object visitInConnectionVariable(@NonNull InConnectionVariable object) {
+ CollectionValue.Accumulator accumulator = ValueUtil.createCollectionAccumulatorValue((CollectionTypeId) object.getTypeId());
+ executor.replace(object, accumulator, false);
+ return true;
+ }
+
+ @Override
+ public @Nullable Object visitLoopVariable(@NonNull LoopVariable object) {
return visiting(object);
}
@@ -190,7 +194,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
@NonNull Object @NonNull [] boundValues = new @NonNull Object[mappingCall.getBinding().size()];
int index = 0;
for (MappingCallBinding binding : mappingCall.getBinding()) {
- Variable boundVariable = binding.getBoundVariable();
+ VariableDeclaration boundVariable = binding.getBoundVariable();
if (boundVariable == null) {
return null;
}
@@ -232,9 +236,9 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
public @Nullable Object visitMappingLoop(@NonNull MappingLoop mappingLoop) {
Object inValues = mappingLoop.getOwnedSource().accept(undecoratedVisitor);
if (inValues instanceof Iterable<?>) {
- List<Variable> iterators = mappingLoop.getOwnedIterators();
+ List<LoopVariable> iterators = mappingLoop.getOwnedIterators();
if (iterators.size() > 0) {
- Variable iterator = ClassUtil.nonNullState(iterators.get(0));
+ LoopVariable iterator = ClassUtil.nonNullState(iterators.get(0));
for (Object object : (Iterable<?>)inValues) {
((QVTiExecutor)context).replace(iterator, object, false);
for (@NonNull MappingStatement mappingStatement : ClassUtil.nullFree(mappingLoop.getOwnedMappingStatements())) {
@@ -259,7 +263,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
@Override
public @Nullable Object visitNewStatement(@NonNull NewStatement newStatement) {
- return executor.internalExecuteNewStatement(newStatement, undecoratedVisitor);
+ return executor.internalExecuteNewStatement(newStatement, undecoratedVisitor) != null;
}
/* @Override
@@ -285,6 +289,26 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
} */
@Override
+ public Object visitOutConnectionVariable(@NonNull OutConnectionVariable object) {
+ CollectionValue.Accumulator accumulator;
+ OCLExpression ownedInit = object.getOwnedInit();
+ if (ownedInit != null) {
+ Object initValue = ownedInit.accept(undecoratedVisitor);
+ accumulator = ValueUtil.createCollectionAccumulatorValue((CollectionTypeId) ownedInit.getTypeId());
+ if (initValue != null) {
+ for (Object value : (Iterable<?>)initValue) {
+ accumulator.add(value);
+ }
+ }
+ }
+ else {
+ accumulator = ValueUtil.createCollectionAccumulatorValue((CollectionTypeId) object.getTypeId());
+ }
+ executor.replace(object, accumulator, false);
+ return true;
+ }
+
+ @Override
public @Nullable Object visitPackage(org.eclipse.ocl.pivot.@NonNull Package pkge) {
return true;
}
@@ -295,12 +319,27 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
@Override
- public @Nullable Object visitPredicate(@NonNull Predicate predicate) {
- // Each predicate has a conditionExpression that is an OCLExpression
- OCLExpression exp = predicate.getConditionExpression();
- // The predicated is visited with a nested environment
- Object expResult = exp.accept(undecoratedVisitor);
- return expResult;
+ public @Nullable Object visitPredicate(@NonNull Predicate object) {
+ return visiting(object);
+ }
+
+ @Override
+ public @Nullable Object visitPredicateVariable(@NonNull PredicateVariable predicateVariable) {
+ OCLExpression ownedInit = predicateVariable.getOwnedInit();
+ if (ownedInit == null) {
+ return false;
+ }
+ Object initValue = ownedInit.accept(undecoratedVisitor);
+ if (predicateVariable.isIsChecked()) {
+ Type guardType = predicateVariable.getType();
+ Type valueType = idResolver.getDynamicTypeOf(initValue);
+ if ((guardType == null) || !valueType.conformsTo(standardLibrary, guardType)) {
+ // The initialisation fails, the guard is not met
+ return false;
+ }
+ }
+ executor.replace(predicateVariable, initValue, false);
+ return true;
}
@Override
@@ -310,7 +349,14 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
@Override
public @Nullable Object visitSetStatement(@NonNull SetStatement setStatement) {
- Object slotObject = setStatement.getSlotExpression().accept(undecoratedVisitor);
+ VariableDeclaration targetVariable = setStatement.getTargetVariable();
+ if (targetVariable == null) {
+ throw new InvalidValueException("Undefined variable", null, null, setStatement);
+ }
+ Object slotObject = context.getValueOf(targetVariable);
+ if (slotObject instanceof InvalidValueException) {
+ throw (InvalidValueException)slotObject;
+ }
if (slotObject instanceof EObject) {
Integer childKey = null;
try {
@@ -329,7 +375,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
}
executor.internalExecuteSetStatement(setStatement, slotObject, ecoreValue, childKey);
- return null;
+ return true;
}
catch (InvocationFailedException e) {
executor.internalExecuteSetStatement(setStatement, slotObject, e, childKey); // FIXME This leads to an AssertionError in PropertyImpl.initValue
@@ -360,42 +406,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
@Override
- public @Nullable Object visitVariableAssignment(@NonNull VariableAssignment variableAssignment) {
- Variable targetVariable = variableAssignment.getTargetVariable() ;
- if (targetVariable != null) {
- OCLExpression valueExpression = variableAssignment.getValue();
- if (valueExpression != null) {
- try {
- Object value = valueExpression.accept(undecoratedVisitor);
- ((QVTiExecutor)context).replace(targetVariable, value, true);
- return value;
- }
- catch (RuntimeException e) {
- ((QVTiExecutor)context).replace(targetVariable, e, false);
- throw e;
- }
- }
- }
- return null;
- }
-
- @Override
- public @Nullable Object visitVariablePredicate(@NonNull VariablePredicate variablePredicate) {
- // Each predicate has a conditionExpression that is an OCLExpression
- OCLExpression exp = variablePredicate.getConditionExpression();
- if (exp == null) {
- return false;
- }
- Object value = exp.accept(undecoratedVisitor);
- Variable variable = variablePredicate.getTargetVariable();
- Type guardType = variable.getType();
- Type valueType = idResolver.getDynamicTypeOf(value);
- if ((guardType != null) && valueType.conformsTo(standardLibrary, guardType)) {
- ((QVTiExecutor)context).replace(variable, value, false);
- } else {
- // The initialisation fails, the guard is not met
- return false;
- }
- return true;
+ public @Nullable Object visitVariableStatement(@NonNull VariableStatement object) {
+ return visitStatement(object);
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java
index 7faa34121..ec5446b43 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java
@@ -28,18 +28,13 @@ import org.eclipse.qvtd.pivot.qvtbase.Predicate;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
/**
* QVTcoreEvaluationVisitorImpl is the class for ...
@@ -206,72 +201,72 @@ implements IQVTiEvaluationVisitor {
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitAssignment(@NonNull Assignment assignment) {
- return delegate.visitAssignment(assignment);
+ public @Nullable Object visitBaseModel(@NonNull BaseModel baseModel) {
+ return delegate.visitBaseModel(baseModel);
}
/**
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitBaseModel(@NonNull BaseModel baseModel) {
- return delegate.visitBaseModel(baseModel);
+ public @Nullable Object visitDomain(@NonNull Domain domain) {
+ return delegate.visitDomain(domain);
}
/**
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitBottomPattern(@NonNull BottomPattern bottomPattern) {
- return delegate.visitBottomPattern(bottomPattern);
+ public @Nullable Object visitFunction(@NonNull Function function) {
+ return delegate.visitFunction(function);
}
/**
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitDomain(@NonNull Domain domain) {
- return delegate.visitDomain(domain);
+ public @Nullable Object visitFunctionParameter(@NonNull FunctionParameter functionParameter) {
+ return delegate.visitFunctionParameter(functionParameter);
}
/**
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitFunction(@NonNull Function function) {
- return delegate.visitFunction(function);
+ public @Nullable Object visitImperativeDomain(@NonNull ImperativeDomain coreDomain) {
+ return delegate.visitImperativeDomain(coreDomain);
}
/**
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitFunctionParameter(@NonNull FunctionParameter functionParameter) {
- return delegate.visitFunctionParameter(functionParameter);
+ public @Nullable Object visitImperativeModel(@NonNull ImperativeModel imperativeModel) {
+ return delegate.visitImperativeModel(imperativeModel);
}
/**
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitGuardPattern(@NonNull GuardPattern guardPattern) {
- return delegate.visitGuardPattern(guardPattern);
+ public @Nullable Object visitMapping(@NonNull Mapping mapping) {
+ return delegate.visitMapping(mapping);
}
/**
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitImperativePattern(@NonNull ImperativePattern corePattern) {
- return delegate.visitImperativePattern(corePattern);
+ public @Nullable Object visitMappingCall(@NonNull MappingCall mappingCall) {
+ return delegate.visitMappingCall(mappingCall);
}
/**
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitImperativeDomain(@NonNull ImperativeDomain coreDomain) {
- return delegate.visitImperativeDomain(coreDomain);
+ public @Nullable Object visitMappingCallBinding(@NonNull MappingCallBinding mappingCallBinding) {
+ return delegate.visitMappingCallBinding(mappingCallBinding);
}
/**
@@ -342,46 +337,6 @@ implements IQVTiEvaluationVisitor {
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitVariableAssignment(@NonNull VariableAssignment variableAssignment) {
- return delegate.visitVariableAssignment(variableAssignment);
- }
-
- /**
- * Delegates to my decorated visitor.
- */
- @Override
- public @Nullable Object visitImperativeModel(@NonNull ImperativeModel imperativeModel) {
- return delegate.visitImperativeModel(imperativeModel);
- }
-
- /**
- * Delegates to my decorated visitor.
- */
- @Override
- public @Nullable Object visitMapping(@NonNull Mapping mapping) {
- return delegate.visitMapping(mapping);
- }
-
- /**
- * Delegates to my decorated visitor.
- */
- @Override
- public @Nullable Object visitMappingCall(@NonNull MappingCall mappingCall) {
- return delegate.visitMappingCall(mappingCall);
- }
-
- /**
- * Delegates to my decorated visitor.
- */
- @Override
- public @Nullable Object visitMappingCallBinding(@NonNull MappingCallBinding mappingCallBinding) {
- return delegate.visitMappingCallBinding(mappingCallBinding);
- }
-
- /**
- * Delegates to my decorated visitor.
- */
- @Override
public @Nullable Object visiting(@NonNull Visitable visitable) {
return delegate.visiting(visitable);
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java
index 46d47f968..e3f754551 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java
@@ -285,9 +285,7 @@ public class QVTiIncrementalExecutor extends BasicQVTiExecutor
public void internalExecuteSetStatement(@NonNull SetStatement setStatement, @NonNull Object sourceObject, @Nullable Object ecoreValue, @Nullable Object childKey) {
super.internalExecuteSetStatement(setStatement, sourceObject, ecoreValue, childKey);
if (mode == Mode.LAZY) {
- Mapping asMapping = QVTimperativeUtil.getContainingMapping(setStatement);
- assert asMapping != null;
- if (transformationAnalysis.isHazardousWrite(asMapping, setStatement)) {
+ if (setStatement.isIsEmit()) {
Property targetProperty = QVTimperativeUtil.getTargetProperty(setStatement);
assert targetProperty != null;
EStructuralFeature eFeature = (EStructuralFeature)targetProperty.getESObject();
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiNestedEvaluationEnvironment.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiNestedEvaluationEnvironment.java
index 95b664e17..7e2b41204 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiNestedEvaluationEnvironment.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiNestedEvaluationEnvironment.java
@@ -12,20 +12,14 @@ package org.eclipse.qvtd.pivot.qvtimperative.evaluation;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.NamedElement;
-import org.eclipse.ocl.pivot.Operation;
-import org.eclipse.ocl.pivot.OperationCallExp;
import org.eclipse.ocl.pivot.evaluation.EvaluationEnvironment;
import org.eclipse.ocl.pivot.internal.evaluation.BasicEvaluationEnvironment;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
-import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsageAnalysis;
public class QVTiNestedEvaluationEnvironment extends BasicEvaluationEnvironment implements QVTiEvaluationEnvironment
{
protected final @NonNull QVTiRootEvaluationEnvironment rootEvaluationEnvironment;
- private @Nullable DomainUsageAnalysis usageAnalysis;
public QVTiNestedEvaluationEnvironment(@NonNull QVTiEvaluationEnvironment evaluationEnvironment, @NonNull NamedElement executableObject, @Nullable Object caller) {
super(evaluationEnvironment, executableObject, caller);
@@ -53,29 +47,4 @@ public class QVTiNestedEvaluationEnvironment extends BasicEvaluationEnvironment
public @NonNull Transformation getTransformation() {
return rootEvaluationEnvironment.getTransformation();
}
-
- @Override
- public @Nullable DomainUsage getUsageFor(@NonNull Element element) {
- DomainUsage domainUsage = null;
- DomainUsageAnalysis usageAnalysis2 = usageAnalysis;
- if (usageAnalysis2 == null) {
- if (caller instanceof OperationCallExp) {
- OperationCallExp operationCallExp = (OperationCallExp)caller;
- Operation referredOperation = operationCallExp.getReferredOperation();
- if (referredOperation != null) {
- usageAnalysis = usageAnalysis2 = getExecutor().getModelManager().getTransformationAnalysis().getDomainUsageAnalysis().getAnalysis(referredOperation);
- // FIXME Surely we need to 'specialize' for the actual usage of callingObject
- }
- }
- }
- if (usageAnalysis2 != null) {
- domainUsage = usageAnalysis2.getUsage(element);
- }
- if (domainUsage != null) {
- return domainUsage;
- }
- else {
- return getParentEvaluationEnvironment().getUsageFor(element);
- }
- }
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiRootEvaluationEnvironment.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiRootEvaluationEnvironment.java
index 2c52d93a2..d11a271ed 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiRootEvaluationEnvironment.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiRootEvaluationEnvironment.java
@@ -11,17 +11,11 @@
package org.eclipse.qvtd.pivot.qvtimperative.evaluation;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.internal.evaluation.BasicEvaluationEnvironment;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
-import org.eclipse.qvtd.pivot.qvtimperative.analysis.QVTimperativeDomainUsageAnalysis;
public class QVTiRootEvaluationEnvironment extends BasicEvaluationEnvironment implements QVTiEvaluationEnvironment
{
-// private @Nullable QVTimperativeDomainUsageAnalysis usageAnalysis;
-
public QVTiRootEvaluationEnvironment(@NonNull QVTiExecutor executor, @NonNull Transformation executableObject) {
super(executor, executableObject);
}
@@ -42,28 +36,4 @@ public class QVTiRootEvaluationEnvironment extends BasicEvaluationEnvironment im
assert executableObject2 != null;
return (Transformation) executableObject2;
}
-
- @Override
- public @Nullable DomainUsage getUsageFor(@NonNull Element element) {
- QVTimperativeDomainUsageAnalysis usageAnalysis = getExecutor().getModelManager().getTransformationAnalysis().getDomainUsageAnalysis();;
- return usageAnalysis.getUsage(element);
- }
-
-/* @Override
- public @Nullable DomainUsage getUsageFor(@NonNull Element element) {
- QVTimperativeDomainUsageAnalysis usageAnalysis2 = usageAnalysis;
- if (usageAnalysis2 == null) {
- usageAnalysis2 = getUsageAnalysis();
- }
- return usageAnalysis2.getUsage(element);
- }
-
- public @NonNull QVTimperativeDomainUsageAnalysis getUsageAnalysis() {
- QVTimperativeDomainUsageAnalysis usageAnalysis2 = usageAnalysis;
- if (usageAnalysis2 == null) {
- usageAnalysis = usageAnalysis2 = new QVTimperativeDomainUsageAnalysis(getExecutor().getEnvironmentFactory());
- usageAnalysis2.analyzeTransformation(getTransformation());
- }
- return usageAnalysis2;
- } */
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java
index 8f7956570..7e60e199f 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java
@@ -32,7 +32,7 @@ import org.eclipse.ocl.pivot.PrimitiveType;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.PropertyCallExp;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.VariableExp;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.ids.IdManager;
import org.eclipse.ocl.pivot.ids.OperationId;
import org.eclipse.ocl.pivot.ids.TypeId;
@@ -46,7 +46,6 @@ import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
@@ -493,8 +492,8 @@ public class QVTiTransformationAnalysis
return false;
}
for (@NonNull SetStatement propertyAssignment : propertyAssignments) {
- OCLExpression slotExpression = propertyAssignment.getSlotExpression();
- DomainUsage slotUsage = domainAnalysis.basicGetUsage(slotExpression);
+ VariableDeclaration targetVariable = propertyAssignment.getTargetVariable();
+ DomainUsage slotUsage = domainAnalysis.basicGetUsage(targetVariable);
if (domainUsage == slotUsage) {
return true;
}
@@ -538,9 +537,16 @@ public class QVTiTransformationAnalysis
if (domainUsage1 != null) {
TypedModel typedModel = domainUsage1.getTypedModel(asSource);
if (typedModel != null) {
- Area area = QVTimperativeUtil.getArea(asMapping, typedModel);
- if (area.getCheckedProperties().contains(asProperty)) {
- return true;
+ ImperativeDomain domain = QVTimperativeUtil.getDomain(asMapping, typedModel);
+ if (domain != null) {
+ if (domain.getCheckedProperties().contains(asProperty)) {
+ return true;
+ }
+ }
+ else {
+ if (asMapping.getCheckedProperties().contains(asProperty)) {
+ return true;
+ }
}
}
}
@@ -549,38 +555,16 @@ public class QVTiTransformationAnalysis
if (domainUsage2 != null) {
TypedModel typedModel = domainUsage2.getTypedModel(asProperty);
if (typedModel != null) {
- Area area = QVTimperativeUtil.getArea(asMapping, typedModel);
- if (area.getCheckedProperties().contains(asOppositeProperty)) {
- return true;
- }
- }
- }
- return false;
- }
-
- public boolean isHazardousWrite(@NonNull Mapping asMapping, @NonNull SetStatement asSetStatement) {
- Property asProperty = QVTimperativeUtil.getTargetProperty(asSetStatement);
- VariableExp asSource = asSetStatement.getSlotExpression();
- DomainUsage domainUsage = getDomainUsageAnalysis().basicGetUsage(asSource);
- if (domainUsage != null) {
- TypedModel typedModel = domainUsage.getTypedModel(asSource);
- if (typedModel != null) {
- Area area = null;
- for (Domain domain : asMapping.getDomain()) {
- if (domain.getTypedModel() == typedModel) {
- area = (ImperativeDomain)domain;
- break;
+ ImperativeDomain domain = QVTimperativeUtil.getDomain(asMapping, typedModel);
+ if (domain != null) {
+ if (domain.getCheckedProperties().contains(asOppositeProperty)) {
+ return true;
}
}
- if (area == null) {
- area = asMapping;
- }
- List<Property> enforcedProperties = area.getEnforcedProperties();
- if (enforcedProperties.contains(asProperty)) {
- return true;
- }
- if (enforcedProperties.contains(asProperty.getOpposite())) {
- return true;
+ else {
+ if (asMapping.getCheckedProperties().contains(asOppositeProperty)) {
+ return true;
+ }
}
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java
index 99353a9fa..a47e31170 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java
@@ -20,15 +20,11 @@ import org.eclipse.qvtd.pivot.qvtimperative.attributes.MappingAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.MappingCallBindingAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.MappingLoopAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.SetStatementAttribution;
-import org.eclipse.qvtd.pivot.qvtimperative.attributes.QVTimperativeBottomPatternAttribution;
-import org.eclipse.qvtd.pivot.qvtimperative.attributes.QVTimperativeGuardPatternAttribution;
public class QVTimperativePivotScoping
{
public static void init() {
Map<EClassifier, Attribution> registry = Attribution.REGISTRY;
- registry.put(QVTimperativePackage.Literals.BOTTOM_PATTERN, QVTimperativeBottomPatternAttribution.INSTANCE);
- registry.put(QVTimperativePackage.Literals.GUARD_PATTERN, QVTimperativeGuardPatternAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.IMPERATIVE_DOMAIN, CoreDomainAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.MAPPING, MappingAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.MAPPING_CALL_BINDING, MappingCallBindingAttribution.INSTANCE);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/AssignmentComparator.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/AssignmentComparator.java
deleted file mode 100644
index 5f777de17..000000000
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/AssignmentComparator.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2016 Willink Transformations and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * E.D.Willink - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.qvtd.pivot.qvtimperative.utilities;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.ocl.pivot.Variable;
-import org.eclipse.ocl.pivot.VariableDeclaration;
-import org.eclipse.ocl.pivot.VariableExp;
-import org.eclipse.ocl.pivot.utilities.ClassUtil;
-import org.eclipse.ocl.pivot.utilities.TreeIterable;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
-
-/**
- * AssignmentComparator supports sorting an assignment list into VariableAssignments first, least dependent first, alphabetical order.
- */
-public class AssignmentComparator implements Comparator<@NonNull Assignment>
-{
- private final @NonNull List<@NonNull Assignment> assignments;
- private @Nullable Map<@NonNull Variable, @NonNull Set<@NonNull Variable>> variable2referencedVariables = null;
-
- public AssignmentComparator(@NonNull List<@NonNull Assignment> assignments) {
- this.assignments = assignments;
- }
-
- @Override
- public int compare(@NonNull Assignment o1, @NonNull Assignment o2) {
- if (o1 instanceof VariableAssignment) {
- if (o2 instanceof VariableAssignment) {
- Map<@NonNull Variable, @NonNull Set<@NonNull Variable>> variable2referencedVariables2 = variable2referencedVariables;
- if (variable2referencedVariables2 == null) {
- variable2referencedVariables2 = variable2referencedVariables = computeReferencedVariableClosure();
- }
- Variable v1 = ((VariableAssignment)o1).getTargetVariable();
- Variable v2 = ((VariableAssignment)o2).getTargetVariable();
- Set<@NonNull Variable> r1 = variable2referencedVariables2.get(v1);
- Set<@NonNull Variable> r2 = variable2referencedVariables2.get(v2);
- assert (r1 != null) && (r2 != null);
- int diff = r1.size() - r2.size();
- if (diff != 0) {
- return diff;
- }
- String n1 = v1.getName();
- String n2 = v2.getName();
- return ClassUtil.safeCompareTo(n1, n2);
- }
- }
- return 0;
- }
-
- private @NonNull Map<@NonNull Variable, @NonNull Set<@NonNull Variable>> computeReferencedVariableClosure() {
- Map<@NonNull Variable, @NonNull Set<@NonNull Variable>> variable2referencedVariables2;
- variable2referencedVariables2 = new HashMap<@NonNull Variable, @NonNull Set<@NonNull Variable>>();
- //
- // Compute the direct references of each variable
- //
- for (@NonNull Assignment assignment : assignments) {
- if (assignment instanceof VariableAssignment) {
- VariableAssignment variableAssignment = (VariableAssignment)assignment;
- Variable variable = ClassUtil.nonNullState(variableAssignment.getTargetVariable());
- Set<@NonNull Variable> referencedVariables = new HashSet<@NonNull Variable>();
- for (EObject eObject : new TreeIterable(ClassUtil.nonNullState(variableAssignment.getValue()), true)) {
- if (eObject instanceof VariableExp) {
- VariableDeclaration referredVariable = ((VariableExp)eObject).getReferredVariable();
- if (referredVariable instanceof Variable) {
- referencedVariables.add((Variable)referredVariable);
- }
- }
- else if (eObject instanceof Variable) {
- referencedVariables.add((Variable)eObject);
- }
- }
- variable2referencedVariables2.put(variable, referencedVariables);
- }
- }
- //
- // Aggregate the closure
- //
- while (true) {
- boolean more = false;
- for (@NonNull Variable variable : variable2referencedVariables2.keySet()) {
- Set<@NonNull Variable> referencedVariables = variable2referencedVariables2.get(variable);
- assert referencedVariables != null;
- for (@NonNull Variable referencedVariable : new ArrayList<@NonNull Variable>(referencedVariables)) {
- Set<@NonNull Variable> referencedReferencedVariables = variable2referencedVariables2.get(referencedVariable);
- if ((referencedReferencedVariables != null) && referencedVariables.addAll(referencedReferencedVariables)) {
- more = true;
- }
- }
- }
- if (!more) {
- break;
- }
- }
- return variable2referencedVariables2;
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2MonikerVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2MonikerVisitor.java
index 4f10bd6f4..261eb0510 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2MonikerVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2MonikerVisitor.java
@@ -13,9 +13,6 @@ package org.eclipse.qvtd.pivot.qvtimperative.utilities;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.internal.utilities.AS2Moniker;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
@@ -28,25 +25,6 @@ public class QVTimperativeAS2MonikerVisitor extends AbstractQVTimperativeAS2Moni
}
@Override
- public @Nullable Object visitAssignment(@NonNull Assignment object) {
- return null;
- }
-
- @Override
- public @Nullable Object visitBottomPattern(@NonNull BottomPattern asBottomPattern) {
- context.appendParent(asBottomPattern, MONIKER_SCOPE_SEPARATOR);
- context.append("bottom");
- return true;
- }
-
- @Override
- public @Nullable Object visitGuardPattern(@NonNull GuardPattern asGuardPattern) {
- context.appendParent(asGuardPattern, MONIKER_SCOPE_SEPARATOR);
- context.append("guard");
- return true;
- }
-
- @Override
public @Nullable Object visitMapping(@NonNull Mapping object) {
return null;
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java
index 3c3604ef7..b0fdbc3eb 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java
@@ -18,11 +18,7 @@ import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.internal.utilities.AS2XMIid;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
@@ -39,19 +35,6 @@ public class QVTimperativeAS2XMIidVisitor extends AbstractQVTimperativeAS2XMIidV
super(context);
}
- @Override
- protected void appendNameOf(@NonNull Object element) {
- if (element instanceof BottomPattern) {
- appendName("bottom");
- }
- else if (element instanceof GuardPattern) {
- appendName("guard");
- }
- else {
- super.appendNameOf(element);
- }
- }
-
private void appendParentStatements(EObject object) {
EObject eContainer = object.eContainer();
if (eContainer instanceof MappingStatement) {
@@ -70,21 +53,11 @@ public class QVTimperativeAS2XMIidVisitor extends AbstractQVTimperativeAS2XMIidV
}
@Override
- public @Nullable Boolean visitAssignment(@NonNull Assignment object) {
- return null;
- }
-
- @Override
public @Nullable Boolean visitImperativeDomain(@NonNull ImperativeDomain asImperativeDomain) {
return null;
}
@Override
- public @Nullable Boolean visitImperativePattern(@NonNull ImperativePattern asImperativePattern) {
- return null;
- }
-
- @Override
public @Nullable Boolean visitMapping(@NonNull Mapping object) {
s.append(MAPPING_PREFIX);
appendParent(object);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeASSaverNormalizeVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeASSaverNormalizeVisitor.java
index 39923f605..8fe1872bd 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeASSaverNormalizeVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeASSaverNormalizeVisitor.java
@@ -11,27 +11,23 @@
package org.eclipse.qvtd.pivot.qvtimperative.utilities;
import java.util.Comparator;
-import java.util.List;
-
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.internal.resource.ASSaver;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
-import org.eclipse.qvtd.pivot.qvtbase.Predicate;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.util.AbstractQVTimperativeASSaverNormalizeVisitor;
public class QVTimperativeASSaverNormalizeVisitor extends AbstractQVTimperativeASSaverNormalizeVisitor
{
- protected static final class PredicateComparator implements Comparator<@NonNull Predicate>
+ protected static final class PredicateComparator implements Comparator<@NonNull CheckStatement>
{
- public static final @NonNull Comparator<@NonNull Predicate> INSTANCE = new PredicateComparator();
+ public static final @NonNull Comparator<@NonNull CheckStatement> INSTANCE = new PredicateComparator();
@Override
- public int compare(@NonNull Predicate o1, @NonNull Predicate o2) {
+ public int compare(@NonNull CheckStatement o1, @NonNull CheckStatement o2) {
String n1 = o1.toString();
String n2 = o2.toString();
if (n1 == null) n1 = "";
@@ -45,18 +41,14 @@ public class QVTimperativeASSaverNormalizeVisitor extends AbstractQVTimperativeA
}
@Override
- public @Nullable Object visitBottomPattern(@NonNull BottomPattern object) {
- List<@NonNull Assignment> assignments = ClassUtil.nullFree(object.getAssignment());
- ClassUtil.sort(assignments, new AssignmentComparator(assignments));
+ public @Nullable Object visitMapping(@NonNull Mapping object) {
+ // List<@NonNull CheckVariableStatement> assignments = ClassUtil.nullFree(object.getBottomAssignments());
+ // ClassUtil.sort(assignments, new AssignmentComparator(assignments));
+ // ClassUtil.sort(ClassUtil.nullFree(object.getGuardPredicates()), PredicateComparator.INSTANCE);
+ // QVTimperativeUtil.sortPatternVariables(ClassUtil.nullFree(object.getInoutVariables()));
+ // QVTimperativeUtil.sortPatternVariables(ClassUtil.nullFree(object.getOwnedPredicateVariables()));
// ClassUtil.sort(ClassUtil.nullFree(object.getRealizedVariable()), NameUtil.NAMEABLE_COMPARATOR);
- return super.visitBottomPattern(object);
- }
-
- @Override
- public @Nullable Object visitImperativePattern(@NonNull ImperativePattern object) {
- ClassUtil.sort(ClassUtil.nullFree(object.getPredicate()), PredicateComparator.INSTANCE);
- QVTimperativeUtil.sortPatternVariables(ClassUtil.nullFree(object.getVariable()));
- return super.visitPattern(object);
+ return super.visitMapping(object);
}
@Override
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeHelper.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeHelper.java
index 1f75fad83..c490b81bb 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeHelper.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeHelper.java
@@ -13,18 +13,19 @@ package org.eclipse.qvtd.pivot.qvtimperative.utilities;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.OCLExpression;
-import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseHelper;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
-import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
/**
* QVTimperativeHelper provides helper routines to assist creation of QVTimperative model elements.
@@ -42,27 +43,71 @@ public class QVTimperativeHelper extends QVTbaseHelper
return addStatement;
}
- public @NonNull ConnectionVariable createConnectionVariable(@NonNull String name, @NonNull Type asType, @Nullable OCLExpression initExpression) {
- ConnectionVariable asVariable = QVTimperativeFactory.eINSTANCE.createConnectionVariable();
+ public @NonNull CheckStatement createCheckStatement(@NonNull OCLExpression asConditionExpression) {
+ CheckStatement asPredicate = QVTimperativeFactory.eINSTANCE.createCheckStatement();
+ asPredicate.setConditionExpression(asConditionExpression);
+ return asPredicate;
+ }
+
+ public @NonNull GuardVariable createGuardVariable(@NonNull String name, @NonNull TypedModel typedModel, @NonNull Type type, boolean isRequired) {
+ GuardVariable asVariable = QVTimperativeFactory.eINSTANCE.createGuardVariable();
+ asVariable.setName(name);
+ asVariable.setReferredTypedModel(typedModel);
+ asVariable.setType(type);
+ asVariable.setIsRequired(isRequired);
+ return asVariable;
+ }
+
+ public @NonNull InConnectionVariable createInConnectionVariable(@NonNull String name, @NonNull Type asType, boolean isRequired) {
+ InConnectionVariable asVariable = QVTimperativeFactory.eINSTANCE.createInConnectionVariable();
asVariable.setName(name);
asVariable.setType(asType);
- asVariable.setIsRequired(true);
- asVariable.setOwnedInit(initExpression);
+ asVariable.setIsRequired(isRequired);
return asVariable;
}
- public @NonNull NewStatement createNewStatement(@NonNull String name, @NonNull TypedModel typedModel, @NonNull Type type) {
- return QVTimperativeUtil.createNewStatement(name, typedModel, type);
+ public @NonNull PredicateVariable createLocalOrPredicateVariable(@NonNull String name, @NonNull Type asType, boolean isRequired, @NonNull OCLExpression initExpression) {
+ PredicateVariable asVariableStatement = QVTimperativeFactory.eINSTANCE.createPredicateVariable();
+ asVariableStatement.setIsChecked(!initExpression.getType().conformsTo(standardLibrary, asType));
+ asVariableStatement.setOwnedInit(initExpression);
+ asVariableStatement.setName(name);
+ asVariableStatement.setType(asType);
+ asVariableStatement.setIsRequired(isRequired);
+ return asVariableStatement;
}
- public @NonNull SetStatement createSetStatement(@NonNull Variable asVariable, @NonNull Property asProperty, @NonNull OCLExpression asValueExpression) {
- return QVTimperativeUtil.createSetStatement(asVariable, asProperty, asValueExpression);
+ public @NonNull LoopVariable createLoopVariable(@NonNull String name, @NonNull Type type) {
+ LoopVariable asVariable = QVTimperativeFactory.eINSTANCE.createLoopVariable();
+ asVariable.setName(name);
+ asVariable.setType(type);
+ asVariable.setIsRequired(true);
+ return asVariable;
}
- public @NonNull VariableAssignment createVariableAssignment(@NonNull Variable asVariable, @NonNull OCLExpression asValueExpression) {
- VariableAssignment asVariableAssignment = QVTimperativeFactory.eINSTANCE.createVariableAssignment();
- asVariableAssignment.setTargetVariable(asVariable);
- asVariableAssignment.setValue(asValueExpression);
- return asVariableAssignment;
+ // public @NonNull NewStatement createNewStatement(@NonNull String name, @NonNull TypedModel typedModel, @NonNull Type type) {
+ // return QVTimperativeUtil.createNewStatement(name, typedModel, type);
+ // }
+
+ public @NonNull OutConnectionVariable createOutConnectionVariable(@NonNull String name, @NonNull Type asType, boolean isRequired, @Nullable OCLExpression initExpression) {
+ OutConnectionVariable asVariable = QVTimperativeFactory.eINSTANCE.createOutConnectionVariable();
+ asVariable.setName(name);
+ asVariable.setType(asType);
+ asVariable.setIsRequired(isRequired);
+ asVariable.setOwnedInit(initExpression);
+ return asVariable;
}
+
+ /* public @NonNull PredicateVariable createPredicateVariable(@NonNull String name, @NonNull Type asType, boolean isRequired, @NonNull OCLExpression initExpression) {
+ PredicateVariable asVariable = QVTimperativeFactory.eINSTANCE.createPredicateVariable();
+ asVariable.setName(name);
+ asVariable.setType(asType);
+ asVariable.setIsRequired(isRequired);
+ asVariable.setOwnedInit(initExpression);
+ assert !initExpression.getType().conformsTo(standardLibrary, asType);
+ return asVariable;
+ } */
+
+ // public @NonNull SetStatement createSetStatement(@NonNull Variable asVariable, @NonNull Property asProperty, @NonNull OCLExpression asValueExpression, boolean isEmit) {
+ // return QVTimperativeUtil.createSetStatement(asVariable, asProperty, asValueExpression, isEmit);
+ // }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java
index 3f3e492d0..f224431f1 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java
@@ -13,32 +13,32 @@ package org.eclipse.qvtd.pivot.qvtimperative.utilities;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.OCLExpression;
+import org.eclipse.ocl.pivot.Type;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.internal.prettyprint.PrettyPrinter;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Predicate;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbasePrettyPrintVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor implements QVTimperativeVisitor<Object>
@@ -47,14 +47,6 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
super(context);
}
- protected void doArea(@NonNull Area pArea) {
- context.append(" (");
- safeVisit(pArea.getGuardPattern());
- context.append(")\n{");
- safeVisit(pArea.getBottomPattern());
- context.append("}\n");
- }
-
@Override
public Object visitAddStatement(@NonNull AddStatement asAddStatement) {
context.append("add ");
@@ -66,56 +58,29 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
@Override
- public Object visitAssignment(@NonNull Assignment object) {
- return null;
- }
-
- @Override
- public Object visitBottomPattern(@NonNull BottomPattern pBottomPattern) {
- for (Variable pVariable : pBottomPattern.getVariable()) {
- safeVisit(pVariable);
- }
- context.append(" |");
- List<Predicate> predicates = pBottomPattern.getPredicate();
- if (predicates.size() > 0) {
- context.append("\n");
- for (Predicate pPredicate : predicates) {
- safeVisit(pPredicate);
- }
- }
- List<Assignment> assignments = pBottomPattern.getAssignment();
- if (assignments.size() > 0) {
- context.append("\n");
- for (Assignment pAssignment : assignments) {
- safeVisit(pAssignment);
- }
- }
+ public Object visitCheckStatement(@NonNull CheckStatement pPredicate) {
+ context.append("check ");
+ safeVisit(pPredicate.getConditionExpression());
+ context.append(";\n");
return null;
}
@Override
- public Object visitBottomStatement(@NonNull BottomStatement object) {
- return visitStatement(object);
- }
-
- @Override
public Object visitConnectionVariable(@NonNull ConnectionVariable object) {
- return visitVariable(object);
+ return visitVariableDeclaration(object);
}
@Override
- public Object visitGuardPattern(@NonNull GuardPattern pGuardPattern) {
- for (Variable pVariable : pGuardPattern.getVariable()) {
- safeVisit(pVariable);
- }
- context.append(" |");
- List<Predicate> predicates = pGuardPattern.getPredicate();
- if (predicates.size() > 0) {
- context.append("\n");
- for (Predicate pPredicate : predicates) {
- safeVisit(pPredicate);
- }
+ public Object visitGuardVariable(@NonNull GuardVariable asVariable) {
+ context.append("in ");
+ context.appendName(asVariable);
+ Type type = asVariable.getType();
+ if (type != null) {
+ context.append(" : ");
+ // context.appendQualifiedType(type);
+ context.appendTypedMultiplicity(asVariable);
}
+ context.append(";\n");
return null;
}
@@ -131,8 +96,19 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
@Override
- public Object visitImperativePattern(@NonNull ImperativePattern object) {
- return visitPattern(object);
+ public Object visitInConnectionVariable(@NonNull InConnectionVariable object) {
+ return visitVariableDeclaration(object);
+ }
+
+ @Override
+ public Object visitLoopVariable(@NonNull LoopVariable asVariable) {
+ context.appendName(asVariable);
+ Type type = asVariable.getType();
+ if (type != null) {
+ context.append(" : ");
+ context.appendTypedMultiplicity(asVariable);
+ }
+ return null;
}
@Override
@@ -141,17 +117,29 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
context.appendName(pMapping);
context.append(" in ");
context.appendName(pMapping.getTransformation());
- context.append(" {");
+ context.append(" {\n");
context.push("", "");
+ for (ConnectionVariable pVariable : pMapping.getInoutVariables()) {
+ context.append("inout ");
+ safeVisit(pVariable);
+ context.append(";\n");
+ }
for (Domain pDomain : pMapping.getDomain()) {
if (pDomain instanceof ImperativeDomain) {
- context.appendName(pDomain);
- doArea((ImperativeDomain)pDomain);
+ List<GuardVariable> ownedGuardVariables = ((ImperativeDomain)pDomain).getOwnedGuardVariables();
+ if (ownedGuardVariables.size() > 0) {
+ context.appendName(pDomain);
+ context.append("{\n");
+ for (GuardVariable pVariable : ownedGuardVariables) {
+ safeVisit(pVariable);
+ }
+ context.append("}\n");
+ }
}
}
- context.append("where");
- doArea(pMapping);
- context.append("}");
+ for (GuardVariable pVariable : pMapping.getOwnedGuardVariables()) {
+ safeVisit(pVariable);
+ }
for (Statement pStatement : pMapping.getOwnedStatements()) {
safeVisit(pStatement);
}
@@ -208,23 +196,55 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
@Override
public Object visitNewStatement(@NonNull NewStatement pNewStatement) {
- context.append("new@");
+ context.append("new:");
context.appendName(pNewStatement.getReferredTypedModel());
context.append(" ");
- visitVariable(pNewStatement);
+ context.appendName(pNewStatement);
+ Type type = pNewStatement.getType();
+ if (type != null) {
+ context.append(" : ");
+ // context.appendQualifiedType(type);
+ context.appendTypedMultiplicity(pNewStatement);
+ }
+ OCLExpression initExpression = pNewStatement.getOwnedInit();
+ if (initExpression != null) {
+ context.append(" = ");
+ safeVisit(initExpression);
+ }
+ context.append(";\n");
return null;
}
@Override
+ public Object visitOutConnectionVariable(@NonNull OutConnectionVariable object) {
+ return visitVariableDeclaration(object);
+ }
+
+ @Override
public Object visitPredicate(@NonNull Predicate pPredicate) {
safeVisit(pPredicate.getConditionExpression());
return null;
}
@Override
+ public Object visitPredicateVariable(@NonNull PredicateVariable asVariable) {
+ context.append(asVariable.isIsChecked() ? "check " : "var ");
+ context.appendName(asVariable);
+ Type type = asVariable.getType();
+ if (type != null) {
+ context.append(" : ");
+ context.appendTypedMultiplicity(asVariable);
+ }
+ context.append(" := ");
+ safeVisit(asVariable.getOwnedInit());
+ context.append(";\n");
+ return null;
+ }
+
+ @Override
public Object visitSetStatement(@NonNull SetStatement asSetStatement) {
- context.append("set ");
- safeVisit(asSetStatement.getSlotExpression());
+ context.append(asSetStatement.isIsEmit() ? "emit " : "set ");
+ context.appendName(asSetStatement.getTargetVariable());
context.append(".");
context.appendName(QVTimperativeUtil.getTargetProperty(asSetStatement));
context.append(" := ");
@@ -253,17 +273,7 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
@Override
- public Object visitVariableAssignment(@NonNull VariableAssignment pVariableAssignment) {
- context.appendName(pVariableAssignment.getTargetVariable());
- context.append(" := ");
- safeVisit(pVariableAssignment.getValue());
- context.append(";\n");
- return null;
- }
-
- @Override
- public @Nullable Object visitVariablePredicate(@NonNull VariablePredicate object) {
- // TODO Auto-generated method stub
- return null;
+ public Object visitVariableStatement(@NonNull VariableStatement object) {
+ return visiting(object);
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java
index d9b0126a2..e501277ee 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java
@@ -13,30 +13,30 @@ package org.eclipse.qvtd.pivot.qvtimperative.utilities;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.ocl.pivot.NamedElement;
-import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.OCLExpression;
+import org.eclipse.ocl.pivot.Type;
import org.eclipse.ocl.pivot.utilities.ToStringVisitor;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseToStringVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
/**
@@ -81,33 +81,33 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
- public String visitAssignment(@NonNull Assignment object) {
- append("Assignment ");
- // appendName(object);
+ public @Nullable String visitCheckStatement(@NonNull CheckStatement object) {
+ append("check ");
+ safeVisit(object.getConditionExpression());
return null;
}
@Override
- public String visitBottomPattern(@NonNull BottomPattern object) {
- appendQualifiedName((NamedElement)object.getArea());
- append("$Bottom");
+ public @Nullable String visitConnectionVariable(@NonNull ConnectionVariable asVariable) {
+ // append("in ");
+ appendName(asVariable);
+ Type type = asVariable.getType();
+ if (type != null) {
+ append(" : ");
+ appendElementType(asVariable);
+ }
return null;
}
@Override
- public String visitBottomStatement(@NonNull BottomStatement object) {
- return visitStatement(object);
- }
-
- @Override
- public @Nullable String visitConnectionVariable(@NonNull ConnectionVariable object) {
- return visitVariable(object);
- }
-
- @Override
- public String visitGuardPattern(@NonNull GuardPattern object) {
- appendQualifiedName((NamedElement)object.getArea());
- append("$Guard");
+ public @Nullable String visitGuardVariable(@NonNull GuardVariable asVariable) {
+ append("in ");
+ appendName(asVariable);
+ Type type = asVariable.getType();
+ if (type != null) {
+ append(" : ");
+ appendElementType(asVariable);
+ }
return null;
}
@@ -123,9 +123,25 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
- public String visitImperativePattern(@NonNull ImperativePattern object) {
- append("ImperativePattern ");
- // appendName(object);
+ public @Nullable String visitInConnectionVariable(@NonNull InConnectionVariable asVariable) {
+ append("in ");
+ appendName(asVariable);
+ Type type = asVariable.getType();
+ if (type != null) {
+ append(" : ");
+ appendElementType(asVariable);
+ }
+ return null;
+ }
+
+ @Override
+ public @Nullable String visitLoopVariable(@NonNull LoopVariable asVariable) {
+ appendName(asVariable);
+ Type type = asVariable.getType();
+ if (type != null) {
+ append(" : ");
+ appendElementType(asVariable);
+ }
return null;
}
@@ -164,7 +180,7 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
@Override
public @Nullable String visitMappingLoop(@NonNull MappingLoop object) {
boolean isFirst = true;
- for (Variable iterator : object.getOwnedIterators()) {
+ for (LoopVariable iterator : object.getOwnedIterators()) {
if (!isFirst) {
append(", ");
}
@@ -183,17 +199,53 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
@Override
public String visitNewStatement(@NonNull NewStatement newStatement) {
- append("new@");
+ append("new:");
appendName(newStatement.getReferredTypedModel());
append(" ");
- visitVariable(newStatement);
+ appendName(newStatement);
+ Type type = newStatement.getType();
+ if (type != null) {
+ append(" : ");
+ appendElementType(newStatement);
+ }
+ OCLExpression initExpression = newStatement.getOwnedInit();
+ if (initExpression != null) {
+ append(" = ");
+ safeVisit(initExpression);
+ }
+ return null;
+ }
+
+ @Override
+ public @Nullable String visitOutConnectionVariable(@NonNull OutConnectionVariable asVariable) {
+ append("out ");
+ appendName(asVariable);
+ Type type = asVariable.getType();
+ if (type != null) {
+ append(" : ");
+ appendElementType(asVariable);
+ }
+ return null;
+ }
+
+ @Override
+ public @Nullable String visitPredicateVariable(@NonNull PredicateVariable asVariable) {
+ append(asVariable.isIsChecked() ? "check " : "var ");
+ appendName(asVariable);
+ Type type = asVariable.getType();
+ if (type != null) {
+ append(" : ");
+ appendElementType(asVariable);
+ }
+ append(" := ");
+ safeVisit(asVariable.getOwnedInit());
return null;
}
@Override
public String visitSetStatement(@NonNull SetStatement asSetStatement) {
- append("set ");
- safeVisit(asSetStatement.getSlotExpression());
+ append(asSetStatement.isIsEmit() ? "emit " : "set ");
+ appendName(asSetStatement.getTargetVariable());
append(".");
appendName(QVTimperativeUtil.getTargetProperty(asSetStatement));
append(" := ");
@@ -207,18 +259,7 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
- public String visitVariableAssignment(@NonNull VariableAssignment variableAssignment) {
- appendName(variableAssignment.getTargetVariable());
- append(" := ");
- safeVisit(variableAssignment.getValue());
- return null;
- }
-
- @Override
- public @Nullable String visitVariablePredicate(@NonNull VariablePredicate variablePredicate) {
- appendName(variablePredicate.getTargetVariable());
- append(" := ");
- safeVisit(variablePredicate.getConditionExpression());
+ public @Nullable String visitVariableStatement(@NonNull VariableStatement object) {
return null;
}
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeUtil.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeUtil.java
index 08e7c7c72..2dce53166 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeUtil.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeUtil.java
@@ -12,15 +12,11 @@ package org.eclipse.qvtd.pivot.qvtimperative.utilities;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
-import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
@@ -36,7 +32,6 @@ import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.VariableExp;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
-import org.eclipse.ocl.pivot.utilities.NameUtil;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.ocl.pivot.utilities.TreeIterable;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
@@ -47,10 +42,9 @@ import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseEnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseEnvironmentFactory.CreateStrategy;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
@@ -59,7 +53,6 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEnvironmentFactory;
public class QVTimperativeUtil extends QVTbaseUtil
@@ -74,8 +67,8 @@ public class QVTimperativeUtil extends QVTbaseUtil
@Override
public int compare(MappingCallBinding o1, MappingCallBinding o2) {
- Variable v1 = o1.getBoundVariable();
- Variable v2 = o2.getBoundVariable();
+ VariableDeclaration v1 = o1.getBoundVariable();
+ VariableDeclaration v2 = o2.getBoundVariable();
String n1 = v1 != null ? v1.getName() : null;
String n2 = v2 != null ? v2.getName() : null;
return ClassUtil.safeCompareTo(n1, n2);
@@ -130,8 +123,6 @@ public class QVTimperativeUtil extends QVTbaseUtil
ImperativeDomain coreDomain = QVTimperativeFactory.eINSTANCE.createImperativeDomain();
coreDomain.setName(typedModel.getName());
coreDomain.setTypedModel(typedModel);
- coreDomain.setBottomPattern(QVTimperativeFactory.eINSTANCE.createBottomPattern());
- coreDomain.setGuardPattern(QVTimperativeFactory.eINSTANCE.createGuardPattern());
return coreDomain;
}
@@ -149,8 +140,6 @@ public class QVTimperativeUtil extends QVTbaseUtil
public static @NonNull Mapping createMapping(@NonNull String name) {
Mapping mapping = QVTimperativeFactory.eINSTANCE.createMapping();
mapping.setName(name);
- mapping.setBottomPattern(QVTimperativeFactory.eINSTANCE.createBottomPattern());
- mapping.setGuardPattern(QVTimperativeFactory.eINSTANCE.createGuardPattern());
return mapping;
}
@@ -161,14 +150,14 @@ public class QVTimperativeUtil extends QVTbaseUtil
return mappingCall;
}
- public static @NonNull MappingCallBinding createMappingCallBinding(@NonNull Variable variable, @NonNull OCLExpression value) {
+ public static @NonNull MappingCallBinding createMappingCallBinding(@NonNull VariableDeclaration variable, @NonNull OCLExpression value) {
MappingCallBinding mappingCallBinding = QVTimperativeFactory.eINSTANCE.createMappingCallBinding();
mappingCallBinding.setBoundVariable(variable);
mappingCallBinding.setValue(value);
return mappingCallBinding;
}
- public static @NonNull MappingLoop createMappingLoop(@NonNull OCLExpression source, @NonNull Variable iterator, @NonNull MappingStatement mappingStatement) {
+ public static @NonNull MappingLoop createMappingLoop(@NonNull OCLExpression source, @NonNull LoopVariable iterator, @NonNull MappingStatement mappingStatement) {
assert iterator.eContainer() == null;
MappingLoop ml = QVTimperativeFactory.eINSTANCE.createMappingLoop();
ml.setOwnedSource(source);
@@ -220,7 +209,7 @@ public class QVTimperativeUtil extends QVTbaseUtil
return newStatement;
}
- public static @NonNull SetStatement createSetStatement(@NonNull Variable asVariable, @NonNull Property asProperty, @NonNull OCLExpression asValueExpression) {
+ public static @NonNull SetStatement createSetStatement(@NonNull VariableDeclaration asVariable, @NonNull Property asProperty, @NonNull OCLExpression asValueExpression, boolean isEmit) {
SetStatement asSetAssignment = QVTimperativeFactory.eINSTANCE.createSetStatement();
if (asProperty.isIsImplicit()) {
asSetAssignment.setTargetProperty(asProperty.getOpposite());
@@ -230,8 +219,9 @@ public class QVTimperativeUtil extends QVTbaseUtil
asSetAssignment.setTargetProperty(asProperty);
asSetAssignment.setIsOpposite(false);
}
- asSetAssignment.setSlotExpression(createVariableExp(asVariable));
+ asSetAssignment.setTargetVariable(asVariable);
asSetAssignment.setValue(asValueExpression);
+ asSetAssignment.setIsEmit(isEmit);
return asSetAssignment;
}
@@ -247,23 +237,24 @@ public class QVTimperativeUtil extends QVTbaseUtil
return typedModel;
}
- public static @NonNull Area getArea(@NonNull Mapping mapping, @NonNull TypedModel typedModel) {
+ public static @NonNull ImperativeDomain getArea(@NonNull Mapping mapping, @NonNull TypedModel typedModel) {
for (Domain domain : mapping.getDomain()) {
if (domain.getTypedModel() == typedModel) {
return (ImperativeDomain)domain;
}
}
- return mapping;
+ throw new IllegalStateException();
+ // return mapping;
}
- public static @Nullable Area getContainingArea(@Nullable EObject eObject) {
+ /* public static @Nullable Area getContainingArea(@Nullable EObject eObject) {
for ( ; eObject != null; eObject = eObject.eContainer()) {
if (eObject instanceof Area) {
return (Area) eObject;
}
}
return null;
- }
+ } */
/* public static @NonNull Variable createVariable(@NonNull String name, @NonNull Type type) {
Variable bodyIt = PivotFactory.eINSTANCE.createVariable();
@@ -288,15 +279,6 @@ public class QVTimperativeUtil extends QVTbaseUtil
return null;
}
- public static @Nullable ImperativePattern getContainingPattern(@Nullable EObject eObject) {
- for ( ; eObject != null; eObject = eObject.eContainer()) {
- if (eObject instanceof ImperativePattern) {
- return (ImperativePattern) eObject;
- }
- }
- return null;
- }
-
public static @Nullable ImperativeDomain getDomain(@NonNull Mapping rule, @NonNull TypedModel typedModel) {
return (ImperativeDomain)getDomain((Rule)rule, typedModel);
}
@@ -306,18 +288,21 @@ public class QVTimperativeUtil extends QVTbaseUtil
return asSetStatement.isIsOpposite() ? ClassUtil.nonNullState(referredProperty.getOpposite()) : referredProperty;
}
- public static @Nullable TypedModel getTypedModel(@Nullable Area area) {
- if (area instanceof ImperativeDomain) {
- return ((ImperativeDomain)area).getTypedModel();
+ public static @Nullable TypedModel getTypedModel(@Nullable Domain domain) {
+ if (domain instanceof ImperativeDomain) {
+ return ((ImperativeDomain)domain).getTypedModel();
}
else {
return null;
}
}
- public static boolean isPrimitiveVariable(@NonNull Variable asVariable) {
- Area asArea = QVTimperativeUtil.getContainingArea(asVariable);
- if ((asArea instanceof Mapping) && !(asVariable.getType() instanceof CollectionType)) {
+ public static boolean isPrimitiveVariable(@NonNull VariableDeclaration asVariable) {
+ Domain asArea = QVTimperativeUtil.getContainingDomain(asVariable);
+ if (asArea != null) {
+ return false;
+ }
+ if (!(asVariable.getType() instanceof CollectionType)) {
return true;
}
return false;
@@ -334,9 +319,9 @@ public class QVTimperativeUtil extends QVTbaseUtil
}
/**
- * Sort the pattern variables into a least referenced foirst then alphabetical order.
+ * Sort the pattern variables into a least referenced first then alphabetical order.
*/
- public static void sortPatternVariables(@NonNull List<@NonNull Variable> variables) {
+ public static void sortPatternVariables(@NonNull List<@NonNull ? extends Variable> variables) {
if (variables.size() > 1) {
final Map<@NonNull Variable, @Nullable List<@NonNull VariableDeclaration>> def2refs = new HashMap<>();
//
@@ -402,12 +387,14 @@ public class QVTimperativeUtil extends QVTbaseUtil
/**
* Return a copy of asVariablePredicates sorted to avoid reverse references from the predicate expressions.
- */
+ *
public static @NonNull List<@NonNull VariablePredicate> sortVariablePredicates(@NonNull Mapping asMapping, @NonNull List<@NonNull VariablePredicate> asVariablePredicates) {
- Set<@NonNull Variable> asGuardVariables = new HashSet<>();
- asGuardVariables.addAll(ClassUtil.nullFree(asMapping.getGuardPattern().getVariable()));
+ Set<@NonNull VariableDeclaration> asGuardVariables = new HashSet<>();
+ asGuardVariables.addAll(ClassUtil.nullFree(asMapping.getGuardPattern().getOwnedGuardVariables()));
+ asGuardVariables.addAll(ClassUtil.nullFree(asMapping.getInoutVariables()));
+ asGuardVariables.addAll(ClassUtil.nullFree(asMapping.getOwnedPredicateVariables()));
for (Domain asDomain : asMapping.getDomain()) {
- asGuardVariables.addAll(ClassUtil.nullFree(((ImperativeDomain)asDomain).getGuardPattern().getVariable()));
+ asGuardVariables.addAll(ClassUtil.nullFree(((ImperativeDomain)asDomain).getGuardPattern().getOwnedGuardVariables()));
}
List<@NonNull VariableDeclaration> pendingVariables = new ArrayList<>();
Map<@NonNull VariableDeclaration, @NonNull VariablePredicate> variable2predicate = new HashMap<>();
@@ -475,6 +462,6 @@ public class QVTimperativeUtil extends QVTbaseUtil
}
}
return asSortedVariablePredicates;
- }
+ } */
} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/StatementComparator.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/StatementComparator.java
new file mode 100644
index 000000000..9f650db37
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/StatementComparator.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Willink Transformations and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * E.D.Willink - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.qvtd.pivot.qvtimperative.utilities;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
+import org.eclipse.ocl.pivot.VariableExp;
+import org.eclipse.ocl.pivot.utilities.ClassUtil;
+import org.eclipse.ocl.pivot.utilities.TreeIterable;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
+import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.Statement;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
+
+/**
+ * StatementComparator supports sorting a list of Statements into a least dependent first then alphabetical order.
+ */
+public class StatementComparator implements Comparator<@NonNull Statement>
+{
+ private final @NonNull List<@NonNull Statement> statements;
+ private @Nullable Map<@NonNull Statement, @NonNull Set<@NonNull VariableDeclaration>> statement2referencedVariables = null;
+
+ public StatementComparator(@NonNull List<@NonNull Statement> statements) {
+ this.statements = statements;
+ }
+
+ @Override
+ public int compare(@NonNull Statement o1, @NonNull Statement o2) {
+ boolean isOk = (o2 instanceof MappingLoop);
+ if (isOk != (o1 instanceof MappingLoop)) {
+ return isOk ? -1 : 1;
+ }
+ isOk = (o2 instanceof SetStatement);
+ if (isOk != (o1 instanceof SetStatement)) {
+ return isOk ? -1 : 1;
+ }
+ isOk = (o2 instanceof NewStatement);
+ if (isOk != (o1 instanceof NewStatement)) {
+ return isOk ? -1 : 1;
+ }
+ isOk = (o2 instanceof CheckStatement);
+ if (isOk != (o1 instanceof CheckStatement)) {
+ toString();
+ }
+ Map<@NonNull Statement, @NonNull Set<@NonNull VariableDeclaration>> statement2referencedVariables2 = statement2referencedVariables;
+ if (statement2referencedVariables2 == null) {
+ statement2referencedVariables2 = statement2referencedVariables = computeReferencedVariableClosure();
+ }
+ Set<@NonNull VariableDeclaration> r1 = statement2referencedVariables2.get(o1);
+ Set<@NonNull VariableDeclaration> r2 = statement2referencedVariables2.get(o2);
+ assert ((r1 != null) && (r2 != null));
+ int diff = r1.size() - r2.size();
+ if (diff != 0) {
+ return diff;
+ }
+ // }
+ // else {
+ // System.out.println(o1 + " wrt " + o2);
+ // }
+ String n1 = o1.getName();
+ String n2 = o2.getName();
+ return ClassUtil.safeCompareTo(n1, n2);
+ }
+
+ private @NonNull Map<@NonNull Statement, @NonNull Set<@NonNull VariableDeclaration>> computeReferencedVariableClosure() {
+ Map<@NonNull Statement, @NonNull Set<@NonNull VariableDeclaration>> statement2referencedVariables2 = new HashMap<>();
+ Map<@NonNull VariableDeclaration, @NonNull Statement> variable2statement = new HashMap<>();
+ //
+ // Compute the direct references of each variable
+ //
+ for (@NonNull Statement statement : statements) {
+ if (statement instanceof VariableStatement) {
+ variable2statement.put((VariableStatement)statement, statement);
+ }
+ Set<@NonNull VariableDeclaration> referencedVariables = new HashSet<>();
+ for (EObject eObject : new TreeIterable(statement, false)) {
+ if (eObject instanceof VariableExp) {
+ VariableDeclaration referredVariable = ((VariableExp)eObject).getReferredVariable();
+ assert referredVariable != null;
+ referencedVariables.add(referredVariable);
+ }
+ else if (eObject instanceof VariableDeclaration) {
+ referencedVariables.add((VariableDeclaration)eObject);
+ }
+ }
+ statement2referencedVariables2.put(statement, referencedVariables);
+ }
+ // }
+ //
+ // Aggregate the closure
+ //
+ while (true) {
+ boolean more = false;
+ for (@NonNull Statement statement : statement2referencedVariables2.keySet()) {
+ Set<@NonNull VariableDeclaration> referencedVariables = statement2referencedVariables2.get(statement);
+ assert referencedVariables != null;
+ for (@NonNull VariableDeclaration referencedVariable : new ArrayList<>(referencedVariables)) {
+ Statement referencedStatement = variable2statement.get(referencedVariable);
+ if (referencedStatement != null) {
+ Set<@NonNull VariableDeclaration> referencedReferencedVariables = statement2referencedVariables2.get(referencedStatement);
+ if ((referencedReferencedVariables != null) && referencedVariables.addAll(referencedReferencedVariables)) {
+ more = true;
+ }
+ }
+ }
+ }
+ if (!more) {
+ break;
+ }
+ }
+ return statement2referencedVariables2;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/Assignment.gif b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/Assignment.gif
deleted file mode 100644
index 9ab69e75e..000000000
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/Assignment.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/BottomPattern.gif b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/BottomPattern.gif
deleted file mode 100644
index 472c11df4..000000000
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/BottomPattern.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/VariableAssignment.gif b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/CheckVariableStatement.gif
index 4c738fb92..4c738fb92 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/VariableAssignment.gif
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/CheckVariableStatement.gif
Binary files differ
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/GuardPattern.gif b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/GuardPattern.gif
deleted file mode 100644
index b33e78090..000000000
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/GuardPattern.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/labeling/QVTimperativeLabelProvider.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/labeling/QVTimperativeLabelProvider.java
index d061470fa..83c48e529 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/labeling/QVTimperativeLabelProvider.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/labeling/QVTimperativeLabelProvider.java
@@ -14,24 +14,19 @@ import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.ocl.pivot.Namespace;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.Variable;
-import org.eclipse.ocl.pivot.VariableExp;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.internal.prettyprint.PrettyPrinter;
import org.eclipse.ocl.pivot.utilities.NameUtil;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.qvtd.pivot.qvtbase.Predicate;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
import org.eclipse.qvtd.xtext.qvtbase.ui.labeling.QVTbaseLabelProvider;
import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TopLevelCS;
@@ -52,22 +47,6 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
super(delegate);
}
- protected String image(Assignment ele) {
- return QVTIMPERATIVE_UI_ICONS + "Assignment.gif";
- }
-
- protected String image(BottomPattern ele) {
- return QVTIMPERATIVE_UI_ICONS + "BottomPattern.gif";
- }
-
- protected String image(ImperativeDomain ele) {
- return QVTIMPERATIVE_UI_ICONS + "CoreDomain.gif";
- }
-
- protected String image(ImperativePattern ele) {
- return QVTIMPERATIVE_UI_ICONS + "CorePattern.gif";
- }
-
// protected String image(Direction ele) {
// return QVTCOREBASE_UI_ICONS + "Direction.gif";
// }
@@ -76,8 +55,8 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
return QVTIMPERATIVE_UI_ICONS + "CoreDomain.gif";
}
- protected String image(GuardPattern ele) {
- return QVTIMPERATIVE_UI_ICONS + "GuardPattern.gif";
+ protected String image(ImperativeDomain ele) {
+ return QVTIMPERATIVE_UI_ICONS + "CoreDomain.gif";
}
protected String image(Mapping ele) {
@@ -96,6 +75,10 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
return QVTIMPERATIVE_UI_ICONS + "NewStatement.gif";
}
+ protected String image(PredicateVariable ele) {
+ return QVTIMPERATIVE_UI_ICONS + "CheckVariableStatement.gif";
+ }
+
protected String image(SetStatement ele) {
return QVTIMPERATIVE_UI_ICONS + "SetStatement.gif";
}
@@ -104,14 +87,6 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
return "QVTiModelFile.gif";
}
- protected String image(VariableAssignment ele) {
- return QVTIMPERATIVE_UI_ICONS + "VariableAssignment.gif";
- }
-
- protected String text(BottomPattern ele) {
- return "«bottom»";
- }
-
protected String text(ImperativeDomain ele) {
StringBuilder s = new StringBuilder();
if (ele.isIsCheckable()) {
@@ -128,10 +103,6 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
return NameUtil.getSafeName(ele);
}
- protected String text(GuardPattern ele) {
- return "«guard»";
- }
-
protected String text(MappingCall ele) {
return NameUtil.getSafeName(ele.getReferredMapping());
}
@@ -148,47 +119,42 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
return "«predicate»";
}
- protected String text(SetStatement ele) {
+ protected String text(PredicateVariable ele) {
assert ele != null;
Namespace namespace = PivotUtil.getNamespace(ele.eContainer());
if (namespace == null) {
return "";
}
StringBuilder s = new StringBuilder();
- VariableExp slotExpression = ele.getSlotExpression();
- if (slotExpression != null) {
- s.append(PrettyPrinter.printName(slotExpression, namespace));
- }
- Property targetProperty = ele.getTargetProperty();
- s.append(".");
- if (targetProperty != null) {
- s.append(NameUtil.getSafeName(targetProperty));
- }
+ s.append(PrettyPrinter.printName(ele, namespace));
s.append(" : ");
- if (targetProperty != null) {
- Type type = targetProperty.getType();
- if (type != null) {
- s.append(PrettyPrinter.printType(type, namespace));
- }
+ Type type = ele.getType();
+ if (type != null) {
+ s.append(PrettyPrinter.printType(type, namespace));
}
s.append(" := ");
return s.toString();
}
- protected String text(VariableAssignment ele) {
+ protected String text(SetStatement ele) {
assert ele != null;
Namespace namespace = PivotUtil.getNamespace(ele.eContainer());
if (namespace == null) {
return "";
}
StringBuilder s = new StringBuilder();
- Variable targetVariable = ele.getTargetVariable();
+ VariableDeclaration targetVariable = ele.getTargetVariable();
if (targetVariable != null) {
s.append(PrettyPrinter.printName(targetVariable, namespace));
}
+ Property targetProperty = ele.getTargetProperty();
+ s.append(".");
+ if (targetProperty != null) {
+ s.append(NameUtil.getSafeName(targetProperty));
+ }
s.append(" : ");
- if (targetVariable != null) {
- Type type = targetVariable.getType();
+ if (targetProperty != null) {
+ Type type = targetProperty.getType();
if (type != null) {
s.append(PrettyPrinter.printType(type, namespace));
}
@@ -196,5 +162,4 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
s.append(" := ");
return s.toString();
}
-
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/outline/QVTimperativeOutlineTreeProvider.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/outline/QVTimperativeOutlineTreeProvider.java
index fc111d8c3..4e701ab09 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/outline/QVTimperativeOutlineTreeProvider.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/outline/QVTimperativeOutlineTreeProvider.java
@@ -11,20 +11,19 @@
package org.eclipse.qvtd.xtext.qvtimperative.ui.outline;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.xtext.basecs.ImportCS;
import org.eclipse.ocl.xtext.basecs.PackageCS;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
-import org.eclipse.qvtd.pivot.qvtbase.Predicate;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
import org.eclipse.qvtd.xtext.qvtbase.ui.outline.QVTbaseOutlineTreeProvider;
import org.eclipse.qvtd.xtext.qvtimperativecs.DirectionCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS;
@@ -40,37 +39,22 @@ import org.eclipse.xtext.ui.editor.outline.IOutlineNode;
*/
public class QVTimperativeOutlineTreeProvider extends QVTbaseOutlineTreeProvider
{
- // protected void _createChildren(IOutlineNode parentNode, AssignmentCS csOperator) {
- // createNode(parentNode, csOperator.getInitialiser());
- //}
-
- protected void _createChildren(IOutlineNode parentNode, BottomPattern ele) {
- for (Variable asVariable : ele.getVariable()) {
+ protected void _createChildren(IOutlineNode parentNode, ImperativeDomain ele) {
+ for (GuardVariable asVariable : ele.getOwnedGuardVariables()) {
createNode(parentNode, asVariable);
}
- for (Predicate asPredicate : ele.getPredicate()) {
- createNode(parentNode, asPredicate);
- }
- for (Assignment asAssignment : ele.getAssignment()) {
- createNode(parentNode, asAssignment);
- }
}
- protected void _createChildren(IOutlineNode parentNode, GuardPattern ele) {
- for (Variable asVariable : ele.getVariable()) {
+ protected void _createChildren(IOutlineNode parentNode, Mapping ele) {
+ for (GuardVariable asVariable : ele.getOwnedGuardVariables()) {
createNode(parentNode, asVariable);
}
- for (Predicate asPredicate : ele.getPredicate()) {
- createNode(parentNode, asPredicate);
+ for (ConnectionVariable asVariable : ele.getInoutVariables()) {
+ createNode(parentNode, asVariable);
}
- }
-
- protected void _createChildren(IOutlineNode parentNode, Mapping ele) {
for (Domain asDomain : ele.getDomain()) {
createNode(parentNode, asDomain);
}
- createNode(parentNode, ele.getGuardPattern());
- createNode(parentNode, ele.getBottomPattern());
for (Statement asStatement : ele.getOwnedStatements()) {
createNode(parentNode, asStatement);
}
@@ -80,7 +64,7 @@ public class QVTimperativeOutlineTreeProvider extends QVTbaseOutlineTreeProvider
if (ele.getOwnedSource() != null) {
createNode(parentNode, ele.getOwnedSource());
}
- for (Variable asIterator : ele.getOwnedIterators()) {
+ for (LoopVariable asIterator : ele.getOwnedIterators()) {
createNode(parentNode, asIterator);
}
for (MappingStatement asStatement : ele.getOwnedMappingStatements()) {
@@ -116,8 +100,8 @@ public class QVTimperativeOutlineTreeProvider extends QVTbaseOutlineTreeProvider
}
}
- protected void _createChildren(IOutlineNode parentNode, VariableAssignment ele) {
- createNode(parentNode, ele.getValue());
+ protected void _createChildren(IOutlineNode parentNode, PredicateVariable ele) {
+ createNode(parentNode, ele.getOwnedInit());
}
protected void _createNode(IOutlineNode parentNode, TopLevelCS ele) {
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
index 38bf6a67c..7c6eb3fc8 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
@@ -29,12 +29,12 @@ import org.eclipse.ocl.pivot.Import;
import org.eclipse.ocl.pivot.Model;
import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.Namespace;
-import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.Package;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.Type;
import org.eclipse.ocl.pivot.Variable;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.VoidType;
import org.eclipse.ocl.pivot.internal.manager.Orphanage;
import org.eclipse.ocl.pivot.internal.utilities.EnvironmentFactoryInternal;
@@ -70,25 +70,24 @@ import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
import org.eclipse.qvtd.xtext.qvtbase.as2cs.QVTbaseDeclarationVisitor;
@@ -96,26 +95,26 @@ import org.eclipse.qvtd.xtext.qvtbasecs.AbstractTransformationCS;
import org.eclipse.qvtd.xtext.qvtbasecs.QVTbaseCSPackage;
import org.eclipse.qvtd.xtext.qvtbasecs.QualifiedPackageCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.AddStatementCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.BottomPatternCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.CheckStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DirectionCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.GuardPatternCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.GuardVariableCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.InoutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallBindingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingLoopCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.NewStatementCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.OutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.ParamDeclarationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateOrAssignmentCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage;
import org.eclipse.qvtd.xtext.qvtimperativecs.QueryCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.SetStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.StatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TopLevelCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TransformationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.UnrealizedVariableCS;
public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor implements QVTimperativeVisitor<ElementCS>
{
@@ -252,8 +251,19 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
}
- protected @Nullable Package getScope(@NonNull Variable asVariable) {
- TypedModel typedModel = QVTimperativeUtil.getTypedModel(QVTimperativeUtil.getContainingArea(asVariable));
+ protected @Nullable Package getScope(@NonNull VariableDeclaration asVariable) {
+ TypedModel typedModel = null;
+ Domain domain = QVTimperativeUtil.getContainingDomain(asVariable);
+ if (domain != null) {
+ typedModel = QVTimperativeUtil.getTypedModel(domain);
+ }
+ else {
+ Mapping mapping = QVTimperativeUtil.getContainingMapping(asVariable);
+ if (mapping != null) {
+ // typedModel = QVTimperativeUtil.getTypedModel(mapping);
+ }
+ }
+ assert typedModel != null;
if (typedModel == null) {
return null;
}
@@ -358,50 +368,30 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
public ElementCS visitAddStatement(@NonNull AddStatement asAddStatement) {
AddStatementCS csStatement = context.refreshElement(AddStatementCS.class, QVTimperativeCSPackage.Literals.ADD_STATEMENT_CS, asAddStatement);
csStatement.setPivot(asAddStatement);
- Variable asVariable = asAddStatement.getTargetVariable();
- if (asVariable != null) {
- assert asVariable.eContainer().eContainer() instanceof Mapping;
- csStatement.setTargetVariable(asVariable);
- }
+ ConnectionVariable asVariable = asAddStatement.getTargetVariable();
+ assert asVariable != null;
+ csStatement.setTargetVariable(asVariable);
csStatement.setOwnedExpression(context.visitDeclaration(ExpCS.class, asAddStatement.getValue()));
return csStatement;
}
@Override
- public ElementCS visitAssignment(@NonNull Assignment object) {
- throw new UnsupportedOperationException();
- }
-
- @Override
public ElementCS visitBaseModel(@NonNull BaseModel object) {
throw new UnsupportedOperationException();
}
@Override
- public ElementCS visitBottomPattern(@NonNull BottomPattern asBottomPattern) {
- Area asArea = asBottomPattern.getArea();
- BottomPatternCS csBottomPattern = context.refreshElement(BottomPatternCS.class, QVTimperativeCSPackage.Literals.BOTTOM_PATTERN_CS, asBottomPattern);
- csBottomPattern.setPivot(asBottomPattern);
- if (asArea instanceof Mapping) {
- List<Element> asConstraints = new ArrayList<Element>(asBottomPattern.getAssignment());
- asConstraints.addAll(asBottomPattern.getPredicate());
- context.refreshList(csBottomPattern.getOwnedConstraints(), context.visitDeclarations(PredicateOrAssignmentCS.class, asConstraints, null));
- context.refreshList(csBottomPattern.getOwnedUnrealizedVariables(), context.visitDeclarations(UnrealizedVariableCS.class, asBottomPattern.getVariable(), null));
- }
- else {
- context.refreshList(csBottomPattern.getOwnedUnrealizedVariables(), context.visitDeclarations(UnrealizedVariableCS.class, asBottomPattern.getVariable(), null));
- }
- return csBottomPattern;
- }
-
- @Override
- public ElementCS visitBottomStatement(@NonNull BottomStatement object) {
- return visitStatement(object);
+ public ElementCS visitCheckStatement(@NonNull CheckStatement asPredicate) {
+ assert asPredicate.eContainer() instanceof Mapping;
+ CheckStatementCS csPredicate = context.refreshElement(CheckStatementCS.class, QVTimperativeCSPackage.Literals.CHECK_STATEMENT_CS, asPredicate);
+ csPredicate.setPivot(asPredicate);
+ csPredicate.setOwnedCondition(createExpCS(asPredicate.getConditionExpression()));
+ return csPredicate;
}
@Override
public ElementCS visitConnectionVariable(@NonNull ConnectionVariable object) {
- return visitVariable(object);
+ throw new UnsupportedOperationException();
}
@Override
@@ -426,33 +416,27 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
@Override
- public ElementCS visitGuardPattern(@NonNull GuardPattern asGuardPattern) {
- Area asArea = asGuardPattern.getArea();
- GuardPatternCS csGuardPattern = context.refreshElement(GuardPatternCS.class, QVTimperativeCSPackage.Literals.GUARD_PATTERN_CS, asGuardPattern);
- csGuardPattern.setPivot(asGuardPattern);
- if (asArea instanceof Mapping) {
- context.refreshList(csGuardPattern.getOwnedPredicates(), context.visitDeclarations(PredicateCS.class, asGuardPattern.getPredicate(), null));
- context.refreshList(csGuardPattern.getOwnedUnrealizedVariables(), context.visitDeclarations(UnrealizedVariableCS.class, asGuardPattern.getVariable(), null));
- }
- else {
- context.refreshList(csGuardPattern.getOwnedUnrealizedVariables(), context.visitDeclarations(UnrealizedVariableCS.class, asGuardPattern.getVariable(), null));
- }
- return csGuardPattern;
+ public ElementCS visitGuardVariable(@NonNull GuardVariable asVariable) {
+ Mapping containingMapping = QVTimperativeUtil.getContainingMapping(asVariable);
+ assert containingMapping != null;
+ GuardVariableCS csUnrealizedVariable = context.refreshNamedElement(GuardVariableCS.class, QVTimperativeCSPackage.Literals.GUARD_VARIABLE_CS, asVariable);
+ csUnrealizedVariable.setPivot(asVariable);
+ csUnrealizedVariable.setReferredTypedModel(asVariable.getReferredTypedModel());
+ csUnrealizedVariable.setOwnedType(createTypeRefCS(asVariable.getType(), getScope(asVariable)));
+ return csUnrealizedVariable;
}
@Override
public ElementCS visitImperativeDomain(@NonNull ImperativeDomain asCoreDomain) {
DomainCS csDomain = createCoreDomain(asCoreDomain);
csDomain.setPivot(asCoreDomain);
- csDomain.setOwnedBottomPattern(context.visitDeclaration(BottomPatternCS.class, asCoreDomain.getBottomPattern()));
- csDomain.setOwnedGuardPattern(context.visitDeclaration(GuardPatternCS.class, asCoreDomain.getGuardPattern()));
+ context.refreshList(csDomain.getOwnedGuardVariables(), context.visitDeclarations(GuardVariableCS.class, asCoreDomain.getOwnedGuardVariables(), null));
csDomain.setIsCheck(asCoreDomain.isIsCheckable());
csDomain.setDirection(asCoreDomain.getTypedModel());
csDomain.setIsEnforce(asCoreDomain.isIsEnforceable());
Transformation asTransformation = QVTbaseUtil.getContainingTransformation(asCoreDomain);
assert asTransformation != null;
refreshUsedProperties(asTransformation, csDomain.getCheckedProperties(), ClassUtil.nullFree(asCoreDomain.getCheckedProperties()));
- refreshUsedProperties(asTransformation, csDomain.getEnforcedProperties(), ClassUtil.nullFree(asCoreDomain.getEnforcedProperties()));
return csDomain;
}
@@ -504,8 +488,65 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
@Override
- public ElementCS visitImperativePattern(@NonNull ImperativePattern object) {
- throw new UnsupportedOperationException();
+ public @Nullable ElementCS visitImport(@NonNull Import asUnit) {
+ BaseCSResource csResource = context.getCSResource();
+ Namespace asNamespace = asUnit.getImportedNamespace();
+ EObject eObject = asNamespace.getESObject();
+ String importURI = null;
+ if (eObject instanceof EPackage) {
+ EPackage ePackage = (EPackage)eObject;
+ Resource resource = ePackage.eResource();
+ if (ClassUtil.isRegistered(resource)) {
+ importURI = ePackage.getNsURI();
+ }
+ }
+ if ((importURI == null) && (csResource != null)) {
+ URI fullURI = EcoreUtil.getURI(eObject != null ? eObject : asNamespace);
+ URI csURI = csResource.getURI();
+ URI deresolvedURI = fullURI.deresolve(csURI, true, true, false);
+ importURI = deresolvedURI.toString();
+ }
+ ImportCS csImport = context.refreshElement(ImportCS.class, BaseCSPackage.Literals.IMPORT_CS, asUnit);
+ csImport.setPivot(asUnit);
+ csImport.setName(asUnit.getName());
+ PathNameCS csPathName = BaseCSFactory.eINSTANCE.createPathNameCS();
+ List<PathElementCS> csPath = csPathName.getOwnedPathElements();
+ PathElementWithURICS csSimpleRef = BaseCSFactory.eINSTANCE.createPathElementWithURICS();
+ csSimpleRef.setReferredElement(asNamespace);
+ csSimpleRef.setUri(importURI);
+ csPath.add(csSimpleRef);
+ csImport.setOwnedPathName(csPathName);
+ return csImport;
+ }
+
+ @Override
+ public ElementCS visitInConnectionVariable(@NonNull InConnectionVariable asVariable) {
+ InoutVariableCS csVariable = context.refreshNamedElement(InoutVariableCS.class, QVTimperativeCSPackage.Literals.INOUT_VARIABLE_CS, asVariable);
+ csVariable.setPivot(asVariable);
+ csVariable.setOwnedType(createTypeRefCS(asVariable.getType(), null)); //getScope(asVariable)));
+ return csVariable;
+ }
+
+ @Override
+ public ElementCS visitLoopVariable(@NonNull LoopVariable asVariable) {
+ VariableCS csVariable = context.refreshNamedElement(VariableCS.class, EssentialOCLCSPackage.Literals.VARIABLE_CS, asVariable);
+ Type type = asVariable.getType();
+ if ((type instanceof CollectionType) && (((CollectionType)type).getUnspecializedElement() != context.getMetamodelManager().getStandardLibrary().getCollectionType())) {
+ PivotUtil.debugWellContainedness(type);
+ type = ((CollectionType)type).getElementType();
+ }
+ else if (type instanceof VoidType) {
+ type = null;
+ }
+ if (type != null) {
+ PivotUtil.debugWellContainedness(type);
+ TypedRefCS typeRef = context.visitReference(TypedRefCS.class, type, null);
+ csVariable.setOwnedType(typeRef);
+ }
+ else {
+ csVariable.setOwnedType(null);
+ }
+ return csVariable;
}
@Override
@@ -513,16 +554,8 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
MappingCS csMapping = context.refreshNamedElement(MappingCS.class, QVTimperativeCSPackage.Literals.MAPPING_CS, asMapping);
csMapping.setPivot(asMapping);
refreshOwnedInTransformation(csMapping, asMapping);
+ context.refreshList(csMapping.getOwnedInoutVariables(), context.visitDeclarations(InoutVariableCS.class, asMapping.getInoutVariables(), null));
context.refreshList(csMapping.getOwnedDomains(), context.visitDeclarations(DomainCS.class, asMapping.getDomain(), null));
- DomainCS csDomain = context.refreshElement(DomainCS.class, QVTimperativeCSPackage.Literals.DOMAIN_CS, asMapping);
- csDomain.setPivot(null); // stop comment duplication
- csDomain.setOwnedBottomPattern(context.visitDeclaration(BottomPatternCS.class, asMapping.getBottomPattern()));
- csDomain.setOwnedGuardPattern(context.visitDeclaration(GuardPatternCS.class, asMapping.getGuardPattern()));
- Transformation asTransformation = QVTbaseUtil.getContainingTransformation(asMapping);
- assert asTransformation != null;
- refreshUsedProperties(asTransformation, csDomain.getCheckedProperties(), ClassUtil.nullFree(asMapping.getCheckedProperties()));
- refreshUsedProperties(asTransformation, csDomain.getCheckedProperties(), ClassUtil.nullFree(asMapping.getCheckedProperties()));
- csMapping.setOwnedMiddle(csDomain);
context.refreshList(csMapping.getOwnedStatements(), context.visitDeclarations(StatementCS.class, asMapping.getOwnedStatements(), null));
return csMapping;
}
@@ -563,6 +596,26 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
@Override
+ public ElementCS visitNewStatement(@NonNull NewStatement asNewStatement) {
+ TypedModel asTypedModel = asNewStatement.getReferredTypedModel();
+ org.eclipse.ocl.pivot.Package asUsedPackage = asTypedModel.getUsedPackage().size() > 0 ? asTypedModel.getUsedPackage().get(0) : null;
+ NewStatementCS csNewStatement = context.refreshNamedElement(NewStatementCS.class, QVTimperativeCSPackage.Literals.NEW_STATEMENT_CS, asNewStatement);
+ csNewStatement.setPivot(asNewStatement);
+ csNewStatement.setOwnedType(createTypeRefCS(asNewStatement.getType(), asUsedPackage));
+ csNewStatement.setReferredTypedModel(asTypedModel);
+ csNewStatement.setOwnedInit(context.visitDeclaration(ExpCS.class, asNewStatement.getOwnedInit()));
+ return csNewStatement;
+ }
+
+ @Override
+ public ElementCS visitOutConnectionVariable(@NonNull OutConnectionVariable asVariable) {
+ OutVariableCS csVariable = context.refreshNamedElement(OutVariableCS.class, QVTimperativeCSPackage.Literals.OUT_VARIABLE_CS, asVariable);
+ csVariable.setPivot(asVariable);
+ csVariable.setOwnedType(createTypeRefCS(asVariable.getType(), null)); //getScope(asVariable)));
+ return csVariable;
+ }
+
+ @Override
public ElementCS visitPackage(org.eclipse.ocl.pivot.@NonNull Package asPackage) {
// List<org.eclipse.ocl.pivot.@NonNull Class> asClasses = ClassUtil.nullFree(asPackage.getOwnedClasses());
// List<org.eclipse.ocl.pivot.@NonNull Package> asPackages = ClassUtil.nullFree(asPackage.getOwnedPackages());
@@ -592,38 +645,15 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
@Override
public ElementCS visitPredicate(@NonNull Predicate asPredicate) {
- EObject eContainer = asPredicate.eContainer();
- if (eContainer instanceof BottomPattern) {
- Area area = ((BottomPattern)eContainer).getArea();
- if (area instanceof Mapping) {
- PredicateOrAssignmentCS csPredicate = context.refreshElement(PredicateOrAssignmentCS.class, QVTimperativeCSPackage.Literals.PREDICATE_OR_ASSIGNMENT_CS, asPredicate);
- csPredicate.setPivot(asPredicate);
- csPredicate.setOwnedTarget(createExpCS(asPredicate.getConditionExpression()));
- return csPredicate;
- }
- }
- if (asPredicate.eContainer() instanceof GuardPattern) {
- PredicateCS csPredicate = context.refreshElement(PredicateCS.class, QVTimperativeCSPackage.Literals.PREDICATE_CS, asPredicate);
- csPredicate.setPivot(asPredicate);
- csPredicate.setOwnedCondition(createExpCS(asPredicate.getConditionExpression()));
- return csPredicate;
- }
- else {
- PredicateOrAssignmentCS csPredicate = context.refreshElement(PredicateOrAssignmentCS.class, QVTimperativeCSPackage.Literals.PREDICATE_OR_ASSIGNMENT_CS, asPredicate);
- csPredicate.setPivot(asPredicate);
- csPredicate.setOwnedTarget(createExpCS(asPredicate.getConditionExpression()));
- return csPredicate;
- }
+ throw new UnsupportedOperationException();
}
@Override
- public ElementCS visitNewStatement(@NonNull NewStatement asNewStatement) {
- NewStatementCS csNewStatement = context.refreshNamedElement(NewStatementCS.class, QVTimperativeCSPackage.Literals.NEW_STATEMENT_CS, asNewStatement);
- csNewStatement.setPivot(asNewStatement);
- csNewStatement.setOwnedType(createTypeRefCS(asNewStatement.getType(), getScope(asNewStatement)));
- csNewStatement.setReferredTypedModel(asNewStatement.getReferredTypedModel());
- csNewStatement.setOwnedInitExpression(context.visitDeclaration(ExpCS.class, asNewStatement.getOwnedInit()));
- return csNewStatement;
+ public ElementCS visitPredicateVariable(@NonNull PredicateVariable asVariable) {
+ PredicateVariableCS csVariable = refreshTypedElement(PredicateVariableCS.class, QVTimperativeCSPackage.Literals.PREDICATE_VARIABLE_CS, asVariable);
+ csVariable.setOwnedInit(context.visitDeclaration(ExpCS.class, asVariable.getOwnedInit()));
+ csVariable.setIsChecked(asVariable.isIsChecked());
+ return csVariable;
}
@Override
@@ -634,9 +664,10 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
@Override
public ElementCS visitSetStatement(@NonNull SetStatement asSetStatement) {
SetStatementCS csStatement = context.refreshElement(SetStatementCS.class, QVTimperativeCSPackage.Literals.SET_STATEMENT_CS, asSetStatement);
- csStatement.setReferredVariable((Variable) asSetStatement.getSlotExpression().getReferredVariable());
+ csStatement.setReferredVariable(asSetStatement.getTargetVariable());
csStatement.setReferredProperty(QVTimperativeUtil.getTargetProperty(asSetStatement));
- csStatement.setOwnedInitExpression(createExpCS(asSetStatement.getValue()));
+ csStatement.setOwnedInit(createExpCS(asSetStatement.getValue()));
+ csStatement.setIsEmit(asSetStatement.isIsEmit());
return csStatement;
}
@@ -674,108 +705,33 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
@Override
- public @Nullable ElementCS visitImport(@NonNull Import asUnit) {
- BaseCSResource csResource = context.getCSResource();
- Namespace asNamespace = asUnit.getImportedNamespace();
- EObject eObject = asNamespace.getESObject();
- String importURI = null;
- if (eObject instanceof EPackage) {
- EPackage ePackage = (EPackage)eObject;
- Resource resource = ePackage.eResource();
- if (ClassUtil.isRegistered(resource)) {
- importURI = ePackage.getNsURI();
- }
- }
- if ((importURI == null) && (csResource != null)) {
- URI fullURI = EcoreUtil.getURI(eObject != null ? eObject : asNamespace);
- URI csURI = csResource.getURI();
- URI deresolvedURI = fullURI.deresolve(csURI, true, true, false);
- importURI = deresolvedURI.toString();
- }
- ImportCS csImport = context.refreshElement(ImportCS.class, BaseCSPackage.Literals.IMPORT_CS, asUnit);
- csImport.setPivot(asUnit);
- csImport.setName(asUnit.getName());
- PathNameCS csPathName = BaseCSFactory.eINSTANCE.createPathNameCS();
- List<PathElementCS> csPath = csPathName.getOwnedPathElements();
- PathElementWithURICS csSimpleRef = BaseCSFactory.eINSTANCE.createPathElementWithURICS();
- csSimpleRef.setReferredElement(asNamespace);
- csSimpleRef.setUri(importURI);
- csPath.add(csSimpleRef);
- csImport.setOwnedPathName(csPathName);
- return csImport;
- }
-
- @Override
public ElementCS visitVariable(@NonNull Variable asVariable) {
- if (asVariable.eContainer() instanceof MappingLoop) {
- VariableCS csVariable = context.refreshNamedElement(VariableCS.class, EssentialOCLCSPackage.Literals.VARIABLE_CS, asVariable);
- Type type = asVariable.getType();
- if ((type instanceof CollectionType) && (((CollectionType)type).getUnspecializedElement() != context.getMetamodelManager().getStandardLibrary().getCollectionType())) {
- PivotUtil.debugWellContainedness(type);
- type = ((CollectionType)type).getElementType();
- }
- else if (type instanceof VoidType) {
- type = null;
- }
- if (type != null) {
- PivotUtil.debugWellContainedness(type);
- TypedRefCS typeRef = context.visitReference(TypedRefCS.class, type, null);
- csVariable.setOwnedType(typeRef);
- }
- else {
- csVariable.setOwnedType(null);
- }
- // refreshList(csElement.getOwnedConstraint(), visitDeclarations(ConstraintCS.class, object.getOwnedRule(), null));
- return csVariable;
- }
- else if (asVariable.eContainer() instanceof GuardPattern){
+ assert !(asVariable.eContainer() instanceof Mapping);
+ /* if (asVariable.eContainer() instanceof Mapping) {
Mapping containingMapping = QVTimperativeUtil.getContainingMapping(asVariable);
assert containingMapping != null;
- UnrealizedVariableCS csUnrealizedVariable = context.refreshNamedElement(UnrealizedVariableCS.class, QVTimperativeCSPackage.Literals.UNREALIZED_VARIABLE_CS, asVariable);
- csUnrealizedVariable.setPivot(asVariable);
- csUnrealizedVariable.setOwnedType(createTypeRefCS(asVariable.getType(), getScope(asVariable)));
- OCLExpression ownedInit = null;
- for (Predicate asPredicate : containingMapping.getGuardPattern().getPredicate()) {
+ for (CheckStatement asPredicate : containingMapping.getGuardPredicates()) {
if (asPredicate instanceof VariablePredicate) {
VariablePredicate asVariablePredicate = (VariablePredicate)asPredicate;
if (asVariablePredicate.getTargetVariable() == asVariable) {
- ownedInit = asVariablePredicate.getConditionExpression();
- break;
+ OCLExpression ownedInit = asVariablePredicate.getConditionExpression();
+ PredicateVariableCS csUnrealizedVariable = context.refreshNamedElement(PredicateVariableCS.class, QVTimperativeCSPackage.Literals.PREDICATE_VARIABLE_CS, asVariable);
+ csUnrealizedVariable.setPivot(asVariable);
+ csUnrealizedVariable.setOwnedType(createTypeRefCS(asVariable.getType(), getScope(asVariable)));
+ csUnrealizedVariable.setOwnedInitExpression(context.visitDeclaration(ExpCS.class, ownedInit));
+ return csUnrealizedVariable;
}
}
}
- csUnrealizedVariable.setOwnedInitExpression(context.visitDeclaration(ExpCS.class, ownedInit));
- csUnrealizedVariable.setIsConnection(asVariable instanceof ConnectionVariable);
- return csUnrealizedVariable;
- }
- else {
- if (asVariable.eContainer() instanceof ImperativePattern) {
- UnrealizedVariableCS csUnrealizedVariable = refreshTypedElement(UnrealizedVariableCS.class, QVTimperativeCSPackage.Literals.UNREALIZED_VARIABLE_CS, asVariable);
- csUnrealizedVariable.setOwnedInitExpression(context.visitDeclaration(ExpCS.class, asVariable.getOwnedInit()));
- csUnrealizedVariable.setIsConnection(asVariable instanceof ConnectionVariable);
- return csUnrealizedVariable;
- }
- else {
- return super.visitVariable(asVariable);
- }
- }
- }
-
- @Override
- public ElementCS visitVariableAssignment(@NonNull VariableAssignment asVariableAssignment) {
- PredicateOrAssignmentCS csAssignment = context.refreshElement(PredicateOrAssignmentCS.class, QVTimperativeCSPackage.Literals.PREDICATE_OR_ASSIGNMENT_CS, asVariableAssignment);
- csAssignment.setPivot(asVariableAssignment);
- Variable asVariable = asVariableAssignment.getTargetVariable();
- if (asVariable != null) {
- assert (asVariable.eContainer() instanceof BottomPattern) || !(asVariable.eContainer().eContainer() instanceof Mapping);
- csAssignment.setOwnedTarget(createNameExpCS(asVariable));
+ throw new UnsupportedOperationException(); // Should be GuardVariable
}
- csAssignment.setOwnedInitExpression(context.visitDeclaration(ExpCS.class, asVariableAssignment.getValue()));
- return csAssignment;
+ else { */
+ return super.visitVariable(asVariable);
+ // }
}
@Override
- public ElementCS visitVariablePredicate(@NonNull VariablePredicate asVariablePredicate) {
- return null;
+ public ElementCS visitVariableStatement(@NonNull VariableStatement object) {
+ return visiting(object);
}
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java
index a3503941e..53d232ee0 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java
@@ -16,14 +16,12 @@ import java.util.List;
import java.util.Map;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.Import;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.PivotPackage;
-import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
@@ -34,78 +32,53 @@ import org.eclipse.ocl.xtext.base.cs2as.Continuation;
import org.eclipse.ocl.xtext.base.cs2as.SingleContinuation;
import org.eclipse.ocl.xtext.base.utilities.BaseCSResource;
import org.eclipse.ocl.xtext.basecs.PathNameCS;
-import org.eclipse.ocl.xtext.essentialoclcs.ExpCS;
-import org.eclipse.ocl.xtext.essentialoclcs.NameExpCS;
import org.eclipse.qvtd.pivot.qvtbase.Function;
import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
-import org.eclipse.qvtd.pivot.qvtbase.Predicate;
import org.eclipse.qvtd.pivot.qvtbase.QVTbasePackage;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
import org.eclipse.qvtd.xtext.qvtimperativecs.AddStatementCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.BottomPatternCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.CheckStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DirectionCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.GuardPatternCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.GuardVariableCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.InoutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallBindingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingLoopCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.NewStatementCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.OutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.ParamDeclarationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateOrAssignmentCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.QueryCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.SetStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TopLevelCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TransformationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.UnrealizedVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.util.AbstractQVTimperativeCSContainmentVisitor;
-import com.google.common.collect.Iterables;
-
public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSContainmentVisitor
{
- protected static class IsAssignmentPredicate implements com.google.common.base.Predicate<PredicateOrAssignmentCS>
- {
- public final static @NonNull IsAssignmentPredicate INSTANCE = new IsAssignmentPredicate();
-
- @Override
- public boolean apply(PredicateOrAssignmentCS csAssignment) {
- return csAssignment.getOwnedInitExpression() != null;
- }
- }
-
- protected static class IsPredicatePredicate implements com.google.common.base.Predicate<PredicateOrAssignmentCS>
- {
- public final static @NonNull IsPredicatePredicate INSTANCE = new IsPredicatePredicate();
-
- @Override
- public boolean apply(PredicateOrAssignmentCS csAssignment) {
- return csAssignment.getOwnedInitExpression() == null;
- }
- }
-
protected static class DirectionContentContinuation extends SingleContinuation<DirectionCS>
{
private DirectionContentContinuation(@NonNull CS2ASConversion context, @NonNull DirectionCS csElement) {
@@ -215,12 +188,8 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
}
@Override
- public Continuation<?> visitBottomPatternCS(@NonNull BottomPatternCS csElement) {
- BottomPattern pBottomPattern = context.refreshModelElement(BottomPattern.class, QVTimperativePackage.Literals.BOTTOM_PATTERN, csElement);
- context.refreshPivotList(Variable.class, pBottomPattern.getVariable(), csElement.getOwnedUnrealizedVariables());
- context.refreshPivotList(Assignment.class, pBottomPattern.getAssignment(), Iterables.filter(csElement.getOwnedConstraints(), IsAssignmentPredicate.INSTANCE));
- context.refreshPivotList(Predicate.class, pBottomPattern.getPredicate(), Iterables.filter(csElement.getOwnedConstraints(), IsPredicatePredicate.INSTANCE));
- context.refreshComments(pBottomPattern, csElement);
+ public Continuation<?> visitCheckStatementCS(@NonNull CheckStatementCS csElement) {
+ context.refreshModelElement(CheckStatement.class, QVTimperativePackage.Literals.CHECK_STATEMENT, csElement);
return null;
}
@@ -237,55 +206,32 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
@Override
public Continuation<?> visitDomainCS(@NonNull DomainCS csElement) {
- EObject eContainer = csElement.eContainer();
- if ((eContainer instanceof MappingCS) && (((MappingCS)eContainer).getOwnedMiddle() == csElement)) {
- return null;
- }
ImperativeDomain pivotElement = context.refreshModelElement(ImperativeDomain.class, QVTimperativePackage.Literals.IMPERATIVE_DOMAIN, csElement);
pivotElement.setIsCheckable(csElement.isIsCheck());
pivotElement.setIsEnforceable(csElement.isIsEnforce());
- pivotElement.setBottomPattern(PivotUtil.getPivot(BottomPattern.class, csElement.getOwnedBottomPattern()));
- pivotElement.setGuardPattern(PivotUtil.getPivot(GuardPattern.class, csElement.getOwnedGuardPattern()));
+ context.refreshPivotList(GuardVariable.class, pivotElement.getOwnedGuardVariables(), csElement.getOwnedGuardVariables());
context.refreshComments(pivotElement, csElement);
return new DomainContentContinuation(context, csElement);
}
@Override
- public Continuation<?> visitGuardPatternCS(@NonNull GuardPatternCS csElement) {
- @NonNull GuardPattern pGuardPattern = context.refreshModelElement(GuardPattern.class, QVTimperativePackage.Literals.GUARD_PATTERN, csElement);
- context.refreshPivotList(Variable.class, pGuardPattern.getVariable(), csElement.getOwnedUnrealizedVariables());
- context.refreshPivotList(Predicate.class, pGuardPattern.getPredicate(), csElement.getOwnedPredicates());
- context.refreshComments(pGuardPattern, csElement);
+ public Continuation<?> visitGuardVariableCS(@NonNull GuardVariableCS csElement) {
+ refreshNamedElement(GuardVariable.class, QVTimperativePackage.Literals.GUARD_VARIABLE, csElement);
+ return null;
+ }
+
+ @Override
+ public Continuation<?> visitInoutVariableCS(@NonNull InoutVariableCS csElement) {
+ refreshNamedElement(InConnectionVariable.class, QVTimperativePackage.Literals.IN_CONNECTION_VARIABLE, csElement);
return null;
}
@Override
public Continuation<?> visitMappingCS(@NonNull MappingCS csElement) {
@NonNull Mapping pivotElement = refreshNamedElement(Mapping.class, QVTimperativePackage.Literals.MAPPING, csElement);
- DomainCS csMiddle = csElement.getOwnedMiddle();
- if (csMiddle != null) {
- pivotElement.setBottomPattern(PivotUtil.getPivot(BottomPattern.class, csMiddle.getOwnedBottomPattern()));
- pivotElement.setGuardPattern(PivotUtil.getPivot(GuardPattern.class, csMiddle.getOwnedGuardPattern()));
- }
- else {
- BottomPattern bottomPattern = pivotElement.getBottomPattern();
- if (bottomPattern == null) {
- bottomPattern = QVTimperativeFactory.eINSTANCE.createBottomPattern();
- bottomPattern.getAssignment().clear();
- bottomPattern.getBindsTo().clear();
- bottomPattern.getPredicate().clear();
- bottomPattern.getVariable().clear();
- pivotElement.setBottomPattern(bottomPattern);
- }
- GuardPattern guardPattern = pivotElement.getGuardPattern();
- if (guardPattern == null) {
- guardPattern = QVTimperativeFactory.eINSTANCE.createGuardPattern();
- guardPattern.getBindsTo().clear();
- guardPattern.getPredicate().clear();
- guardPattern.getVariable().clear();
- pivotElement.setGuardPattern(guardPattern);
- }
- }
+ // DomainCS csMiddle = csElement.getOwnedMiddle();
+ // context.refreshPivotList(GuardVariable.class, pivotElement.getOwnedGuardVariables(), csMiddle.getOwnedGuardVariables());
+ context.refreshPivotList(InConnectionVariable.class, pivotElement.getInoutVariables(), csElement.getOwnedInoutVariables());
context.refreshPivotList(ImperativeDomain.class, pivotElement.getDomain(), csElement.getOwnedDomains());
context.refreshPivotList(Statement.class, pivotElement.getOwnedStatements(), csElement.getOwnedStatements());
return null;
@@ -311,13 +257,10 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
@Override
public Continuation<?> visitMappingLoopCS(@NonNull MappingLoopCS csMappingLoop) {
@NonNull MappingLoop pivotElement = context.refreshModelElement(MappingLoop.class, QVTimperativePackage.Literals.MAPPING_LOOP, csMappingLoop);
- @NonNull Variable iterator = refreshNamedElement(Variable.class, PivotPackage.Literals.VARIABLE, ClassUtil.nonNullState(csMappingLoop.getOwnedIterator()));
+ @NonNull LoopVariable iterator = refreshNamedElement(LoopVariable.class, QVTimperativePackage.Literals.LOOP_VARIABLE, ClassUtil.nonNullState(csMappingLoop.getOwnedIterator()));
pivotElement.getOwnedIterators().clear();
pivotElement.getOwnedIterators().add(iterator);
context.refreshPivotList(MappingStatement.class, pivotElement.getOwnedMappingStatements(), csMappingLoop.getOwnedMappingStatements());
- // CollectionType collectionType = metamodelManager.getCollectionType();
- // DomainOperation forAllIteration = ClassUtil.getNamedElement(collectionType.getLocalOperations(), "forAll");
- // pivotElement.setReferredIteration((Iteration) forAllIteration);
context.refreshComments(pivotElement, csMappingLoop);
return null;
}
@@ -329,30 +272,21 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
}
@Override
- public Continuation<?> visitParamDeclarationCS(@NonNull ParamDeclarationCS csElement) {
- refreshNamedElement(FunctionParameter.class, QVTbasePackage.Literals.FUNCTION_PARAMETER, csElement);
+ public Continuation<?> visitOutVariableCS(@NonNull OutVariableCS csElement) {
+ refreshNamedElement(OutConnectionVariable.class, QVTimperativePackage.Literals.OUT_CONNECTION_VARIABLE, csElement);
return null;
}
@Override
- public Continuation<?> visitPredicateCS(@NonNull PredicateCS csElement) {
- context.refreshModelElement(Predicate.class, QVTbasePackage.Literals.PREDICATE, csElement);
+ public Continuation<?> visitParamDeclarationCS(@NonNull ParamDeclarationCS csElement) {
+ refreshNamedElement(FunctionParameter.class, QVTbasePackage.Literals.FUNCTION_PARAMETER, csElement);
return null;
}
@Override
- public @Nullable Continuation<?> visitPredicateOrAssignmentCS(@NonNull PredicateOrAssignmentCS csElement) {
- ExpCS csTarget = csElement.getOwnedTarget();
- EObject eContainer = csElement.eContainer();
- if ((csElement.getOwnedInitExpression() == null) || (eContainer instanceof GuardPatternCS)) {
- context.refreshModelElement(Predicate.class, QVTbasePackage.Literals.PREDICATE, csElement);
- }
- else if (csTarget instanceof NameExpCS) {
- context.refreshModelElement(VariableAssignment.class, QVTimperativePackage.Literals.VARIABLE_ASSIGNMENT, csElement);
- }
- else {
- throw new IllegalStateException();
- }
+ public Continuation<?> visitPredicateVariableCS(@NonNull PredicateVariableCS csElement) {
+ PredicateVariable asElement = refreshNamedElement(PredicateVariable.class, QVTimperativePackage.Literals.PREDICATE_VARIABLE, csElement);
+ asElement.setIsChecked(csElement.isIsChecked());
return null;
}
@@ -370,8 +304,9 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
}
@Override
- public @Nullable Continuation<?> visitSetStatementCS(@NonNull SetStatementCS csElement) {
- context.refreshModelElement(SetStatement.class, QVTimperativePackage.Literals.SET_STATEMENT, csElement);
+ public @Nullable Continuation<?> visitSetStatementCS(@NonNull SetStatementCS csSetStatement) {
+ SetStatement asSetStatement = context.refreshModelElement(SetStatement.class, QVTimperativePackage.Literals.SET_STATEMENT, csSetStatement);
+ asSetStatement.setIsEmit(csSetStatement.isIsEmit());
return null;
}
@@ -409,16 +344,4 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
QVTbaseUtil.getContextVariable(standardLibrary, asTransformation);
return null;
}
-
- @Override
- public Continuation<?> visitUnrealizedVariableCS(@NonNull UnrealizedVariableCS csElement) {
- if (csElement.isIsConnection()) {
- refreshNamedElement(ConnectionVariable.class, QVTimperativePackage.Literals.CONNECTION_VARIABLE, csElement);
- }
- else {
- refreshNamedElement(Variable.class, PivotPackage.Literals.VARIABLE, csElement);
- }
- return null;
- }
-
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java
index e1e46dce4..0e377859b 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java
@@ -10,20 +10,15 @@
*******************************************************************************/
package org.eclipse.qvtd.xtext.qvtimperative.cs2as;
-import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.CollectionType;
-import org.eclipse.ocl.pivot.NavigationCallExp;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.Variable;
-import org.eclipse.ocl.pivot.VariableExp;
-import org.eclipse.ocl.pivot.internal.utilities.PivotUtilInternal;
-import org.eclipse.ocl.pivot.utilities.ClassUtil;
+import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.ocl.xtext.base.cs2as.BasicContinuation;
import org.eclipse.ocl.xtext.base.cs2as.CS2ASConversion;
@@ -32,40 +27,30 @@ import org.eclipse.ocl.xtext.base.cs2as.SingleContinuation;
import org.eclipse.ocl.xtext.basecs.ConstraintCS;
import org.eclipse.ocl.xtext.essentialoclcs.ExpCS;
import org.eclipse.qvtd.pivot.qvtbase.Function;
-import org.eclipse.qvtd.pivot.qvtbase.Predicate;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
-import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
-import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
+import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
-import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
import org.eclipse.qvtd.xtext.qvtimperativecs.AddStatementCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.AreaCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.BottomPatternCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.CheckStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DirectionCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.GuardPatternCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.GuardVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallBindingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingLoopCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.NewStatementCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.OutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.ParamDeclarationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.PatternCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateOrAssignmentCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.SetStatementCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.QueryCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.SetStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TopLevelCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TransformationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.UnrealizedVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.util.AbstractQVTimperativeCSPostOrderVisitor;
public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPostOrderVisitor
@@ -112,19 +97,11 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
return propertyAssignment;
} */
- protected @Nullable Assignment refreshVariableAssignment(@NonNull VariableExp variableExp, @NonNull PredicateOrAssignmentCS csConstraint) {
- VariableAssignment variableAssignment = PivotUtil.getPivot(VariableAssignment.class, csConstraint);
- if (variableAssignment != null) {
- variableAssignment.setTargetVariable((Variable) variableExp.getReferredVariable());
- }
- return variableAssignment;
- }
-
@Override
public @Nullable Continuation<?> visitAddStatementCS(@NonNull AddStatementCS csElement) {
AddStatement asAddStatement = PivotUtil.getPivot(AddStatement.class, csElement);
if (asAddStatement != null) {
- asAddStatement.setTargetVariable((ConnectionVariable) csElement.getTargetVariable());
+ asAddStatement.setTargetVariable(csElement.getTargetVariable());
ExpCS csInitialiser = csElement.getOwnedExpression();
if (csInitialiser != null) {
OCLExpression initialiser = context.visitLeft2Right(OCLExpression.class, csInitialiser);
@@ -135,48 +112,15 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
}
@Override
- public Continuation<?> visitAreaCS(@NonNull AreaCS csElement) {
- return null;
- }
-
- @Override
- public Continuation<?> visitBottomPatternCS(@NonNull BottomPatternCS csElement) {
- BottomPattern pBottomPattern = PivotUtil.getPivot(BottomPattern.class, csElement);
- if (pBottomPattern != null) {
- List<@NonNull Assignment> pAssignments = new ArrayList<>();
- List<@NonNull Predicate> pPredicates = new ArrayList<>();
- for (PredicateOrAssignmentCS csConstraint : csElement.getOwnedConstraints()) {
- ExpCS csTarget = csConstraint.getOwnedTarget();
- ExpCS csInitialiser = csConstraint.getOwnedInitExpression();
- OCLExpression target = csTarget != null ? context.visitLeft2Right(OCLExpression.class, csTarget) : null;
- if (csInitialiser != null) {
- Assignment assignment = null;
- if (target instanceof NavigationCallExp) {
- throw new IllegalStateException();
- // assignment = refreshPropertyAssignment((NavigationCallExp)target, csConstraint);
- }
- else if (target instanceof VariableExp) {
- assignment = refreshVariableAssignment((VariableExp)target, csConstraint);
- }
- else if (target != null) {
- context.addDiagnostic(csElement, "unrecognised Constraint target " + target.eClass().getName());
- }
- if (assignment != null) {
- OCLExpression initialiser = context.visitLeft2Right(OCLExpression.class, csInitialiser);
- assignment.setValue(initialiser);
- pAssignments.add(assignment);
- }
- }
- else {
- Predicate predicate = PivotUtil.getPivot(Predicate.class, csConstraint);
- if (predicate != null) {
- predicate.setConditionExpression(target);
- pPredicates.add(predicate);
- }
- }
+ public Continuation<?> visitCheckStatementCS(@NonNull CheckStatementCS csElement) {
+ CheckStatement asPredicate = PivotUtil.getPivot(CheckStatement.class, csElement);
+ if (asPredicate != null) {
+ OCLExpression asCondition = null;
+ ExpCS csCondition = csElement.getOwnedCondition();
+ if (csCondition != null) {
+ asCondition = context.visitLeft2Right(OCLExpression.class, csCondition);
}
- PivotUtilInternal.refreshList(pBottomPattern.getAssignment(), pAssignments);
- PivotUtilInternal.refreshList(pBottomPattern.getPredicate(), pPredicates);
+ asPredicate.setConditionExpression(asCondition);
}
return null;
}
@@ -197,49 +141,12 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
}
@Override
- public Continuation<?> visitGuardPatternCS(@NonNull GuardPatternCS csElement) {
- GuardPattern asGuardPattern = PivotUtil.getPivot(GuardPattern.class, csElement);
- if (asGuardPattern != null) {
- context.refreshList(Predicate.class, ClassUtil.nullFree(asGuardPattern.getPredicate()), csElement.getOwnedPredicates());
- }
+ public Continuation<?> visitGuardVariableCS(@NonNull GuardVariableCS csElement) {
return null;
}
@Override
public Continuation<?> visitMappingCS(@NonNull MappingCS csElement) {
- Mapping asMapping = PivotUtil.getPivot(Mapping.class, csElement);
- if (asMapping != null) {
- List<@NonNull VariablePredicate> asVariablePredicates = null;
- for (DomainCS csDomain : csElement.getOwnedDomains()) {
- GuardPatternCS csGuardPattern = csDomain.getOwnedGuardPattern();
- for (UnrealizedVariableCS csVariable : csGuardPattern.getOwnedUnrealizedVariables()) {
- Variable asVariable = PivotUtil.getPivot(Variable.class, csVariable);
- if (asVariable != null) {
- ExpCS csGuardExpression = csVariable.getOwnedInitExpression();
- if (csGuardExpression != null) {
- OCLExpression asExpression = context.visitLeft2Right(OCLExpression.class, csGuardExpression);
- if (asExpression != null) {
- VariablePredicate asVariablePredicate = QVTimperativeFactory.eINSTANCE.createVariablePredicate();
- asVariablePredicate.setTargetVariable(asVariable);
- asVariablePredicate.setConditionExpression(asExpression);
- if (asVariablePredicates == null) {
- asVariablePredicates = new ArrayList<>();
- }
- asVariablePredicates.add(asVariablePredicate);
- }
- }
- }
- }
- }
- if (asVariablePredicates != null) {
- List<Predicate> asPredicates = asMapping.getGuardPattern().getPredicate();
- List<VariablePredicate> asSortedPredicates = QVTimperativeUtil.sortVariablePredicates(asMapping, asVariablePredicates);
- int j = 0;
- for (VariablePredicate asVariablePredicate : asSortedPredicates) {
- asPredicates.add(j++, asVariablePredicate);
- }
- }
- }
return null;
}
@@ -257,9 +164,9 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
OCLExpression target = context.visitLeft2Right(OCLExpression.class, expression);
if (target != null) {
pMappingLoop.setOwnedSource(target);
- List<Variable> iterators = pMappingLoop.getOwnedIterators();
+ List<LoopVariable> iterators = pMappingLoop.getOwnedIterators();
if (iterators.size() > 0) {
- Variable iterator = iterators.get(0);
+ LoopVariable iterator = iterators.get(0);
if (iterator.getType() == null) {
Type type = target.getType();
if (type instanceof CollectionType) {
@@ -279,7 +186,7 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
NewStatement asNewStatement = PivotUtil.getPivot(NewStatement.class, csElement);
if (asNewStatement != null) {
asNewStatement.setReferredTypedModel(csElement.getReferredTypedModel());
- ExpCS expression = csElement.getOwnedInitExpression();
+ ExpCS expression = csElement.getOwnedInit();
if (expression != null) {
OCLExpression target = context.visitLeft2Right(OCLExpression.class, expression);
asNewStatement.setOwnedInit(target);
@@ -289,34 +196,55 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
}
@Override
- public Continuation<?> visitParamDeclarationCS(@NonNull ParamDeclarationCS object) {
+ public Continuation<?> visitOutVariableCS(@NonNull OutVariableCS csElement) {
return null;
}
@Override
- public Continuation<?> visitPatternCS(@NonNull PatternCS object) {
+ public Continuation<?> visitParamDeclarationCS(@NonNull ParamDeclarationCS object) {
return null;
}
@Override
- public Continuation<?> visitPredicateCS(@NonNull PredicateCS csElement) {
- Predicate asPredicate = PivotUtil.getPivot(Predicate.class, csElement);
- if (asPredicate != null) {
- OCLExpression asCondition = null;
- ExpCS csCondition = csElement.getOwnedCondition();
- if (csCondition != null) {
- asCondition = context.visitLeft2Right(OCLExpression.class, csCondition);
+ public Continuation<?> visitPredicateVariableCS(@NonNull PredicateVariableCS csElement) {
+ PredicateVariable asVariable = PivotUtil.getPivot(PredicateVariable.class, csElement);
+ if (asVariable != null) {
+ ExpCS expression = csElement.getOwnedInit();
+ if (expression != null) {
+ OCLExpression target = context.visitLeft2Right(OCLExpression.class, expression);
+ asVariable.setOwnedInit(target);
}
- asPredicate.setConditionExpression(asCondition);
}
return null;
}
-
- @Override
- public Continuation<?> visitPredicateOrAssignmentCS(@NonNull PredicateOrAssignmentCS csElement) {
+ /* @Override
+ public Continuation<?> visitCheckVariableStatementCS(@NonNull CheckVariableStatementCS csElement) {
+ ExpCS csTarget = csElement.getOwnedTarget();
+ assert csTarget != null;
+ OCLExpression target = context.visitLeft2Right(OCLExpression.class, csTarget);
+ ExpCS csInitialiser = csElement.getOwnedInit();
+ assert csInitialiser != null;
+ CheckVariableStatement assignment = null;
+ if (target instanceof NavigationCallExp) {
+ throw new IllegalStateException();
+ }
+ else if (target instanceof VariableExp) {
+ CheckVariableStatement variableAssignment = PivotUtil.getPivot(CheckVariableStatement.class, csElement);
+ if (variableAssignment != null) {
+ variableAssignment.setTargetVariable(((VariableExp)target).getReferredVariable());
+ }
+ }
+ else if (target != null) {
+ context.addDiagnostic(csElement, "unrecognised Constraint target " + target.eClass().getName());
+ }
+ if (assignment != null) {
+ OCLExpression initialiser = context.visitLeft2Right(OCLExpression.class, csInitialiser);
+ assignment.setOwnedInit(initialiser);
+ // pAssignments.add(assignment);
+ }
return null;
- }
+ } */
@Override
public Continuation<?> visitQueryCS(@NonNull QueryCS csElement) {
@@ -335,11 +263,11 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
public Continuation<?> visitSetStatementCS(@NonNull SetStatementCS csElement) {
SetStatement setStatement = PivotUtil.getPivot(SetStatement.class, csElement);
if (setStatement != null) {
- Variable targetVariable = csElement.getReferredVariable();
+ VariableDeclaration targetVariable = csElement.getReferredVariable();
assert targetVariable != null;
- setStatement.setSlotExpression(PivotUtil.createVariableExp(targetVariable));
+ setStatement.setTargetVariable(targetVariable);
Property targetProperty = csElement.getReferredProperty();
- ExpCS csInitialiser = csElement.getOwnedInitExpression();
+ ExpCS csInitialiser = csElement.getOwnedInit();
OCLExpression target = csInitialiser != null ? context.visitLeft2Right(OCLExpression.class, csInitialiser) : null;
setStatement.setTargetProperty(targetProperty);
// propertyAssignment.setIsOpposite(target instanceof FeatureCallExp); // FIXME isOpposite
@@ -358,20 +286,4 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
public Continuation<?> visitTransformationCS(@NonNull TransformationCS object) {
return null;
}
-
- @Override
- public Continuation<?> visitUnrealizedVariableCS(@NonNull UnrealizedVariableCS csElement) {
- if (csElement.eContainer() instanceof GuardPatternCS) {
- return null; // 'initExpression' is a guardExpression resolved by MappingCS
- }
- Variable asVariable = PivotUtil.getPivot(Variable.class, csElement);
- if (asVariable != null) {
- ExpCS expression = csElement.getOwnedInitExpression();
- if (expression != null) {
- OCLExpression target = context.visitLeft2Right(OCLExpression.class, expression);
- asVariable.setOwnedInit(target);
- }
- }
- return null;
- }
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java
index 834121252..6a7b054ee 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java
@@ -19,7 +19,6 @@ import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.PivotPackage;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.internal.scoping.ScopeFilter;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.ocl.xtext.base.cs2as.BasicContinuation;
@@ -35,34 +34,73 @@ import org.eclipse.ocl.xtext.essentialoclcs.VariableCS;
import org.eclipse.qvtd.pivot.qvtbase.Function;
import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtimperative.Area;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
+import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.PredicateVariable;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
-import org.eclipse.qvtd.xtext.qvtimperativecs.BottomPatternCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.CheckStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DirectionCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.GuardPatternCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.GuardVariableCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.InoutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallBindingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingLoopCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.NewStatementCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.OutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.ParamDeclarationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateOrAssignmentCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.SetStatementCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.QueryCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.SetStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TopLevelCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TransformationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.UnrealizedVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.util.AbstractQVTimperativeCSPreOrderVisitor;
public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOrderVisitor
{
- public static class MappingLoopIteratorCompletion extends SingleContinuation<MappingLoopCS>
+ public static class GuardVariableCompletion extends SingleContinuation<@NonNull GuardVariableCS>
+ {
+ public GuardVariableCompletion(@NonNull CS2ASConversion context, @NonNull GuardVariableCS csElement) {
+ super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ }
+
+ @Override
+ public BasicContinuation<?> execute() {
+ GuardVariable pivotElement = PivotUtil.getPivot(GuardVariable.class, csElement);
+ if (pivotElement != null) {
+ context.refreshRequiredType(pivotElement, csElement);
+ pivotElement.setReferredTypedModel(csElement.getReferredTypedModel());
+ }
+ return null;
+ }
+ }
+
+ public static class InoutVariableCompletion extends SingleContinuation<@NonNull InoutVariableCS>
+ {
+ public InoutVariableCompletion(@NonNull CS2ASConversion context, @NonNull InoutVariableCS csElement) {
+ super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ }
+
+ @Override
+ public BasicContinuation<?> execute() {
+ InConnectionVariable pivotElement = PivotUtil.getPivot(InConnectionVariable.class, csElement);
+ if (pivotElement != null) {
+ context.refreshRequiredType(pivotElement, csElement);
+ }
+ return null;
+ }
+ }
+
+ public static class MappingLoopIteratorCompletion extends SingleContinuation<@NonNull MappingLoopCS>
{
protected static PivotDependency[] computeDependencies(@NonNull MappingLoopCS csElement) {
VariableCS csIterator = csElement.getOwnedIterator();
@@ -83,7 +121,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public BasicContinuation<?> execute() {
MappingLoop pivotElement = PivotUtil.getPivot(MappingLoop.class, csElement);
if (pivotElement != null) {
- Variable iterator = pivotElement.getOwnedIterators().get(0);
+ LoopVariable iterator = pivotElement.getOwnedIterators().get(0);
if (iterator != null) {
VariableCS csIterator = csElement.getOwnedIterator();
if (csIterator != null) {
@@ -96,7 +134,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
}
}
- public static class NewStatementCompletion extends SingleContinuation<NewStatementCS>
+ public static class NewStatementCompletion extends SingleContinuation<@NonNull NewStatementCS>
{
public NewStatementCompletion(@NonNull CS2ASConversion context, @NonNull NewStatementCS csElement) {
super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
@@ -104,7 +142,23 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
@Override
public BasicContinuation<?> execute() {
- Variable pivotElement = PivotUtil.getPivot(Variable.class, csElement);
+ NewStatement pivotElement = PivotUtil.getPivot(NewStatement.class, csElement);
+ if (pivotElement != null) {
+ context.refreshRequiredType(pivotElement, csElement);
+ }
+ return null;
+ }
+ }
+
+ public static class OutVariableCompletion extends SingleContinuation<@NonNull OutVariableCS>
+ {
+ public OutVariableCompletion(@NonNull CS2ASConversion context, @NonNull OutVariableCS csElement) {
+ super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ }
+
+ @Override
+ public BasicContinuation<?> execute() {
+ OutConnectionVariable pivotElement = PivotUtil.getPivot(OutConnectionVariable.class, csElement);
if (pivotElement != null) {
context.refreshRequiredType(pivotElement, csElement);
}
@@ -112,7 +166,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
}
}
- public static class ParamDeclarationCompletion extends SingleContinuation<ParamDeclarationCS>
+ public static class ParamDeclarationCompletion extends SingleContinuation<@NonNull ParamDeclarationCS>
{
public ParamDeclarationCompletion(@NonNull CS2ASConversion context, @NonNull ParamDeclarationCS csElement) {
super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
@@ -128,15 +182,15 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
}
}
- public static class QueryCompletion extends SingleContinuation<QueryCS>
+ public static class PredicateVariableCompletion extends SingleContinuation<@NonNull PredicateVariableCS>
{
- public QueryCompletion(@NonNull CS2ASConversion context, @NonNull QueryCS csElement) {
+ public PredicateVariableCompletion(@NonNull CS2ASConversion context, @NonNull PredicateVariableCS csElement) {
super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
}
@Override
public BasicContinuation<?> execute() {
- Function pivotElement = PivotUtil.getPivot(Function.class, csElement);
+ PredicateVariable pivotElement = PivotUtil.getPivot(PredicateVariable.class, csElement);
if (pivotElement != null) {
context.refreshRequiredType(pivotElement, csElement);
}
@@ -144,15 +198,15 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
}
}
- public static class UnrealizedVariableCompletion extends SingleContinuation<UnrealizedVariableCS>
+ public static class QueryCompletion extends SingleContinuation<QueryCS>
{
- public UnrealizedVariableCompletion(@NonNull CS2ASConversion context, @NonNull UnrealizedVariableCS csElement) {
+ public QueryCompletion(@NonNull CS2ASConversion context, @NonNull QueryCS csElement) {
super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
}
@Override
public BasicContinuation<?> execute() {
- Variable pivotElement = PivotUtil.getPivot(Variable.class, csElement);
+ Function pivotElement = PivotUtil.getPivot(Function.class, csElement);
if (pivotElement != null) {
context.refreshRequiredType(pivotElement, csElement);
}
@@ -214,7 +268,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
}
@Override
- public Continuation<?> visitBottomPatternCS(@NonNull BottomPatternCS csElement) {
+ public Continuation<?> visitCheckStatementCS(@NonNull CheckStatementCS csElement) {
return null;
}
@@ -225,17 +279,21 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
@Override
public @Nullable Continuation<?> visitDomainCS(@NonNull DomainCS csDomain) {
- Area asArea = PivotUtil.getPivot(Area.class, csDomain);
+ ImperativeDomain asArea = PivotUtil.getPivot(ImperativeDomain.class, csDomain);
if (asArea != null) {
refreshUsedProperties(csDomain, asArea.getCheckedProperties(), csDomain.getCheckedProperties());
- refreshUsedProperties(csDomain, asArea.getEnforcedProperties(), csDomain.getEnforcedProperties());
}
return null;
}
@Override
- public Continuation<?> visitGuardPatternCS(@NonNull GuardPatternCS csElement) {
- return null;
+ public @Nullable Continuation<?> visitGuardVariableCS(@NonNull GuardVariableCS csElement) {
+ return new GuardVariableCompletion(context, csElement);
+ }
+
+ @Override
+ public @Nullable Continuation<?> visitInoutVariableCS(@NonNull InoutVariableCS csElement) {
+ return new InoutVariableCompletion(context, csElement);
}
@Override
@@ -276,18 +334,18 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
}
@Override
- public Continuation<?> visitParamDeclarationCS(@NonNull ParamDeclarationCS csElement) {
- return new ParamDeclarationCompletion(context, csElement);
+ public @Nullable Continuation<?> visitOutVariableCS(@NonNull OutVariableCS csElement) {
+ return new OutVariableCompletion(context, csElement);
}
@Override
- public Continuation<?> visitPredicateCS(@NonNull PredicateCS csElement) {
- return null;
+ public Continuation<?> visitParamDeclarationCS(@NonNull ParamDeclarationCS csElement) {
+ return new ParamDeclarationCompletion(context, csElement);
}
@Override
- public Continuation<?> visitPredicateOrAssignmentCS(@NonNull PredicateOrAssignmentCS csElement) {
- return null;
+ public @Nullable Continuation<?> visitPredicateVariableCS(@NonNull PredicateVariableCS csElement) {
+ return new PredicateVariableCompletion(context, csElement);
}
@Override
@@ -318,9 +376,4 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
}
return null;
}
-
- @Override
- public @Nullable Continuation<?> visitUnrealizedVariableCS(@NonNull UnrealizedVariableCS csElement) {
- return new UnrealizedVariableCompletion(context, csElement);
- }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java
index 212c327ec..aa0414b78 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java
@@ -13,19 +13,18 @@ package org.eclipse.qvtd.xtext.qvtimperative.formatting;
import org.eclipse.ocl.xtext.essentialocl.formatting.AbstractEssentialOCLFormatter;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.AddStatementCSElements;
-import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.BottomPatternCSElements;
-import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.ConstraintCSElements;
+import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.CheckStatementCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.DirectionCSElements;
-import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.GuardPatternCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.GuardVariableCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.ImportCSElements;
+import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.InoutVariableCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.MappingCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.MappingCallBindingCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.MappingCallCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.MappingLoopCSElements;
-import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.MiddleDomainCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.NewStatementCSElements;
-import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.PredicateCSElements;
+import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.OutVariableCSElements;
+import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.PredicateVariableCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.QualifiedPackageCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.QueryCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.ScopeNameCSElements;
@@ -33,8 +32,6 @@ import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.SourceDomainCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.TargetDomainCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.TransformationCSElements;
-import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.UnrealizedVariableCSElements;
-import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.VariablePredicateCSElements;
import org.eclipse.xtext.formatting.impl.FormattingConfig;
/**
@@ -47,60 +44,6 @@ import org.eclipse.xtext.formatting.impl.FormattingConfig;
*/
public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
{
-
- protected void configureBottomPatternCS(FormattingConfig c, BottomPatternCSElements a) {
- c.setNoLinewrap().before(a.getLeftCurlyBracketKeyword_1());
- c.setLinewrap().after(a.getLeftCurlyBracketKeyword_1());
- c.setLinewrap().before(a.getRightCurlyBracketKeyword_3());
- c.setLinewrap().after(a.getRightCurlyBracketKeyword_3());
- }
-
- protected void configureDirectionCS(FormattingConfig c, DirectionCSElements a) {
- c.setNoSpace().before(a.getCommaKeyword_4_0());
- c.setNoSpace().before(a.getCommaKeyword_5_2_0());
- }
-
- protected void configureImportCS(FormattingConfig c, ImportCSElements a) {
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_4());
- }
-
- protected void configurePredicateCS(FormattingConfig c, PredicateCSElements a) {
- c.setLinewrap(1).before(a.getCheckKeyword_0());
- c.setNoSpace().before(a.getSemicolonKeyword_2());
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_2());
- }
-
- protected void configureQualifiedPackageCS(FormattingConfig c, QualifiedPackageCSElements a) {
- c.setLinewrap(2).before(a.getPackageKeyword_0());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_5_0_0(), a.getRightCurlyBracketKeyword_5_0_2());
- setBraces(c, a.getLeftCurlyBracketKeyword_5_0_0(), a.getRightCurlyBracketKeyword_5_0_2());
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_5_1());
- }
-
- protected void configureQueryCS(FormattingConfig c, QueryCSElements a) {
- c.setLinewrap(2).before(a.getIsTransientAssignment_0());
- c.setNoSpace().around(a.getLeftParenthesisKeyword_4());
- c.setNoSpace().around(a.getLeftParenthesisKeyword_4());
- c.setNoSpace().before(a.getCommaKeyword_5_1_0());
- c.setNoSpace().before(a.getRightParenthesisKeyword_6());
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_9_0());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_9_1_0(), a.getRightCurlyBracketKeyword_9_1_2());
- setBraces(c, a.getLeftCurlyBracketKeyword_9_1_0(), a.getRightCurlyBracketKeyword_9_1_2());
- c.setIndentation(a.getLeftParenthesisKeyword_4(), a.getRightParenthesisKeyword_6());
- }
-
- protected void configureScopeNameCS(FormattingConfig c, ScopeNameCSElements a) {
- c.setNoSpace().around(a.getColonColonKeyword_1());
- c.setNoSpace().around(a.getColonColonKeyword_2_1());
- }
-
- protected void configureTransformationCS(FormattingConfig c, TransformationCSElements a) {
- c.setLinewrap(2).before(a.getTransformationKeyword_0());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_3(), a.getRightCurlyBracketKeyword_5());
- setBraces(c, a.getLeftCurlyBracketKeyword_3(), a.getRightCurlyBracketKeyword_5());
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_4_1());
- }
-
@Override
protected void configureFormatting(FormattingConfig c) {
c.setAutoLinewrap(120);
@@ -122,7 +65,6 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
configureNestedExpCS(c, f.getNestedExpCSAccess());
configurePathNameCS(c, f.getPathNameCSAccess());
configurePrimaryExpCS(c, f.getPrimaryExpCSAccess());
- configureQualifiedPackageCS(c, f.getQualifiedPackageCSAccess());
configureRoundBracketedClauseCS(c, f.getRoundBracketedClauseCSAccess());
configureSquareBracketedClauseCS(c, f.getSquareBracketedClauseCSAccess());
configureTupleLiteralExpCS(c, f.getTupleLiteralExpCSAccess());
@@ -135,33 +77,43 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
- configureDirectionCS(c, f.getDirectionCSAccess());
- configureImportCS(c, f.getImportCSAccess());
- configurePredicateCS(c, f.getPredicateCSAccess());
- configureQueryCS(c, f.getQueryCSAccess());
- configureScopeNameCS(c, f.getScopeNameCSAccess());
- configureTransformationCS(c, f.getTransformationCSAccess());
-
-
{
AddStatementCSElements a = f.getAddStatementCSAccess();
c.setLinewrap(1).before(a.getAddKeyword_0());
c.setNoSpace().before(a.getSemicolonKeyword_4());
}
{
+ CheckStatementCSElements a = f.getCheckStatementCSAccess();
+ c.setLinewrap(1).before(a.getCheckKeyword_0());
+ c.setNoSpace().before(a.getSemicolonKeyword_2());
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_2());
+ }
+ {
+ DirectionCSElements a = f.getDirectionCSAccess();
+ c.setNoSpace().before(a.getCommaKeyword_4_0());
+ c.setNoSpace().before(a.getCommaKeyword_5_2_0());
+ }
+ {
GuardVariableCSElements a = f.getGuardVariableCSAccess();
- c.setLinewrap(1).before(a.getInKeyword_0_0());
- c.setLinewrap(1).before(a.getIsConnectionInoutKeyword_0_1_0());
+ c.setLinewrap(1).before(a.getInKeyword_0());
+ c.setNoSpace().before(a.getSemicolonKeyword_6());
+ }
+ {
+ ImportCSElements a = f.getImportCSAccess();
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_4());
+ }
+ {
+ InoutVariableCSElements a = f.getInoutVariableCSAccess();
+ c.setLinewrap(1).before(a.getInoutKeyword_0());
c.setNoSpace().before(a.getSemicolonKeyword_4());
}
{
MappingCSElements a = f.getMappingCSAccess();
c.setLinewrap(2).before(a.getMapKeyword_1());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_9());
- setBraces(c, a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_9());
+ c.setNoSpace().between(a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_10());
+ setBraces(c, a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_10());
// c.setLinewrap(2).between(a.getDomainsAssignment_5(), a.getDomainsAssignment_5());
- c.setLinewrap(1).before(a.getOwnedDomainsAssignment_5());
- c.setLinewrap(1).before(a.getWhereKeyword_6_0());
+ c.setLinewrap(1).before(a.getOwnedDomainsAssignment_6());
}
{
MappingCallCSElements a = f.getMappingCallCSAccess();
@@ -180,39 +132,40 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
setAppendedBraces(c, a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_6());
}
{
- MiddleDomainCSElements a = f.getMiddleDomainCSAccess();
- c.setNoLinewrap().before(a.getLeftCurlyBracketKeyword_0_0());
- c.setLinewrap().after(a.getLeftCurlyBracketKeyword_0_0());
- c.setNoSpace().before(a.getCommaKeyword_0_1_2_0());
- c.setLinewrap().after(a.getGroup_0_1());
- c.setNoSpace().before(a.getCommaKeyword_0_2_2_0());
- c.setLinewrap().after(a.getGroup_0_2());
- c.setLinewrap().after(a.getRightCurlyBracketKeyword_0_3());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_0_0(), a.getRightCurlyBracketKeyword_0_3());
- c.setIndentation(a.getLeftCurlyBracketKeyword_0_0(), a.getRightCurlyBracketKeyword_0_3());
- }
- {
- GuardPatternCSElements a = f.getGuardPatternCSAccess();
- c.setNoLinewrap().before(a.getLeftParenthesisKeyword_1());
- c.setLinewrap().after(a.getLeftParenthesisKeyword_1());
- c.setLinewrap().before(a.getRightParenthesisKeyword_3());
- c.setLinewrap().after(a.getRightParenthesisKeyword_3());
- c.setNoSpace().around(a.getLeftParenthesisKeyword_1());
- c.setNoSpace().before(a.getRightParenthesisKeyword_3());
- //
- c.setIndentation(a.getLeftParenthesisKeyword_1(), a.getRightParenthesisKeyword_3());
- c.setNoSpace().between(a.getLeftParenthesisKeyword_1(), a.getRightParenthesisKeyword_3());
- }
- {
NewStatementCSElements a = f.getNewStatementCSAccess();
c.setLinewrap(1).before(a.getNewKeyword_0());
c.setNoSpace().around(a.getColonKeyword_1());
c.setNoSpace().before(a.getSemicolonKeyword_7());
}
{
- ConstraintCSElements a = f.getConstraintCSAccess();
- c.setLinewrap(1).before(a.getCheckKeyword_0());
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_3());
+ OutVariableCSElements a = f.getOutVariableCSAccess();
+ c.setLinewrap(1).before(a.getOutKeyword_0());
+ c.setNoSpace().before(a.getSemicolonKeyword_4());
+ }
+ {
+ PredicateVariableCSElements a = f.getPredicateVariableCSAccess();
+ c.setLinewrap(1).before(a.getAlternatives_0());
+ c.setNoSpace().around(a.getColonKeyword_2_0());
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_5());
+ }
+ {
+ QualifiedPackageCSElements a = f.getQualifiedPackageCSAccess();
+ c.setLinewrap(2).before(a.getPackageKeyword_0());
+ c.setNoSpace().between(a.getLeftCurlyBracketKeyword_5_0_0(), a.getRightCurlyBracketKeyword_5_0_2());
+ setBraces(c, a.getLeftCurlyBracketKeyword_5_0_0(), a.getRightCurlyBracketKeyword_5_0_2());
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_5_1());
+ }
+ {
+ QueryCSElements a = f.getQueryCSAccess();
+ c.setLinewrap(2).before(a.getIsTransientAssignment_0());
+ c.setNoSpace().around(a.getLeftParenthesisKeyword_4());
+ c.setNoSpace().around(a.getLeftParenthesisKeyword_4());
+ c.setNoSpace().before(a.getCommaKeyword_5_1_0());
+ c.setNoSpace().before(a.getRightParenthesisKeyword_6());
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_9_0());
+ c.setNoSpace().between(a.getLeftCurlyBracketKeyword_9_1_0(), a.getRightCurlyBracketKeyword_9_1_2());
+ setBraces(c, a.getLeftCurlyBracketKeyword_9_1_0(), a.getRightCurlyBracketKeyword_9_1_2());
+ c.setIndentation(a.getLeftParenthesisKeyword_4(), a.getRightParenthesisKeyword_6());
}
{
ScopeNameCSElements a = f.getScopeNameCSAccess();
@@ -221,7 +174,8 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
}
{
SetStatementCSElements a = f.getSetStatementCSAccess();
- c.setLinewrap(1).before(a.getSetKeyword_0());
+ c.setLinewrap(1).before(a.getAlternatives_0());
+ c.setNoSpace().around(a.getFullStopKeyword_2());
c.setNoSpace().before(a.getSemicolonKeyword_6());
}
{
@@ -230,11 +184,9 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
c.setLinewrap().after(a.getLeftCurlyBracketKeyword_2_0());
c.setNoSpace().before(a.getCommaKeyword_2_1_2_0());
c.setLinewrap().after(a.getCommaKeyword_2_1_2_0());
- c.setNoSpace().before(a.getCommaKeyword_2_2_2_0());
- c.setLinewrap().after(a.getCommaKeyword_2_2_2_0());
- c.setLinewrap().after(a.getRightCurlyBracketKeyword_2_3());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_3());
- c.setIndentation(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_3());
+ c.setLinewrap().after(a.getRightCurlyBracketKeyword_2_2());
+ c.setNoSpace().between(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_2());
+ c.setIndentation(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_2());
}
{
TargetDomainCSElements a = f.getTargetDomainCSAccess();
@@ -242,11 +194,9 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
c.setLinewrap().after(a.getLeftCurlyBracketKeyword_2_0());
c.setNoSpace().before(a.getCommaKeyword_2_1_2_0());
c.setLinewrap().after(a.getCommaKeyword_2_1_2_0());
- c.setNoSpace().before(a.getCommaKeyword_2_2_2_0());
- c.setLinewrap().after(a.getCommaKeyword_2_2_2_0());
- c.setLinewrap().after(a.getRightCurlyBracketKeyword_2_3());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_3());
- c.setIndentation(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_3());
+ c.setLinewrap().after(a.getRightCurlyBracketKeyword_2_2());
+ c.setNoSpace().between(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_2());
+ c.setIndentation(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_2());
}
// {
// TopLevelCSElements a = f.getTopLevelCSAccess();
@@ -255,14 +205,11 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
// c.setLinewrap(2).before(a.getOwnedTransformationsAssignment_1_0());
// }
{
- UnrealizedVariableCSElements a = f.getUnrealizedVariableCSAccess();
- c.setLinewrap(1).before(a.getVarKeyword_0_0());
- c.setNoSpace().before(a.getSemicolonKeyword_4());
- }
- {
- VariablePredicateCSElements a = f.getVariablePredicateCSAccess();
- c.setLinewrap(1).before(a.getInvarKeyword_0());
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_5());
+ TransformationCSElements a = f.getTransformationCSAccess();
+ c.setLinewrap(2).before(a.getTransformationKeyword_0());
+ c.setNoSpace().between(a.getLeftCurlyBracketKeyword_3(), a.getRightCurlyBracketKeyword_5());
+ setBraces(c, a.getLeftCurlyBracketKeyword_3(), a.getRightCurlyBracketKeyword_5());
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_4_1());
}
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java
index 28fee60ee..82c2f771b 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/utilities/QVTimperativeCSResource.java
@@ -30,11 +30,12 @@ import org.eclipse.ocl.xtext.essentialocl.utilities.EssentialOCLCSResource;
import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
+import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
-import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
-import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeASResourceFactory;
import org.eclipse.qvtd.xtext.qvtimperative.as2cs.QVTimperativeAS2CS;
@@ -90,14 +91,17 @@ public class QVTimperativeCSResource extends EssentialOCLCSResource
else if (element instanceof Mapping) {
return (Mapping)element;
}
- else if (element instanceof NewStatement) {
- return (NewStatement)element;
+ else if (element instanceof VariableStatement) { // NewStatement, PredicateVariable, OutConnectionVariable
+ return (VariableStatement)element;
}
- else if ((element instanceof Variable) && (element.eContainer() instanceof ImperativePattern)) {
- return (Variable)element;
+ else if (element instanceof InConnectionVariable) {
+ return (InConnectionVariable)element;
}
- else if ((element instanceof Variable) && (element.eContainer() instanceof MappingLoop)) {
- return (Variable)element;
+ else if (element instanceof GuardVariable) {
+ return (GuardVariable)element;
+ }
+ else if (element instanceof LoopVariable) {
+ return (LoopVariable)element;
}
else if ((element instanceof Variable) && (element.eContainer() instanceof Transformation)) {
return (Variable)element;
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/ClassesCS2AS.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/ClassesCS2AS.qvti
index 0fba3c78b..571a7b36b 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/ClassesCS2AS.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/ClassesCS2AS.qvti
@@ -11,75 +11,75 @@ transformation classescs2as
map mClassCS2Class_LM in classescs2as
{
- check leftCS(in classCS : ClassCS;) {}
+ check leftCS(in:leftCS classCS : ClassCS;) {}
new:middle c2c : ClassCS2Class;
set c2c.classCS := classCS;
}
map mRootCS2Root_LM in classescs2as
{
- check leftCS(in rootCS : RootCS;) {}
+ check leftCS(in:leftCS rootCS : RootCS;) {}
new:middle r2r : RootCS2Root;
set r2r.rootCS := rootCS;
}
map mPackageCS2Package_LM in classescs2as
{
- check leftCS(in packageCS : PackageCS;) {}
+ check leftCS(in:leftCS packageCS : PackageCS;) {}
new:middle p2p : PackageCS2Package;
set p2p.packageCS := packageCS;
}
map mClassCS2Class_MR in classescs2as
{
- check middle(in c2c : ClassCS2Class;) {}
+ check middle(in:middle c2c : ClassCS2Class;) {}
new:rightAS _'class' : Class;
set c2c._'class' := _'class';
}
map mRootCS2Root_MR in classescs2as
{
- check middle(in r2r : RootCS2Root;) {}
+ check middle(in:middle r2r : RootCS2Root;) {}
new:rightAS root : Root;
set r2r.root := root;
}
map mPackageCS2Package_MR in classescs2as
{
- check middle(in p2p : PackageCS2Package;) {}
+ check middle(in:middle p2p : PackageCS2Package;) {}
new:rightAS _'package' : Package;
set p2p._'package' := _'package';
}
map uClass_name in classescs2as
{
- check rightAS(in _'class' : Class;) {}
- check leftCS(in classCS : ClassCS;) {}
- where (check classCS.ClassCS2Class._'class' = _'class';) {}
+ check rightAS(in:rightAS _'class' : Class;) {}
+ check leftCS(in:leftCS classCS : ClassCS;) {}
+ check classCS.ClassCS2Class._'class' = _'class';
set _'class'.name := classCS.name;
}
map uRoot_ownedPackages in classescs2as
{
- check rightAS(in root : Root;) {}
- check leftCS(in rootCS : RootCS;) {}
- where (check rootCS.RootCS2Root.root = root;) {}
+ check rightAS(in:rightAS root : Root;) {}
+ check leftCS(in:leftCS rootCS : RootCS;) {}
+ check rootCS.RootCS2Root.root = root;
set root.ownedPackages := rootCS.ownedPackages.PackageCS2Package._'package'->asOrderedSet();
}
map uPackage_name in classescs2as
{
- check rightAS(in _'package' : Package;) {}
- check leftCS(in packageCS : PackageCS;) {}
- where (check packageCS.PackageCS2Package._'package' = _'package';) {}
+ check rightAS(in:rightAS _'package' : Package;) {}
+ check leftCS(in:leftCS packageCS : PackageCS;) {}
+ check packageCS.PackageCS2Package._'package' = _'package';
set _'package'.name := packageCS.name;
}
map uPackage_ownedClasses in classescs2as
{
- check rightAS(in _'package' : Package;) {}
- check leftCS(in packageCS : PackageCS;) {}
- where (check packageCS.PackageCS2Package._'package' = _'package';) {}
+ check rightAS(in:rightAS _'package' : Package;) {}
+ check leftCS(in:leftCS packageCS : PackageCS;) {}
+ check packageCS.PackageCS2Package._'package' = _'package';
set _'package'.ownedClasses := packageCS.ownedClasses.ClassCS2Class._'class'->asOrderedSet();
}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug456900/ClassesCS2AS.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug456900/ClassesCS2AS.qvti
index d12faf14d..f55a5ea37 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug456900/ClassesCS2AS.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug456900/ClassesCS2AS.qvti
@@ -9,14 +9,14 @@ transformation classescs2as
map mCreationRootCS2Root in classescs2as
{
- check leftCS(in rootCS : RootCS;) {}
+ check leftCS(in:leftCS rootCS : RootCS;) {}
new:rightAS root : Root;
set rootCS.ast := root;
}
map mCreationPackageCS2Package in classescs2as
{
- check leftCS(in packageCS : PackageCS;) {}
+ check leftCS(in:leftCS packageCS : PackageCS;) {}
new:rightAS _'package' : Package;
set packageCS.ast := _'package';
}
@@ -24,25 +24,20 @@ map mCreationPackageCS2Package in classescs2as
map uPackage_name in classescs2as
{
- check leftCS(in packageCS : PackageCS;) {}
- enforce rightAS() {
- var l1 : classes::Package := packageCS.ast.oclAsType(classes::Package);
- }
- where () {}
+ check leftCS(in:leftCS packageCS : PackageCS;) {}
+ var l1 : classes::Package := packageCS.ast.oclAsType(classes::Package);
set l1.name := packageCS.name;
}
map uRoot_ownedPackages in classescs2as
{
- check leftCS(in rootCS : RootCS;) {}
- enforce rightAS() {var z1 : classes::Root := rootCS.ast.oclAsType(classes::Root);}
- where () {}
+ check leftCS(in:leftCS rootCS : RootCS;) {}
+ var z1 : classes::Root := rootCS.ast.oclAsType(classes::Root);
set z1.ownedPackages :=
rootCS.ownedPackages.ast.oclAsType(classes::Package)->asOrderedSet();
}
map __root__ in classescs2as
{
- where () {}
for rootCS : classescs::RootCS in classescs::RootCS.allInstances() {
call mCreationRootCS2Root {
rootCS := rootCS;
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2AS.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2AS.qvti
index d923d70e8..083ba760b 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2AS.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2AS.qvti
@@ -10,7 +10,7 @@ transformation classescs2as
map createPackage in classescs2as
{
- check leftCS(in packageCS : PackageCS;) {}
+ check leftCS(in:leftCS packageCS : PackageCS;) {}
new:rightAS _'package' : Package;
set _'package'.name := if packageCS.hasName()
then packageCS.name
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2.qvti
index 705e01043..d69959f99 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2.qvti
@@ -10,7 +10,7 @@ transformation classescs2as
map createPackage in classescs2as
{
- check leftCS(in packageCS : PackageCS;) {}
+ check leftCS(in:leftCS packageCS : PackageCS;) {}
new:rightAS _package : Package;
set _package.name := if packageCS.aBooleanElementOp()
--if not packageCS.name.oclIsUndefined()
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2_AS.qvtias b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2_AS.qvtias
index 591082505..657dc084b 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2_AS.qvtias
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug457239/ClassesCS2ASv2_AS.qvtias
@@ -15,22 +15,17 @@
</modelParameter>
<rule xsi:type="qvti:Mapping" xmi:id="m..classescs2as.createPackage" name="createPackage">
<domain xsi:type="qvti:ImperativeDomain" isCheckable="true" isEnforceable="false" typedModel="#qT..classescs2as.leftCS">
- <guardPattern>
- <variable name="packageCS" isRequired="false" type="pivot:Class ../ClassesCS.ecore.oclas#T.classescs.PackageCS"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="packageCS" isRequired="false" type="pivot:Class ../ClassesCS.ecore.oclas#T.classescs.PackageCS" referredTypedModel="#qT..classescs2as.leftCS"/>
</domain>
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:NewStatement" xmi:id="qV..classescs2as.createPackage._package" name="_package" isRequired="false"
type="pivot:Class ../Classes.ecore.oclas#T.classes.Package" referredTypedModel="#qT..classescs2as.rightAS"/>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Classes.ecore.oclas#p.classes.NamedElement.name">
- <slotExpression isRequired="false" type="pivot:Class ../Classes.ecore.oclas#T.classes.Package" referredVariable="#qV..classescs2as.createPackage._package"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..classescs2as.createPackage._package" targetProperty="../Classes.ecore.oclas#p.classes.NamedElement.name"
+ isEmit="false">
<value xsi:type="pivot:IfExp" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String">
<ownedCondition xsi:type="pivot:OperationCallExp" isRequired="false" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#Boolean"
referredOperation="helpers.ocl.oclas#o.ocl.OclElement.aBooleanElementOp">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../ClassesCS.ecore.oclas#T.classescs.PackageCS"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.0/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.0/@domain.0/@ownedGuardVariables.0"/>
</ownedCondition>
<ownedElse xsi:type="pivot:StringLiteralExp" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String"
stringSymbol="unexpected"/>
@@ -40,13 +35,11 @@
</ownedStatements>
</rule>
<rule xsi:type="qvti:Mapping" xmi:id="m..classescs2as.__root__" name="__root__">
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:MappingLoop">
- <ownedIterators xmi:id="i..classescs2as.__root__.0.packageCS" name="packageCS" type="pivot:Class ../ClassesCS.ecore.oclas#T.classescs.PackageCS"/>
+ <ownedIterators name="packageCS" type="pivot:Class ../ClassesCS.ecore.oclas#T.classescs.PackageCS"/>
<ownedMappingStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..classescs2as.createPackage">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.0/@domain.0/@guardPattern/@variable.0" isPolled="false">
- <value xsi:type="pivot:VariableExp" type="pivot:Class ../ClassesCS.ecore.oclas#T.classescs.PackageCS" referredVariable="#i..classescs2as.__root__.0.packageCS"/>
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.0/@domain.0/@ownedGuardVariables.0" isPolled="false">
+ <value xsi:type="pivot:VariableExp" type="pivot:Class ../ClassesCS.ecore.oclas#T.classescs.PackageCS" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@ownedStatements.0/@ownedIterators.0"/>
</binding>
</ownedMappingStatements>
<ownedSource xsi:type="pivot:OperationCallExp" type="#//@ownedPackages.1/@ownedClasses.0" referredOperation="http://www.eclipse.org/ocl/2015/Library.oclas#o.ocl.OclElement.allInstances">
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug459225/ClassesCS2AS.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug459225/ClassesCS2AS.qvti
index ebad4de83..dc51c606f 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug459225/ClassesCS2AS.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ClassesCS2AS/bug459225/ClassesCS2AS.qvti
@@ -10,7 +10,7 @@ transformation classescs2as_Bug459225
map createPackage in classescs2as_Bug459225
{
- check leftCS(in packageCS : PackageCS;) {}
+ check leftCS(in:leftCS packageCS : PackageCS;) {}
new:rightAS _'package' : Package;
set _'package'.name := if packageCS.hasName()
then packageCS.computeName()
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Constructors/Constructors.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Constructors/Constructors.qvti
index 9e524f732..f6f0c96a5 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Constructors/Constructors.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Constructors/Constructors.qvti
@@ -11,7 +11,7 @@ query Constructors::createEPackage(name2 : String) : ecore::EPackage {
}
map ep2ep in Constructors {
- check source (in epIn:EPackage;) {}
+ check source(in:source epIn:EPackage;) {}
new:target epOut1 : EPackage := this.createEPackage(epIn.name);
new:target epOut2 : EPackage;
set epOut2.name := epIn.name;
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Dependencies/Dependencies.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Dependencies/Dependencies.qvti
index 70c94f9f3..a204148c0 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Dependencies/Dependencies.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Dependencies/Dependencies.qvti
@@ -7,9 +7,7 @@ transformation Dependencies {
}
map dependenciesLM in Dependencies {
- check source { check ecore::EPackage::eSubpackages enforce ecore::EPackage::eSuperPackage } (in dummy:EPackage;) {}
- enforce middle() {}
- where () {}
+ check source { check ecore::EPackage::eSubpackages } (in:source dummy:EPackage;) {}
call dependenciesMR {
binaryPrecedence := (1 + 2) * (3*5 + 4);
unaryPrecedence := -1 * - -1;
@@ -17,7 +15,5 @@ map dependenciesLM in Dependencies {
}
map dependenciesMR in Dependencies /*uses ecore::EPackage, ocl::Integer*/ {
- check middle(in binaryPrecedence:OclAny; in unaryPrecedence:OclAny;) { }
- enforce target() {}
- where () {}
+ check middle(in:middle binaryPrecedence:OclAny; in:middle unaryPrecedence:OclAny;) { }
}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Expressions/Expressions.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Expressions/Expressions.qvti
index 3be27ad6a..c527bfaff 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Expressions/Expressions.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Expressions/Expressions.qvti
@@ -7,9 +7,7 @@ transformation Expressions {
}
map expressionsLM in Expressions {
- check source(in dummy:EPackage;) {}
- enforce middle() {}
- where () {}
+ check source(in:source dummy:EPackage;) {}
call expressionsMR {
binaryPrecedence := (1 + 2) * (3*5 + 4);
unaryPrecedence := -1 * - -1;
@@ -18,25 +16,17 @@ map expressionsLM in Expressions {
}
map expressionsMR in Expressions {
- check middle(in binaryPrecedence:OclAny; in unaryPrecedence:OclAny; in notPrecedence:OclAny;) { }
- enforce target() {}
- where () {}
+ check middle(in:middle binaryPrecedence:OclAny; in:middle unaryPrecedence:OclAny; in:middle notPrecedence:OclAny;) { }
}
map expressionsDomains in Expressions {
- check middle() {
- var s : Integer := 0;
- var s_1 : Integer := m;
- var s_2 : Integer := t;
- }
- enforce target() {
- var t : Integer := 0;
- var t_1 : Integer := s;
- var t_2 : Integer := m;
- }
- where () {
- var m : Integer := 0;
- var m_1 : Integer := s;
- var m_2 : Integer := t;
- }
+ var s : Integer := 0;
+ var t : Integer := 0;
+ var m : Integer := 0;
+ var s_1 : Integer := m;
+ var s_2 : Integer := t;
+ var t_1 : Integer := s;
+ var t_2 : Integer := m;
+ var m_1 : Integer := s;
+ var m_2 : Integer := t;
}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti
index 5060897d7..67950e424 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.qvti
@@ -17,7 +17,7 @@ map __root__ in CopyGraph {
}
map Graph2Middle in CopyGraph { -- L to M for G
- check upperGraph(in g1:Graph;) {}
+ check upperGraph(in:upperGraph g1:Graph;) {}
new:middle middleG2G:Graph2Graph;
set middleG2G.graph1 := g1;
set middleG2G.name := g1.name.toLowerCase();
@@ -33,8 +33,8 @@ map Graph2Middle in CopyGraph { -- L to M for G
}
map Node2Middle in CopyGraph { -- L to M for N
- check upperGraph(in n1:Node;) { }
- enforce middle(in middleParent:Graph2Graph;) {}
+ check upperGraph(in:upperGraph n1:Node;) { }
+ enforce middle(in:middle middleParent:Graph2Graph;) {}
new:middle n2n:Node2Node;
set n2n.owner := middleParent;
set n2n.node1 := n1;
@@ -42,7 +42,7 @@ map Node2Middle in CopyGraph { -- L to M for N
}
map Middle2Graph in CopyGraph { -- M to R for G
- check middle(in g2Gmiddle:Graph2Graph;) {}
+ check middle(in:middle g2Gmiddle:Graph2Graph;) {}
new:lowerGraph g2:Graph;
set g2Gmiddle.graph2 := g2;
set g2.name := g2Gmiddle.name;
@@ -54,7 +54,7 @@ map Middle2Graph in CopyGraph { -- M to R for G
}
map Middle2Node in CopyGraph { -- M to R for N
- check middle(in n2n:Node2Node;) {}
+ check middle(in:middle n2n:Node2Node;) {}
new:lowerGraph n2:Node;
set n2n.node2 := n2;
set n2.graph := n2n.owner.graph2;
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.ref.qvtias b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.ref.qvtias
index ed65c9264..9b98a1571 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.ref.qvtias
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphHierarchical/Graph2GraphHierarchical.ref.qvtias
@@ -16,14 +16,12 @@
<ownedContext xmi:id="qV..CopyGraph.middle.middle" name="middle" type="pivot:Class http://www.eclipse.org/qvt/2015/QVTimperativeLibrary.oclas#T.qvtbaselibrary.Model"/>
</modelParameter>
<rule xsi:type="qvti:Mapping" xmi:id="m..CopyGraph.__root__" name="__root__">
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:MappingLoop">
- <ownedIterators xmi:id="i..CopyGraph.__root__.0.g1" name="g1" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"/>
+ <ownedIterators name="g1" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"/>
<ownedMappingStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..CopyGraph.Graph2Middle">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@guardPattern/@variable.0" isPolled="false">
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@ownedGuardVariables.0" isPolled="false">
<value xsi:type="pivot:VariableExp" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"
- referredVariable="#i..CopyGraph.__root__.0.g1"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.0/@ownedStatements.0/@ownedIterators.0"/>
</binding>
</ownedMappingStatements>
<ownedSource xsi:type="pivot:OperationCallExp" type="#//@ownedPackages.1/@ownedClasses.0" referredOperation="http://www.eclipse.org/ocl/2015/Library.oclas#o.ocl.OclElement.allInstances">
@@ -33,48 +31,42 @@
</rule>
<rule xsi:type="qvti:Mapping" xmi:id="m..CopyGraph.Graph2Middle" name="Graph2Middle">
<domain xsi:type="qvti:ImperativeDomain" isCheckable="true" isEnforceable="false" typedModel="#qT..CopyGraph.upperGraph">
- <guardPattern>
- <variable name="g1" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="g1" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"
+ referredTypedModel="#qT..CopyGraph.upperGraph"/>
</domain>
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:NewStatement" xmi:id="qV..CopyGraph.Graph2Middle.middleG2G" name="middleG2G" isRequired="false"
type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph" referredTypedModel="#qT..CopyGraph.middle"/>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Graph2Graph.graph1">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
- referredVariable="#qV..CopyGraph.Graph2Middle.middleG2G"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..CopyGraph.Graph2Middle.middleG2G" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Graph2Graph.graph1"
+ isEmit="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@ownedGuardVariables.0"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Graph2Graph.name">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
- referredVariable="#qV..CopyGraph.Graph2Middle.middleG2G"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..CopyGraph.Graph2Middle.middleG2G" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Graph2Graph.name"
+ isEmit="false">
<value xsi:type="pivot:OperationCallExp" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String" referredOperation="http://www.eclipse.org/ocl/2015/Library.oclas#o.ocl.String.toLowerCase">
<ownedSource xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String"
referredProperty="../Graph2GraphMinimal/SimpleGraph.ecore.oclas#p.simplegraph.Graph.name">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
</value>
</ownedStatements>
<ownedStatements xsi:type="qvti:MappingLoop">
- <ownedIterators xmi:id="i..CopyGraph.Graph2Middle.3.child" name="child" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Element"/>
+ <ownedIterators name="child" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Element"/>
<ownedMappingStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..CopyGraph.Node2Middle">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@guardPattern/@variable.0" isPolled="false">
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@ownedGuardVariables.0" isPolled="false">
+ <value xsi:type="pivot:VariableExp" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Element"
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@ownedStatements.3/@ownedIterators.0"/>
+ </binding>
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@ownedGuardVariables.0" isPolled="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
referredVariable="#qV..CopyGraph.Graph2Middle.middleG2G"/>
</binding>
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@guardPattern/@variable.0" isPolled="false">
- <value xsi:type="pivot:VariableExp" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Element"
- referredVariable="#i..CopyGraph.Graph2Middle.3.child"/>
- </binding>
</ownedMappingStatements>
<ownedSource xsi:type="pivot:IteratorExp" type="#//@ownedPackages.1/@ownedClasses.1" referredIteration="http://www.eclipse.org/ocl/2015/Library.oclas#i.ocl.OrderedSet.select..T">
<ownedSource xsi:type="pivot:PropertyCallExp" type="#//@ownedPackages.1/@ownedClasses.1" referredProperty="../Graph2GraphMinimal/SimpleGraph.ecore.oclas#p.simplegraph.Graph.element">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
<ownedBody xsi:type="pivot:OperationCallExp" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#Boolean"
referredOperation="http://www.eclipse.org/ocl/2015/Library.oclas#o.ocl.OclAny.oclIsTypeOf..ocl.OclType">
@@ -86,7 +78,7 @@
</ownedSource>
</ownedStatements>
<ownedStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..CopyGraph.Middle2Graph">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@guardPattern/@variable.0" isPolled="false">
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@ownedGuardVariables.0" isPolled="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
referredVariable="#qV..CopyGraph.Graph2Middle.middleG2G"/>
</binding>
@@ -94,82 +86,68 @@
</rule>
<rule xsi:type="qvti:Mapping" xmi:id="m..CopyGraph.Node2Middle" name="Node2Middle">
<domain xsi:type="qvti:ImperativeDomain" isCheckable="true" isEnforceable="false" typedModel="#qT..CopyGraph.upperGraph">
- <guardPattern>
- <variable name="n1" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Node"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="n1" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Node"
+ referredTypedModel="#qT..CopyGraph.upperGraph"/>
</domain>
<domain xsi:type="qvti:ImperativeDomain" isCheckable="false" isEnforceable="true" typedModel="#qT..CopyGraph.middle">
- <guardPattern>
- <variable name="middleParent" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="middleParent" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
+ referredTypedModel="#qT..CopyGraph.middle"/>
</domain>
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:NewStatement" xmi:id="qV..CopyGraph.Node2Middle.n2n" name="n2n" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Node2Node"
referredTypedModel="#qT..CopyGraph.middle"/>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Element2Element.owner">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Node2Node"
- referredVariable="#qV..CopyGraph.Node2Middle.n2n"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..CopyGraph.Node2Middle.n2n" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Element2Element.owner"
+ isEmit="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@ownedGuardVariables.0"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Node2Node.node1">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Node2Node"
- referredVariable="#qV..CopyGraph.Node2Middle.n2n"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..CopyGraph.Node2Middle.n2n" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Node2Node.node1"
+ isEmit="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Node"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@ownedGuardVariables.0"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Node2Node.label">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Node2Node"
- referredVariable="#qV..CopyGraph.Node2Middle.n2n"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..CopyGraph.Node2Middle.n2n" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Node2Node.label"
+ isEmit="false">
<value xsi:type="pivot:OperationCallExp" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String" referredOperation="http://www.eclipse.org/ocl/2015/Library.oclas#o.ocl.String.toLowerCase">
<ownedSource xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String"
referredProperty="../Graph2GraphMinimal/SimpleGraph.ecore.oclas#p.simplegraph.Node.label">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Node"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
</value>
</ownedStatements>
</rule>
<rule xsi:type="qvti:Mapping" xmi:id="m..CopyGraph.Middle2Graph" name="Middle2Graph">
<domain xsi:type="qvti:ImperativeDomain" isCheckable="true" isEnforceable="false" typedModel="#qT..CopyGraph.middle">
- <guardPattern>
- <variable name="g2Gmiddle" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="g2Gmiddle" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
+ referredTypedModel="#qT..CopyGraph.middle"/>
</domain>
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:NewStatement" xmi:id="qV..CopyGraph.Middle2Graph.g2" name="g2" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"
referredTypedModel="#qT..CopyGraph.lowerGraph"/>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Graph2Graph.graph2">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@guardPattern/@variable.0"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@ownedGuardVariables.0"
+ targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Graph2Graph.graph2" isEmit="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"
referredVariable="#qV..CopyGraph.Middle2Graph.g2"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph.ecore.oclas#p.simplegraph.Graph.name">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph" referredVariable="#qV..CopyGraph.Middle2Graph.g2"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..CopyGraph.Middle2Graph.g2" targetProperty="../Graph2GraphMinimal/SimpleGraph.ecore.oclas#p.simplegraph.Graph.name"
+ isEmit="false">
<value xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String"
referredProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Graph2Graph.name">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@ownedGuardVariables.0"/>
</value>
</ownedStatements>
<ownedStatements xsi:type="qvti:MappingLoop">
- <ownedIterators xmi:id="i..CopyGraph.Middle2Graph.3.child" name="child" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Element2Element"/>
+ <ownedIterators name="child" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Element2Element"/>
<ownedMappingStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..CopyGraph.Middle2Node">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0" isPolled="false">
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0" isPolled="false">
<value xsi:type="pivot:VariableExp" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Element2Element"
- referredVariable="#i..CopyGraph.Middle2Graph.3.child"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@ownedStatements.3/@ownedIterators.0"/>
</binding>
</ownedMappingStatements>
<ownedSource xsi:type="pivot:IteratorExp" type="#//@ownedPackages.1/@ownedClasses.2" referredIteration="http://www.eclipse.org/ocl/2015/Library.oclas#i.ocl.OrderedSet.select..T">
<ownedSource xsi:type="pivot:PropertyCallExp" type="#//@ownedPackages.1/@ownedClasses.2" referredProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Graph2Graph.element2Element">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
<ownedBody xsi:type="pivot:OperationCallExp" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#Boolean"
referredOperation="http://www.eclipse.org/ocl/2015/Library.oclas#o.ocl.OclAny.oclIsTypeOf..ocl.OclType">
@@ -184,38 +162,33 @@
</rule>
<rule xsi:type="qvti:Mapping" xmi:id="m..CopyGraph.Middle2Node" name="Middle2Node">
<domain xsi:type="qvti:ImperativeDomain" isCheckable="true" isEnforceable="false" typedModel="#qT..CopyGraph.middle">
- <guardPattern>
- <variable name="n2n" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Node2Node"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="n2n" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Node2Node"
+ referredTypedModel="#qT..CopyGraph.middle"/>
</domain>
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:NewStatement" xmi:id="qV..CopyGraph.Middle2Node.n2" name="n2" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Node"
referredTypedModel="#qT..CopyGraph.lowerGraph"/>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Node2Node.node2">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Node2Node"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0"
+ targetProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Node2Node.node2" isEmit="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Node"
referredVariable="#qV..CopyGraph.Middle2Node.n2"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph.ecore.oclas#p.simplegraph.Element.graph">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Node" referredVariable="#qV..CopyGraph.Middle2Node.n2"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..CopyGraph.Middle2Node.n2" targetProperty="../Graph2GraphMinimal/SimpleGraph.ecore.oclas#p.simplegraph.Element.graph"
+ isEmit="false">
<value xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Graph"
referredProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Graph2Graph.graph2">
<ownedSource xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Graph2Graph"
referredProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Element2Element.owner">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Node2Node"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
</value>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="../Graph2GraphMinimal/SimpleGraph.ecore.oclas#p.simplegraph.Node.label">
- <slotExpression isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph.ecore.oclas#T.simplegraph.Node" referredVariable="#qV..CopyGraph.Middle2Node.n2"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..CopyGraph.Middle2Node.n2" targetProperty="../Graph2GraphMinimal/SimpleGraph.ecore.oclas#p.simplegraph.Node.label"
+ isEmit="false">
<value xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String"
referredProperty="../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#p.simplegraph2graph.Node2Node.label">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class ../Graph2GraphMinimal/SimpleGraph2Graph.ecore.oclas#T.simplegraph2graph.Node2Node"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0"/>
</value>
</ownedStatements>
</rule>
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphMinimal/Graph2GraphMinimal.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphMinimal/Graph2GraphMinimal.qvti
index d73482903..cc4547df2 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphMinimal/Graph2GraphMinimal.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Graph2GraphMinimal/Graph2GraphMinimal.qvti
@@ -8,7 +8,7 @@ transformation CopyGraphMinimal {
}
map graph2graphLM in CopyGraphMinimal {
- check upperGraph(in g1:Graph;) {}
+ check upperGraph(in:upperGraph g1:Graph;) {}
new:middle g2g:Graph2Graph;
set g2g.graph1 := g1;
set g2g.name := g1.name;
@@ -18,7 +18,7 @@ map graph2graphLM in CopyGraphMinimal {
}
map graph2graphMR in CopyGraphMinimal {
- check middle(in g2gout:Graph2Graph;) { }
+ check middle(in:middle g2gout:Graph2Graph;) { }
new:lowerGraph g2:Graph;
set g2gout.graph2 := g2;
set g2.name := g2gout.name;
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLS.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLS.qvti
index 8a2a2eaed..f78f1ceea 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLS.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLS.qvti
@@ -28,10 +28,8 @@ map __root__ in hsv2hls {
}
map HSV2MiddleRoot in hsv2hls { -- Mapping root nodes L to M
- check hsv(in hsvRoot : HSVNode;) { }
- where(
- check hsvRoot.parent = null;
- ) {}
+ check hsv(in:hsv hsvRoot : HSVNode;) { }
+ check hsvRoot.parent = null;
new:middle middleRoot : HSVNode2HLSNode;
set middleRoot.hsv := hsvRoot;
set middleRoot.name := hsvRoot.name;
@@ -48,8 +46,8 @@ map HSV2MiddleRoot in hsv2hls { -- Mapping root nodes L to M
}
map HSV2MiddleRecursion in hsv2hls { -- Mapping child nodes L to M
- check hsv(in hsvNode : HSVNode;) {}
- enforce middle(in middleParent : HSVNode2HLSNode;) {}
+ check hsv(in:hsv hsvNode : HSVNode;) {}
+ enforce middle(in:middle middleParent : HSVNode2HLSNode;) {}
new:middle middleNode : HSVNode2HLSNode;
set middleNode.parent := middleParent;
set middleNode.hsv := hsvNode;
@@ -64,7 +62,7 @@ map HSV2MiddleRecursion in hsv2hls { -- Mapping child nodes L to M
}
map Middle2HLSRoot in hsv2hls { -- Mapping root nodes M to R
- check middle(in middleNode : HSVNode2HLSNode;) {}
+ check middle(in:middle middleNode : HSVNode2HLSNode;) {}
new:hls hlsNode : HLSNode;
set hlsNode.parent := null;
set middleNode.hls := hlsNode;
@@ -78,7 +76,7 @@ map Middle2HLSRoot in hsv2hls { -- Mapping root nodes M to R
}
map Middle2HLSRecursion in hsv2hls { -- Mapping child nodes M to R
- check middle(in middleNode : HSVNode2HLSNode;) {}
+ check middle(in:middle middleNode : HSVNode2HLSNode;) {}
new:hls hlsNode : HLSNode;
set hlsNode.parent := middleNode.parent.hls;
set middleNode.hls := hlsNode;
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLSas.qvtias b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLSas.qvtias
index d606f0f16..1e5258a0f 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLSas.qvtias
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/HSV2HLS/HSV2HLSas.qvtias
@@ -33,13 +33,11 @@
<ownedContext xmi:id="qV..hsv2hls.middle.middle" name="middle" type="pivot:Class http://www.eclipse.org/qvt/2015/QVTimperativeLibrary.oclas#T.qvtbaselibrary.Model"/>
</modelParameter>
<rule xsi:type="qvti:Mapping" xmi:id="m..hsv2hls.__root__" name="__root__">
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:MappingLoop">
- <ownedIterators xmi:id="i..hsv2hls.__root__.0.hsvRoot" name="hsvRoot" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"/>
+ <ownedIterators name="hsvRoot" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"/>
<ownedMappingStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..hsv2hls.HSV2MiddleRoot">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@guardPattern/@variable.0" isPolled="false">
- <value xsi:type="pivot:VariableExp" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#i..hsv2hls.__root__.0.hsvRoot"/>
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@ownedGuardVariables.0" isPolled="false">
+ <value xsi:type="pivot:VariableExp" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.0/@ownedStatements.0/@ownedIterators.0"/>
</binding>
</ownedMappingStatements>
<ownedSource xsi:type="pivot:OperationCallExp" type="#//@ownedPackages.1/@ownedClasses.0" referredOperation="http://www.eclipse.org/qvt/2015/QVTimperativeLibrary.oclas#o.qvtbaselibrary.Model.objectsOfKind..TT">
@@ -51,190 +49,166 @@
</rule>
<rule xsi:type="qvti:Mapping" xmi:id="m..hsv2hls.HSV2MiddleRoot" name="HSV2MiddleRoot">
<domain xsi:type="qvti:ImperativeDomain" isCheckable="true" isEnforceable="false" typedModel="#qT..hsv2hls.hsv">
- <guardPattern>
- <variable name="hsvRoot" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="hsvRoot" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredTypedModel="#qT..hsv2hls.hsv"/>
</domain>
- <guardPattern>
- <predicate>
- <conditionExpression xsi:type="pivot:OperationCallExp" name="=" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#Boolean"
- referredOperation="http://www.eclipse.org/ocl/2015/Library.oclas#o.ocl.OclAny.%61%..ocl.OclSelf">
- <ownedSource xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"
- referredProperty="HSVTree.ecore.oclas#p.HSVTree.HSVNode.parent">
- <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@guardPattern/@variable.0"/>
- </ownedSource>
- <ownedArguments xsi:type="pivot:NullLiteralExp" isRequired="false" type="pivot:VoidType http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclVoid"/>
- </conditionExpression>
- </predicate>
- </guardPattern>
- <bottomPattern/>
+ <ownedStatements xsi:type="qvti:CheckStatement">
+ <conditionExpression xsi:type="pivot:OperationCallExp" name="=" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#Boolean"
+ referredOperation="http://www.eclipse.org/ocl/2015/Library.oclas#o.ocl.OclAny.%61%..ocl.OclSelf">
+ <ownedSource xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"
+ referredProperty="HSVTree.ecore.oclas#p.HSVTree.HSVNode.parent">
+ <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@ownedGuardVariables.0"/>
+ </ownedSource>
+ <ownedArguments xsi:type="pivot:NullLiteralExp" isRequired="false" type="pivot:VoidType http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclVoid"/>
+ </conditionExpression>
+ </ownedStatements>
<ownedStatements xsi:type="qvti:NewStatement" xmi:id="qV..hsv2hls.HSV2MiddleRoot.middleRoot" name="middleRoot" isRequired="false"
type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredTypedModel="#qT..hsv2hls.middle"/>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.hsv">
- <slotExpression isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#qV..hsv2hls.HSV2MiddleRoot.middleRoot"/>
- <value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@guardPattern/@variable.0"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..hsv2hls.HSV2MiddleRoot.middleRoot" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.hsv"
+ isEmit="false">
+ <value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@ownedGuardVariables.0"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.name">
- <slotExpression isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#qV..hsv2hls.HSV2MiddleRoot.middleRoot"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..hsv2hls.HSV2MiddleRoot.middleRoot" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.name"
+ isEmit="false">
<value xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String"
referredProperty="HSVTree.ecore.oclas#p.HSVTree.HSVNode.name">
- <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@guardPattern/@variable.0"/>
+ <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@ownedGuardVariables.0"/>
</value>
</ownedStatements>
<ownedStatements xsi:type="qvti:MappingLoop">
- <ownedIterators xmi:id="i..hsv2hls.HSV2MiddleRoot.3.hsvChild" name="hsvChild" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"/>
+ <ownedIterators name="hsvChild" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"/>
<ownedMappingStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..hsv2hls.HSV2MiddleRecursion">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@guardPattern/@variable.0" isPolled="false">
- <value xsi:type="pivot:VariableExp" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#i..hsv2hls.HSV2MiddleRoot.3.hsvChild"/>
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@ownedGuardVariables.0" isPolled="false">
+ <value xsi:type="pivot:VariableExp" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@ownedStatements.4/@ownedIterators.0"/>
</binding>
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@guardPattern/@variable.0" isPolled="false">
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@ownedGuardVariables.0" isPolled="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"
referredVariable="#qV..hsv2hls.HSV2MiddleRoot.middleRoot"/>
</binding>
</ownedMappingStatements>
<ownedSource xsi:type="pivot:PropertyCallExp" type="#//@ownedPackages.1/@ownedClasses.1" referredProperty="HSVTree.ecore.oclas#p.HSVTree.HSVNode.children">
- <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@guardPattern/@variable.0"/>
+ <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.1/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
</ownedStatements>
<ownedStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..hsv2hls.Middle2HLSRoot">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@guardPattern/@variable.0" isPolled="false">
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@ownedGuardVariables.0" isPolled="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#qV..hsv2hls.HSV2MiddleRoot.middleRoot"/>
</binding>
</ownedStatements>
</rule>
<rule xsi:type="qvti:Mapping" xmi:id="m..hsv2hls.HSV2MiddleRecursion" name="HSV2MiddleRecursion">
<domain xsi:type="qvti:ImperativeDomain" isCheckable="true" isEnforceable="false" typedModel="#qT..hsv2hls.hsv">
- <guardPattern>
- <variable name="hsvNode" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="hsvNode" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredTypedModel="#qT..hsv2hls.hsv"/>
</domain>
<domain xsi:type="qvti:ImperativeDomain" isCheckable="false" isEnforceable="true" typedModel="#qT..hsv2hls.middle">
- <guardPattern>
- <variable name="middleParent" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="middleParent" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"
+ referredTypedModel="#qT..hsv2hls.middle"/>
</domain>
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:NewStatement" xmi:id="qV..hsv2hls.HSV2MiddleRecursion.middleNode" name="middleNode" isRequired="false"
type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredTypedModel="#qT..hsv2hls.middle"/>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.parent">
- <slotExpression isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#qV..hsv2hls.HSV2MiddleRecursion.middleNode"/>
- <value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@guardPattern/@variable.0"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..hsv2hls.HSV2MiddleRecursion.middleNode" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.parent"
+ isEmit="false">
+ <value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@ownedGuardVariables.0"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.hsv">
- <slotExpression isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#qV..hsv2hls.HSV2MiddleRecursion.middleNode"/>
- <value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@guardPattern/@variable.0"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..hsv2hls.HSV2MiddleRecursion.middleNode" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.hsv"
+ isEmit="false">
+ <value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@ownedGuardVariables.0"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.name">
- <slotExpression isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#qV..hsv2hls.HSV2MiddleRecursion.middleNode"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..hsv2hls.HSV2MiddleRecursion.middleNode" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.name"
+ isEmit="false">
<value xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String"
referredProperty="HSVTree.ecore.oclas#p.HSVTree.HSVNode.name">
- <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@guardPattern/@variable.0"/>
+ <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@ownedGuardVariables.0"/>
</value>
</ownedStatements>
<ownedStatements xsi:type="qvti:MappingLoop">
- <ownedIterators xmi:id="i..hsv2hls.HSV2MiddleRecursion.4.hsvChild" name="hsvChild" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"/>
+ <ownedIterators name="hsvChild" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode"/>
<ownedMappingStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..hsv2hls.HSV2MiddleRecursion">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@guardPattern/@variable.0" isPolled="false">
- <value xsi:type="pivot:VariableExp" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#i..hsv2hls.HSV2MiddleRecursion.4.hsvChild"/>
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@ownedGuardVariables.0" isPolled="false">
+ <value xsi:type="pivot:VariableExp" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@ownedStatements.4/@ownedIterators.0"/>
</binding>
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@guardPattern/@variable.0" isPolled="false">
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.1/@ownedGuardVariables.0" isPolled="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"
referredVariable="#qV..hsv2hls.HSV2MiddleRecursion.middleNode"/>
</binding>
</ownedMappingStatements>
<ownedSource xsi:type="pivot:PropertyCallExp" type="#//@ownedPackages.1/@ownedClasses.1" referredProperty="HSVTree.ecore.oclas#p.HSVTree.HSVNode.children">
- <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@guardPattern/@variable.0"/>
+ <ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSVTree.ecore.oclas#T.HSVTree.HSVNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.2/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
</ownedStatements>
</rule>
<rule xsi:type="qvti:Mapping" xmi:id="m..hsv2hls.Middle2HLSRoot" name="Middle2HLSRoot">
<domain xsi:type="qvti:ImperativeDomain" isCheckable="true" isEnforceable="false" typedModel="#qT..hsv2hls.middle">
- <guardPattern>
- <variable name="middleNode" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="middleNode" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredTypedModel="#qT..hsv2hls.middle"/>
</domain>
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:NewStatement" xmi:id="qV..hsv2hls.Middle2HLSRoot.hlsNode" name="hlsNode" isRequired="false" type="pivot:Class HLSTree.ecore.oclas#T.HLSTree.HLSNode"
referredTypedModel="#qT..hsv2hls.hls"/>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HLSTree.ecore.oclas#p.HLSTree.HLSNode.parent">
- <slotExpression isRequired="false" type="pivot:Class HLSTree.ecore.oclas#T.HLSTree.HLSNode" referredVariable="#qV..hsv2hls.Middle2HLSRoot.hlsNode"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..hsv2hls.Middle2HLSRoot.hlsNode" targetProperty="HLSTree.ecore.oclas#p.HLSTree.HLSNode.parent"
+ isEmit="false">
<value xsi:type="pivot:NullLiteralExp" isRequired="false" type="pivot:VoidType http://www.eclipse.org/ocl/2015/Library.oclas#T.ocl.OclVoid"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.hls">
- <slotExpression isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@guardPattern/@variable.0"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@ownedGuardVariables.0"
+ targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.hls" isEmit="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HLSTree.ecore.oclas#T.HLSTree.HLSNode" referredVariable="#qV..hsv2hls.Middle2HLSRoot.hlsNode"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HLSTree.ecore.oclas#p.HLSTree.HLSNode.name">
- <slotExpression isRequired="false" type="pivot:Class HLSTree.ecore.oclas#T.HLSTree.HLSNode" referredVariable="#qV..hsv2hls.Middle2HLSRoot.hlsNode"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..hsv2hls.Middle2HLSRoot.hlsNode" targetProperty="HLSTree.ecore.oclas#p.HLSTree.HLSNode.name"
+ isEmit="false">
<value xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String"
referredProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.name">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@ownedGuardVariables.0"/>
</value>
</ownedStatements>
<ownedStatements xsi:type="qvti:MappingLoop">
- <ownedIterators xmi:id="i..hsv2hls.Middle2HLSRoot.4.middleChild" name="middleChild" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"/>
+ <ownedIterators name="middleChild" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"/>
<ownedMappingStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..hsv2hls.Middle2HLSRecursion">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0" isPolled="false">
- <value xsi:type="pivot:VariableExp" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#i..hsv2hls.Middle2HLSRoot.4.middleChild"/>
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0" isPolled="false">
+ <value xsi:type="pivot:VariableExp" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@ownedStatements.4/@ownedIterators.0"/>
</binding>
</ownedMappingStatements>
<ownedSource xsi:type="pivot:PropertyCallExp" type="#//@ownedPackages.1/@ownedClasses.2" referredProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.children">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.3/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
</ownedStatements>
</rule>
<rule xsi:type="qvti:Mapping" xmi:id="m..hsv2hls.Middle2HLSRecursion" name="Middle2HLSRecursion">
<domain xsi:type="qvti:ImperativeDomain" isCheckable="true" isEnforceable="false" typedModel="#qT..hsv2hls.middle">
- <guardPattern>
- <variable name="middleNode" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"/>
- </guardPattern>
- <bottomPattern/>
+ <ownedGuardVariables name="middleNode" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredTypedModel="#qT..hsv2hls.middle"/>
</domain>
- <guardPattern/>
- <bottomPattern/>
<ownedStatements xsi:type="qvti:NewStatement" xmi:id="qV..hsv2hls.Middle2HLSRecursion.hlsNode" name="hlsNode" isRequired="false"
type="pivot:Class HLSTree.ecore.oclas#T.HLSTree.HLSNode" referredTypedModel="#qT..hsv2hls.hls"/>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HLSTree.ecore.oclas#p.HLSTree.HLSNode.parent">
- <slotExpression isRequired="false" type="pivot:Class HLSTree.ecore.oclas#T.HLSTree.HLSNode" referredVariable="#qV..hsv2hls.Middle2HLSRecursion.hlsNode"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..hsv2hls.Middle2HLSRecursion.hlsNode" targetProperty="HLSTree.ecore.oclas#p.HLSTree.HLSNode.parent"
+ isEmit="false">
<value xsi:type="pivot:PropertyCallExp" type="pivot:Class HLSTree.ecore.oclas#T.HLSTree.HLSNode" referredProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.hls">
<ownedSource xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"
referredProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.parent">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
</value>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.hls">
- <slotExpression isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0"
+ targetProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.hls" isEmit="false">
<value xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HLSTree.ecore.oclas#T.HLSTree.HLSNode" referredVariable="#qV..hsv2hls.Middle2HLSRecursion.hlsNode"/>
</ownedStatements>
- <ownedStatements xsi:type="qvti:SetStatement" targetProperty="HLSTree.ecore.oclas#p.HLSTree.HLSNode.name">
- <slotExpression isRequired="false" type="pivot:Class HLSTree.ecore.oclas#T.HLSTree.HLSNode" referredVariable="#qV..hsv2hls.Middle2HLSRecursion.hlsNode"/>
+ <ownedStatements xsi:type="qvti:SetStatement" targetVariable="#qV..hsv2hls.Middle2HLSRecursion.hlsNode" targetProperty="HLSTree.ecore.oclas#p.HLSTree.HLSNode.name"
+ isEmit="false">
<value xsi:type="pivot:PropertyCallExp" isRequired="false" type="pivot:PrimitiveType http://www.eclipse.org/ocl/2015/Library.oclas#String"
referredProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.name">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0"/>
</value>
</ownedStatements>
<ownedStatements xsi:type="qvti:MappingLoop">
- <ownedIterators xmi:id="i..hsv2hls.Middle2HLSRecursion.4.middleChild" name="middleChild" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"/>
+ <ownedIterators name="middleChild" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"/>
<ownedMappingStatements xsi:type="qvti:MappingCall" isInfinite="false" referredMapping="#m..hsv2hls.Middle2HLSRecursion">
- <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0" isPolled="false">
- <value xsi:type="pivot:VariableExp" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#i..hsv2hls.Middle2HLSRecursion.4.middleChild"/>
+ <binding boundVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0" isPolled="false">
+ <value xsi:type="pivot:VariableExp" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode" referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@ownedStatements.4/@ownedIterators.0"/>
</binding>
</ownedMappingStatements>
<ownedSource xsi:type="pivot:PropertyCallExp" type="#//@ownedPackages.1/@ownedClasses.2" referredProperty="HSV2HLS.ecore.oclas#p.HSV2HLS.HSVNode2HLSNode.children">
<ownedSource xsi:type="pivot:VariableExp" isRequired="false" type="pivot:Class HSV2HLS.ecore.oclas#T.HSV2HLS.HSVNode2HLSNode"
- referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@guardPattern/@variable.0"/>
+ referredVariable="#//@ownedPackages.0/@ownedClasses.0/@rule.4/@domain.0/@ownedGuardVariables.0"/>
</ownedSource>
</ownedStatements>
</rule>
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti
index 4d8e69425..9a597182f 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti
@@ -9,16 +9,14 @@ transformation KiamaRewrite_qvtp_qvtcas
map __root__ in KiamaRewrite_qvtp_qvtcas
{
- where () {
- var roots : Set(ocl::OclElement) := leftCS.rootObjects();
- var _'«child-NumCS»' : Set(kiamacs::NumCS) := roots->selectByKind(kiamacs::NumCS);
- var ji_NumCS1 : Set(kiamacs::NumCS) := _'«child-NumCS»';
- var _'«child-PlusCS»' : Set(kiamacs::PlusCS) := roots->selectByKind(kiamacs::PlusCS);
- var ji_PlusCS1 : Set(kiamacs::PlusCS) := _'«child-PlusCS»';
- var ji_PlusCS_31 : Set(kiamacs::PlusCS) := _'«child-PlusCS»';
- var _'«child-TopCS»' : Set(kiamacs::TopCS) := roots->selectByKind(kiamacs::TopCS);
- var ji_TopCS1 : Set(kiamacs::TopCS) := _'«child-TopCS»';
- }
+ var roots : Set(ocl::OclElement) := leftCS.rootObjects();
+ var _'«child-NumCS»' : Set(kiamacs::NumCS) := roots->selectByKind(kiamacs::NumCS);
+ var ji_NumCS1 : Set(kiamacs::NumCS) := _'«child-NumCS»';
+ var _'«child-PlusCS»' : Set(kiamacs::PlusCS) := roots->selectByKind(kiamacs::PlusCS);
+ var ji_PlusCS1 : Set(kiamacs::PlusCS) := _'«child-PlusCS»';
+ var ji_PlusCS_31 : Set(kiamacs::PlusCS) := _'«child-PlusCS»';
+ var _'«child-TopCS»' : Set(kiamacs::TopCS) := roots->selectByKind(kiamacs::TopCS);
+ var ji_TopCS1 : Set(kiamacs::TopCS) := _'«child-TopCS»';
for loop0 : kiamacs::TopCS in ji_TopCS1 {
call m_TopCS_ast {
lTopCS := loop0;
@@ -88,140 +86,122 @@ map __root__ in KiamaRewrite_qvtp_qvtcas
map m_NumCS_ast in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lNumCS : NumCS;) {}
+ check leftCS(in:leftCS lNumCS : NumCS;) {}
new:rightAS rNum : Num;
set lNumCS.ast := rNum;
}
map m_NumCS_ast_2 in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lNumCS : NumCS;) {}
- enforce rightAS {
- enforce kiamaas::Node::depth }() {}
- where () {
- var ast : ecore::EObject := lNumCS.ast;
- var aNum : kiamaas::Num := ast.oclAsType(kiamaas::Num);
- var oclContainer : ocl::OclElement := aNum.oclContainer;
- var _'oclIsKindOf\nkiamaas::Top' : Boolean := oclContainer.oclIsKindOf(kiamaas::Top);
- var _'if' : Integer := if _'oclIsKindOf\nkiamaas::Top'
- then 0
- else oclContainer.oclAsType(kiamaas::Plus).depth + 1 endif;
- }
- set aNum.depth := _'if';
+ check leftCS(in:leftCS lNumCS : NumCS;) {}
+ var ast : ecore::EObject := lNumCS.ast;
+ var aNum : kiamaas::Num := ast.oclAsType(kiamaas::Num);
+ var oclContainer : ocl::OclElement := aNum.oclContainer;
+ var _'oclIsKindOf\nkiamaas::Top' : Boolean := oclContainer.oclIsKindOf(kiamaas::Top);
+ var _'if' : Integer := if _'oclIsKindOf\nkiamaas::Top'
+ then 0
+ else oclContainer.oclAsType(kiamaas::Plus).depth + 1 endif;
+ emit aNum.depth := _'if';
}
map m_NumCS_ast_value_1 in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lNumCS : NumCS;) {}
- enforce rightAS {
- enforce kiamaas::Node::height }() {}
- where () {
- var ast : ecore::EObject := lNumCS.ast;
- var value : ecore::EInt := lNumCS.value;
- var aNum : kiamaas::Num := ast.oclAsType(kiamaas::Num);
- }
- set aNum.height := 0;
+ check leftCS(in:leftCS lNumCS : NumCS;) {}
+ var ast : ecore::EObject := lNumCS.ast;
+ var value : ecore::EInt := lNumCS.value;
+ var aNum : kiamaas::Num := ast.oclAsType(kiamaas::Num);
+ emit aNum.height := 0;
set aNum.value := value;
}
map m_PlusCS_ast in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lPlusCS : PlusCS;) {}
+ check leftCS(in:leftCS lPlusCS : PlusCS;) {}
enforce rightAS {
- check kiamaas::Node::height enforce kiamaas::Node::height }() {}
- where () {
- var ast : ecore::EObject := lPlusCS.ast;
- var aPlus : kiamaas::Plus := ast.oclAsType(kiamaas::Plus);
- var left : kiamaas::Node := aPlus.left;
- var right : kiamaas::Node := aPlus.right;
- var height : ecore::EIntegerObject := left.height;
- var height1 : ecore::EIntegerObject := right.height;
- var oclAsSet : Set(ecore::EIntegerObject) := height.oclAsSet();
- var including : Set(ecore::EIntegerObject) := oclAsSet->including(height1);
- var max : ecore::EIntegerObject := including->max();
- var _'+' : Integer := max + 1;
- }
- set aPlus.height := _'+';
+ check kiamaas::Node::height }() {}
+ var ast : ecore::EObject := lPlusCS.ast;
+ var aPlus : kiamaas::Plus := ast.oclAsType(kiamaas::Plus);
+ var left : kiamaas::Node := aPlus.left;
+ var right : kiamaas::Node := aPlus.right;
+ var height : ecore::EIntegerObject := left.height;
+ var height1 : ecore::EIntegerObject := right.height;
+ var oclAsSet : Set(ecore::EIntegerObject) := height.oclAsSet();
+ var including : Set(ecore::EIntegerObject) := oclAsSet->including(height1);
+ var max : ecore::EIntegerObject := including->max();
+ var _'+' : Integer := max + 1;
+ emit aPlus.height := _'+';
}
map m_PlusCS_ast_1 in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lPlusCS : PlusCS;) {}
+ check leftCS(in:leftCS lPlusCS : PlusCS;) {}
enforce rightAS {
- check kiamaas::Node::depth enforce kiamaas::Node::depth }() {}
- where () {
- var ast : ecore::EObject := lPlusCS.ast;
- var aPlus : kiamaas::Plus := ast.oclAsType(kiamaas::Plus);
- var oclContainer : ocl::OclElement := aPlus.oclContainer;
- var _'oclIsKindOf\nkiamaas::Top' : Boolean := oclContainer.oclIsKindOf(kiamaas::Top);
- var _'if' : Integer := if _'oclIsKindOf\nkiamaas::Top'
- then 0
- else oclContainer.oclAsType(kiamaas::Plus).depth + 1 endif;
- }
- set aPlus.depth := _'if';
+ check kiamaas::Node::depth }() {}
+ var ast : ecore::EObject := lPlusCS.ast;
+ var aPlus : kiamaas::Plus := ast.oclAsType(kiamaas::Plus);
+ var oclContainer : ocl::OclElement := aPlus.oclContainer;
+ var _'oclIsKindOf\nkiamaas::Top' : Boolean := oclContainer.oclIsKindOf(kiamaas::Top);
+ var _'if' : Integer := if _'oclIsKindOf\nkiamaas::Top'
+ then 0
+ else oclContainer.oclAsType(kiamaas::Plus).depth + 1 endif;
+ emit aPlus.depth := _'if';
}
map m_PlusCS_ast_2 in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lPlusCS : PlusCS;) {}
+ check leftCS(in:leftCS lPlusCS : PlusCS;) {}
new:rightAS rPlus : Plus;
set lPlusCS.ast := rPlus;
}
map m_PlusCS_ast_left in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lPlusCS : PlusCS;) {}
- where () {
- var ast : ecore::EObject := lPlusCS.ast;
- var left : kiamacs::NodeCS := lPlusCS.left;
- var aPlus : kiamaas::Plus := ast.oclAsType(kiamaas::Plus);
- var ast1 : ecore::EObject := left.ast;
- var aNode : kiamaas::Node := ast1.oclAsType(kiamaas::Node);
- }
+ check leftCS(in:leftCS lPlusCS : PlusCS;) {}
+ var ast : ecore::EObject := lPlusCS.ast;
+ var left : kiamacs::NodeCS := lPlusCS.left;
+ var aPlus : kiamaas::Plus := ast.oclAsType(kiamaas::Plus);
+ var ast1 : ecore::EObject := left.ast;
+ var aNode : kiamaas::Node := ast1.oclAsType(kiamaas::Node);
set aPlus.left := aNode;
}
map m_PlusCS_ast_right in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lPlusCS : PlusCS;) {}
- where () {
- var ast : ecore::EObject := lPlusCS.ast;
- var right : kiamacs::NodeCS := lPlusCS.right;
- var aPlus : kiamaas::Plus := ast.oclAsType(kiamaas::Plus);
- var ast1 : ecore::EObject := right.ast;
- var aNode : kiamaas::Node := ast1.oclAsType(kiamaas::Node);
- }
+ check leftCS(in:leftCS lPlusCS : PlusCS;) {}
+ var ast : ecore::EObject := lPlusCS.ast;
+ var right : kiamacs::NodeCS := lPlusCS.right;
+ var aPlus : kiamaas::Plus := ast.oclAsType(kiamaas::Plus);
+ var ast1 : ecore::EObject := right.ast;
+ var aNode : kiamaas::Node := ast1.oclAsType(kiamaas::Node);
set aPlus.right := aNode;
}
map m_TopCS_ast in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lTopCS : TopCS;) {}
+ check leftCS(in:leftCS lTopCS : TopCS;) {}
new:rightAS rTop : Top;
set lTopCS.ast := rTop;
}
map m_TopCS_ast_node in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in lTopCS : TopCS;) {}
- where () {
- var ast : ecore::EObject := lTopCS.ast;
- var node : kiamacs::NodeCS := lTopCS.node;
- var aTop : kiamaas::Top := ast.oclAsType(kiamaas::Top);
- var ast1 : ecore::EObject := node.ast;
- var aNode : kiamaas::Node := ast1.oclAsType(kiamaas::Node);
- }
+ check leftCS(in:leftCS lTopCS : TopCS;) {}
+ var ast : ecore::EObject := lTopCS.ast;
+ var node : kiamacs::NodeCS := lTopCS.node;
+ var aTop : kiamaas::Top := ast.oclAsType(kiamaas::Top);
+ var ast1 : ecore::EObject := node.ast;
+ var aNode : kiamaas::Node := ast1.oclAsType(kiamaas::Node);
set aTop.node := aNode;
}
map r_PlusCS_left in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in _'«parent»' : PlusCS;) {}
- where (inout ji_PlusCS : Set(kiamacs::PlusCS); inout ji_NumCS : Set(kiamacs::NumCS);) {
- var allChildren : Set(kiamacs::NodeCS) := _'«parent»'.left.oclAsSet();
- var _'«child-PlusCS»' : Set(kiamacs::PlusCS) := allChildren->selectByKind(kiamacs::PlusCS);
- var _'«child-NumCS»' : Set(kiamacs::NumCS) := allChildren->selectByKind(kiamacs::NumCS);
- }
+ inout ji_PlusCS : Set(kiamacs::PlusCS);
+ inout ji_NumCS : Set(kiamacs::NumCS);
+ check leftCS(in:leftCS _'«parent»' : PlusCS;) {}
+ var allChildren : Set(kiamacs::NodeCS) := _'«parent»'.left.oclAsSet();
+ var _'«child-PlusCS»' : Set(kiamacs::PlusCS) := allChildren->selectByKind(kiamacs::PlusCS);
+ var _'«child-NumCS»' : Set(kiamacs::NumCS) := allChildren->selectByKind(kiamacs::NumCS);
add ji_PlusCS += _'«child-PlusCS»';
add ji_NumCS += _'«child-NumCS»';
for aChild : kiamacs::PlusCS in _'«child-PlusCS»' {
@@ -235,12 +215,12 @@ map r_PlusCS_left in KiamaRewrite_qvtp_qvtcas
map r_PlusCS_right in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in _'«parent»' : PlusCS;) {}
- where (inout ji_PlusCS : Set(kiamacs::PlusCS); inout ji_NumCS : Set(kiamacs::NumCS);) {
- var allChildren : Set(kiamacs::NodeCS) := _'«parent»'.right.oclAsSet();
- var _'«child-PlusCS»' : Set(kiamacs::PlusCS) := allChildren->selectByKind(kiamacs::PlusCS);
- var _'«child-NumCS»' : Set(kiamacs::NumCS) := allChildren->selectByKind(kiamacs::NumCS);
- }
+ inout ji_PlusCS : Set(kiamacs::PlusCS);
+ inout ji_NumCS : Set(kiamacs::NumCS);
+ check leftCS(in:leftCS _'«parent»' : PlusCS;) {}
+ var allChildren : Set(kiamacs::NodeCS) := _'«parent»'.right.oclAsSet();
+ var _'«child-PlusCS»' : Set(kiamacs::PlusCS) := allChildren->selectByKind(kiamacs::PlusCS);
+ var _'«child-NumCS»' : Set(kiamacs::NumCS) := allChildren->selectByKind(kiamacs::NumCS);
add ji_PlusCS += _'«child-PlusCS»';
add ji_NumCS += _'«child-NumCS»';
for aChild : kiamacs::PlusCS in _'«child-PlusCS»' {
@@ -254,12 +234,13 @@ map r_PlusCS_right in KiamaRewrite_qvtp_qvtcas
map r_TopCS_node in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in _'«parent»' : TopCS;) {}
- where (inout ji_PlusCS : Set(kiamacs::PlusCS); inout ji_PlusCS_3 : Set(kiamacs::PlusCS); inout ji_NumCS : Set(kiamacs::NumCS);) {
- var allChildren : Set(kiamacs::NodeCS) := _'«parent»'.node.oclAsSet();
- var _'«child-PlusCS»' : Set(kiamacs::PlusCS) := allChildren->selectByKind(kiamacs::PlusCS);
- var _'«child-NumCS»' : Set(kiamacs::NumCS) := allChildren->selectByKind(kiamacs::NumCS);
- }
+ inout ji_PlusCS : Set(kiamacs::PlusCS);
+ inout ji_PlusCS_3 : Set(kiamacs::PlusCS);
+ inout ji_NumCS : Set(kiamacs::NumCS);
+ check leftCS(in:leftCS _'«parent»' : TopCS;) {}
+ var allChildren : Set(kiamacs::NodeCS) := _'«parent»'.node.oclAsSet();
+ var _'«child-PlusCS»' : Set(kiamacs::PlusCS) := allChildren->selectByKind(kiamacs::PlusCS);
+ var _'«child-NumCS»' : Set(kiamacs::NumCS) := allChildren->selectByKind(kiamacs::NumCS);
add ji_PlusCS += _'«child-PlusCS»';
add ji_PlusCS_3 += _'«child-PlusCS»';
add ji_NumCS += _'«child-NumCS»';
@@ -267,11 +248,11 @@ map r_TopCS_node in KiamaRewrite_qvtp_qvtcas
map r__PlusCS in KiamaRewrite_qvtp_qvtcas
{
- check leftCS(in _'«head»' : PlusCS;) {}
- where (inout ji_PlusCS : Set(kiamacs::PlusCS); inout ji_NumCS : Set(kiamacs::NumCS);) {
- out _'«local»' : Set(kiamacs::PlusCS);
- out _'«new»' : Set(kiamacs::PlusCS);
- }
+ inout ji_PlusCS : Set(kiamacs::PlusCS);
+ inout ji_NumCS : Set(kiamacs::NumCS);
+ check leftCS(in:leftCS _'«head»' : PlusCS;) {}
+ out _'«local»' : Set(kiamacs::PlusCS);
+ out _'«new»' : Set(kiamacs::PlusCS);
call r_PlusCS_left {
ji_NumCS := ji_NumCS;
ji_PlusCS := _'«local»';
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ManualUML2RDBMS/ManualUML2RDBMS.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ManualUML2RDBMS/ManualUML2RDBMS.qvti
index 89bb73e09..b405a3744 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ManualUML2RDBMS/ManualUML2RDBMS.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/ManualUML2RDBMS/ManualUML2RDBMS.qvti
@@ -17,7 +17,7 @@ map __root__ in ManualUML2RDBMS {
}
map packageToSchemaLM in ManualUML2RDBMS {
- check uml (in p:Package;) { }
+ check uml(in:uml p:Package;) { }
new:middle p2s:PackageToSchema;
set p2s.umlPackage := p;
set p2s.name := p.name;
@@ -69,7 +69,7 @@ map packageToSchemaLM in ManualUML2RDBMS {
}
map packageToSchemaMR in ManualUML2RDBMS {
- check middle (in p2s:PackageToSchema;) {}
+ check middle(in:middle p2s:PackageToSchema;) {}
new:rdbms s:Schema;
set p2s.schema := s;
call packageToSchemaMR_1 {
@@ -100,18 +100,17 @@ map packageToSchemaMR in ManualUML2RDBMS {
}
map packageToSchemaMR_1 in ManualUML2RDBMS {
- check middle (in p2s_1:PackageToSchema;) {}
- enforce rdbms (in s_1:Schema;) {}
+ check middle(in:middle p2s_1:PackageToSchema;) {}
+ enforce rdbms(in:rdbms s_1:Schema;) {}
set s_1.name := p2s_1.name;
}
map integerToNumberLM in ManualUML2RDBMS {
- check uml (in p:Package; in prim:PrimitiveDataType;) {}
- enforce middle (in p2s:PackageToSchema;) {}
- where (check prim.namespace = p;
- check prim.name = 'Integer';
- check p2s.umlPackage=p;
- ) {}
+ check uml(in:uml p:Package; in:uml prim:PrimitiveDataType;) {}
+ enforce middle(in:middle p2s:PackageToSchema;) {}
+ check prim.namespace = p;
+ check prim.name = 'Integer';
+ check p2s.umlPackage=p;
new:middle p2n:PrimitiveToName;
set p2n.owner := p2s;
set p2n._'primitive' := prim;
@@ -120,21 +119,17 @@ map integerToNumberLM in ManualUML2RDBMS {
}
map integerToNumberMR in ManualUML2RDBMS {
- check middle (in p2s:PackageToSchema; in p2n:PrimitiveToName;) {}
- where (
- check p2n.owner = p2s;
- check p2n.name = 'Integer' + '2' + 'NUMBER';
- ) {}
+ check middle(in:middle p2s:PackageToSchema; in:middle p2n:PrimitiveToName;) {}
+ check p2n.owner = p2s;
+ check p2n.name = 'Integer' + '2' + 'NUMBER';
}
map booleanToBooleanLM in ManualUML2RDBMS {
- check uml (in p:Package; in prim:PrimitiveDataType;) { }
- enforce middle (in p2s:PackageToSchema;) {}
- where (
- check prim.namespace = p;
- check prim.name = 'Boolean';
- check p2s.umlPackage=p;
- ) {}
+ check uml(in:uml p:Package; in:uml prim:PrimitiveDataType;) { }
+ enforce middle(in:middle p2s:PackageToSchema;) {}
+ check prim.namespace = p;
+ check prim.name = 'Boolean';
+ check p2s.umlPackage=p;
new:middle p2n:PrimitiveToName;
set p2n.owner := p2s;
set p2n._'primitive' := prim;
@@ -143,22 +138,17 @@ map booleanToBooleanLM in ManualUML2RDBMS {
}
map booleanToBooleanMR in ManualUML2RDBMS {
- check middle (in p2s:PackageToSchema; in p2n:PrimitiveToName;) {}
- enforce rdbms () {}
- where (
- check p2n.owner = p2s;
- check p2n.name = 'Boolean' + '2' + 'BOOLEAN';
- ) {}
+ check middle(in:middle p2s:PackageToSchema; in:middle p2n:PrimitiveToName;) {}
+ check p2n.owner = p2s;
+ check p2n.name = 'Boolean' + '2' + 'BOOLEAN';
}
map stringToVarcharLM in ManualUML2RDBMS {
- check uml (in p:Package; in prim:PrimitiveDataType;) { }
- enforce middle (in p2s:PackageToSchema;) {}
- where (
- check prim.namespace = p;
- check prim.name = 'String';
- check p2s.umlPackage=p;
- ) {}
+ check uml(in:uml p:Package; in:uml prim:PrimitiveDataType;) { }
+ enforce middle(in:middle p2s:PackageToSchema;) {}
+ check prim.namespace = p;
+ check prim.name = 'String';
+ check p2s.umlPackage=p;
new:middle p2n:PrimitiveToName;
set p2n.owner := p2s;
set p2n._'primitive' := prim;
@@ -167,12 +157,9 @@ map stringToVarcharLM in ManualUML2RDBMS {
}
map stringToVarcharMR in ManualUML2RDBMS {
- check middle (in p2s:PackageToSchema; in p2n:PrimitiveToName;) {}
- enforce rdbms () {}
- where (
- check p2n.owner = p2s;
- check p2n.name = 'String' + '2' + 'VARCHAR';
- ) {}
+ check middle(in:middle p2s:PackageToSchema; in:middle p2n:PrimitiveToName;) {}
+ check p2n.owner = p2s;
+ check p2n.name = 'String' + '2' + 'VARCHAR';
}
query ManualUML2RDBMS::getAllSupers(cls : UML::Class[1]) : Set(UML::Class) {
@@ -188,13 +175,11 @@ query ManualUML2RDBMS::getAllForwards(cls : UML::Class[1]) : Set(UML::Associatio
}
map classToTableLM in ManualUML2RDBMS {
- check uml (in p:Package; in c:Class;) { }
- enforce middle (in p2s:PackageToSchema;) {}
- where (
- check c.kind = 'persistent';
- check c.namespace = p;
- check p2s.umlPackage=p;
- ) {}
+ check uml(in:uml p:Package; in:uml c:Class;) { }
+ enforce middle(in:middle p2s:PackageToSchema;) {}
+ check c.kind = 'persistent';
+ check c.namespace = p;
+ check p2s.umlPackage=p;
new:middle c2t:ClassToTable;
set c2t.owner := p2s;
set c2t.umlClass := c;
@@ -223,11 +208,9 @@ map classToTableLM in ManualUML2RDBMS {
}
map classToTableMR in ManualUML2RDBMS {
- check middle (in p2s:PackageToSchema; in c2t:ClassToTable;) {}
- enforce rdbms (in s:Schema;) {}
- where (
- check c2t.owner = p2s;
- ) {}
+ check middle(in:middle p2s:PackageToSchema; in:middle c2t:ClassToTable;) {}
+ enforce rdbms(in:rdbms s:Schema;) {}
+ check c2t.owner = p2s;
new:rdbms t:Table;
set t.kind := 'base';
set t.schema := s;
@@ -264,15 +247,15 @@ map classToTableMR in ManualUML2RDBMS {
}
map classToTableMR_1 in ManualUML2RDBMS {
- check middle (in c2t_1:ClassToTable;) {}
- enforce rdbms (in t_1:Table;) { }
+ check middle(in:middle c2t_1:ClassToTable;) {}
+ enforce rdbms(in:rdbms t_1:Table;) { }
set c2t_1.table := t_1;
set t_1.name := c2t_1.name;
}
map classToTableMR_2 in ManualUML2RDBMS {
- check middle (in c2t_2:ClassToTable;) {}
- enforce rdbms (in t_2:Table;) {}
+ check middle(in:middle c2t_2:ClassToTable;) {}
+ enforce rdbms(in:rdbms t_2:Table;) {}
new:rdbms pk:Key;
new:rdbms pc:Column;
set pk.owner := t_2;
@@ -293,32 +276,33 @@ map classToTableMR_2 in ManualUML2RDBMS {
}
map classToTableMR_2_1 in ManualUML2RDBMS {
- check middle (in c2t_2_1:ClassToTable;) {}
- enforce rdbms (in pk_2_1:Key; in pc_2_1:Column;) {}
+ check middle(in:middle c2t_2_1:ClassToTable;) {}
+ enforce rdbms(in:rdbms pk_2_1:Key; in:rdbms pc_2_1:Column;) {}
set c2t_2_1.primaryKey := pk_2_1;
set c2t_2_1.column := pc_2_1;
}
map classToTableMR_2_2 in ManualUML2RDBMS {
- check middle () {}
- enforce rdbms (in pk_2_2:Key; in pc_2_2:Column; in t_2_2:Table;) {}
+ enforce rdbms(in:rdbms pk_2_2:Key; in:rdbms pc_2_2:Column; in:rdbms t_2_2:Table;) {}
set pc_2_2.name := t_2_2.name+'_tid';
set pk_2_2.name := t_2_2.name+'_pk';
}
map associationToForeignKeyLM in ManualUML2RDBMS {
- check uml (in p:Package; invar sc:Class := a.source; invar dc:Class := a.destination; in a:Association;) {
+ check uml(in:uml p:Package; in:uml a:Association;) {
-- sc.namespace = p;
- }
- enforce middle (in p2s:PackageToSchema; invar sc2t:ClassToTable := sc.ClassToTable; invar dc2t:ClassToTable := dc.ClassToTable;) {}
- where (
- check a.namespace = p;
- check sc.namespace = p;
- -- getAllForwards(sc)->includes(a);
- -- getAllSupers(dc)->includes(a.destination);
- check p2s.umlPackage = p;
- ) {}
- new:middle a2f:AssociationToForeignKey;
+ }
+ enforce middle(in:middle p2s:PackageToSchema; ) {}
+ check sc:Class := a.source;
+ check dc:Class := a.destination;
+ check sc2t:ClassToTable := sc.ClassToTable;
+ check dc2t:ClassToTable := dc.ClassToTable;
+ check a.namespace = p;
+ check sc.namespace = p;
+ -- getAllForwards(sc)->includes(a);
+ -- getAllSupers(dc)->includes(a.destination);
+ check p2s.umlPackage = p;
+ new:middle a2f:AssociationToForeignKey;
set sc2t.owner := p2s;
set a2f.owner := sc2t;
set a2f.referenced := dc2t;
@@ -335,20 +319,18 @@ map associationToForeignKeyLM in ManualUML2RDBMS {
}
map associationToForeignKeyMR in ManualUML2RDBMS {
- check middle (in p2s:PackageToSchema; in sc2t:ClassToTable; in dc2t:ClassToTable; in a2f:AssociationToForeignKey;) {}
- enforce rdbms (in s:Schema; in st:Table; in dt:Table; in rk:Key;) {}
- where (
- check a2f.owner = sc2t;
- check a2f.referenced = dc2t;
- check p2s.schema = s;
- --sc2t.table = st;
- --dc2t.table = dt;
+ check middle(in:middle p2s:PackageToSchema; in:middle sc2t:ClassToTable; in:middle dc2t:ClassToTable; in:middle a2f:AssociationToForeignKey;) {}
+ enforce rdbms(in:rdbms s:Schema; in:rdbms st:Table; in:rdbms dt:Table; in:rdbms rk:Key;) {}
+ check a2f.owner = sc2t;
+ check a2f.referenced = dc2t;
+ check p2s.schema = s;
+ --sc2t.table = st;
+ --dc2t.table = dt;
-- sc2t := st.ClassToTable;
-- dc2t := dt.ClassToTable;
- check st.schema = s;
- -- rk.owner = dt;
- -- rk.kind = 'primary';
- ) {}
+ check st.schema = s;
+ -- rk.owner = dt;
+ -- rk.kind = 'primary';
new:rdbms fk:ForeignKey;
new:rdbms fc:Column;
set sc2t.owner := p2s;
@@ -370,29 +352,27 @@ map associationToForeignKeyMR in ManualUML2RDBMS {
}
map associationToForeignKeyMR_1 in ManualUML2RDBMS {
- check middle () {}
- enforce rdbms (in fk:ForeignKey; in fc:Column; in dt:Table; in rk:Key;) {}
+ enforce rdbms(in:rdbms fk:ForeignKey; in:rdbms fc:Column; in:rdbms dt:Table; in:rdbms rk:Key;) {}
set fk.refersTo := rk;
set fc.foreignKeys := OrderedSet(ForeignKey){fk};
set fc.type := rk.column->first().type;
}
map associationToForeignKeyMR_2 in ManualUML2RDBMS {
- check middle (in a2f_1:AssociationToForeignKey;) {}
- enforce rdbms (in fk_1:ForeignKey; in fc_1:Column;) {}
+ check middle(in:middle a2f_1:AssociationToForeignKey;) {}
+ enforce rdbms(in:rdbms fk_1:ForeignKey; in:rdbms fc_1:Column;) {}
set a2f_1.foreignKey := fk_1;
set a2f_1.column := fc_1;
}
map classPrimitiveAttributesLM in ManualUML2RDBMS {
- check uml (in c:Class; in a:Attribute; invar t:PrimitiveDataType := a.type;) {}
- enforce middle (in fao:ClassToTable; invar p2n:PrimitiveToName := t.PrimitiveToName;) {}
- where (
- check a.owner = c;
- --getAllAttributes(c)->includes(a);
- check fao.umlClass = c;
-
- ) {}
+ check uml(in:uml c:Class; in:uml a:Attribute;) {}
+ enforce middle(in:middle fao:ClassToTable;) {}
+ check t:PrimitiveDataType := a.type;
+ check p2n:PrimitiveToName := t.PrimitiveToName;
+ check a.owner = c;
+ --getAllAttributes(c)->includes(a);
+ check fao.umlClass = c;
new:middle atc:AttributeToColumn;
set atc._'attribute' := a;
set atc.owner := fao;
@@ -403,13 +383,12 @@ map classPrimitiveAttributesLM in ManualUML2RDBMS {
}
map classComplexAttributesLM in ManualUML2RDBMS {
- check uml (in c:Class; in a:Attribute; invar t:Class := a.type;) {}
- enforce middle (in fao:ClassToTable;) {}
- where (
- check a.owner = c;
- --getAllAttributes(c)->includes(a);
- check fao.umlClass=c;
- ) {}
+ check uml(in:uml c:Class; in:uml a:Attribute;) {}
+ enforce middle(in:middle fao:ClassToTable;) {}
+ check t:Class := a.type;
+ check a.owner = c;
+ --getAllAttributes(c)->includes(a);
+ check fao.umlClass=c;
new:middle fa:NonLeafAttribute;
set fa._'attribute' := a;
set fa.owner := fao;
@@ -419,13 +398,10 @@ map classComplexAttributesLM in ManualUML2RDBMS {
}
map complexAttributePrimitiveAttributesLM in ManualUML2RDBMS {
- check uml (in c:Class; in ca:Attribute;) {
- }
- enforce middle (invar fao:NonLeafAttribute := ca.FromAttribute;) {}
- where (
- check ca.type = c;
- -- getAllAttributes(c)->includes(a);
- ) {}
+ check uml(in:uml c:Class; in:uml ca:Attribute;) {}
+ check fao:NonLeafAttribute := ca.FromAttribute;
+ check ca.type = c;
+ -- getAllAttributes(c)->includes(a);
for anAttribute in c.attributes {
call complexAttributePrimitiveAttributesLM_1 {
c_1 := c;
@@ -437,12 +413,10 @@ map complexAttributePrimitiveAttributesLM in ManualUML2RDBMS {
}
map complexAttributePrimitiveAttributesLM_1 in ManualUML2RDBMS {
- check uml (in c_1:Class; in a_1:Attribute; in ca_1:Attribute; invar t_1:PrimitiveDataType := a_1.type;) {
- }
- enforce middle (in fao_1:NonLeafAttribute; invar p2n_1:PrimitiveToName := t_1.PrimitiveToName;) {}
- where (
- --getAllAttributes(c)->includes(a);
- ) {}
+ check uml(in:uml c_1:Class; in:uml a_1:Attribute; in:uml ca_1:Attribute;) {}
+ enforce middle(in:middle fao_1:NonLeafAttribute;) {}
+ check t_1:PrimitiveDataType := a_1.type;
+ check p2n_1:PrimitiveToName := t_1.PrimitiveToName;
new:middle fa:AttributeToColumn;
set fa.owner := fao_1;
set fa.leafs := Set(AttributeToColumn) {fa};
@@ -453,13 +427,10 @@ map complexAttributePrimitiveAttributesLM_1 in ManualUML2RDBMS {
}
map complexAttributeComplexAttributesLM in ManualUML2RDBMS {
- check uml (in c:Class; in ca:Attribute;) {
- }
- enforce middle (invar fao:NonLeafAttribute := ca.FromAttribute;) {}
- where (
- check ca.type = c;
- --getAllAttributes(c)->includes(a);
- ) {}
+ check uml(in:uml c:Class; in:uml ca:Attribute;) {}
+ check fao:NonLeafAttribute := ca.FromAttribute;
+ check ca.type = c;
+ --getAllAttributes(c)->includes(a);
for anAttribute in c.attributes {
call complexAttributeComplexAttributesLM_1 {
ca_1 := ca;
@@ -471,13 +442,11 @@ map complexAttributeComplexAttributesLM in ManualUML2RDBMS {
}
map complexAttributeComplexAttributesLM_1 in ManualUML2RDBMS {
- check uml (in c_1:Class; in ca_1:Attribute; in a_1:Attribute; invar t_1:Class := a_1.type;) {
- }
- enforce middle (in fao_1:NonLeafAttribute;) {}
- where (
- check a_1.owner = c_1;
- --getAllAttributes(c)->includes(a);
- ) {}
+ check uml(in:uml c_1:Class; in:uml ca_1:Attribute; in:uml a_1:Attribute;) {}
+ enforce middle(in:middle fao_1:NonLeafAttribute;) {}
+ check t_1:Class := a_1.type;
+ check a_1.owner = c_1;
+ --getAllAttributes(c)->includes(a);
new:middle fa:NonLeafAttribute;
set fa.owner := fao_1;
set fa.leafs := fao_1.fromAttributes.leafs->asSet();
@@ -489,13 +458,13 @@ map complexAttributeComplexAttributesLM_1 in ManualUML2RDBMS {
map attributeColumnsMR in ManualUML2RDBMS {
- check middle (in c2t:ClassToTable; in a2c:AttributeToColumn; invar p2n:PrimitiveToName := a2c.type;) {}
- enforce rdbms (in t:Table; invar ct:String := p2n.typeName;) {}
- where (
- -- c2t.fromAttributes.leafs->includes(a2c); -- need to go deeper in the recursion
- -- a2c.owner = c2t; NOT ALL a2c are owned by c2t (complex attributes)
- check c2t.table = t;
- ) {}
+ check middle(in:middle c2t:ClassToTable; in:middle a2c:AttributeToColumn;) {}
+ enforce rdbms(in:rdbms t:Table;) {}
+ check p2n:PrimitiveToName := a2c.type;
+ check ct:String := p2n.typeName;
+ -- c2t.fromAttributes.leafs->includes(a2c); -- need to go deeper in the recursion
+ -- a2c.owner = c2t; NOT ALL a2c are owned by c2t (complex attributes)
+ check c2t.table = t;
new:rdbms c:Column;
set c.owner := t;
call attributeColumnsMR_1 {
@@ -515,17 +484,15 @@ map attributeColumnsMR in ManualUML2RDBMS {
}
map attributeColumnsMR_1 in ManualUML2RDBMS {
- check middle (in a2c_1:AttributeToColumn;) {}
- enforce rdbms (in c_1:Column;) {}
+ check middle(in:middle a2c_1:AttributeToColumn;) {}
+ enforce rdbms(in:rdbms c_1:Column;) {}
set a2c_1.column := c_1;
}
map attributeColumnsMR_2 in ManualUML2RDBMS {
- check middle (in p2n_2:PrimitiveToName; in a2c_2:AttributeToColumn;) {}
- enforce rdbms (in c_2:Column; in ct_2:String;) {}
- where (
- check a2c_2.type = p2n_2;
- ) {}
+ check middle(in:middle p2n_2:PrimitiveToName; in:middle a2c_2:AttributeToColumn;) {}
+ enforce rdbms(in:rdbms c_2:Column; in:rdbms ct_2:String;) {}
+ check a2c_2.type = p2n_2;
set c_2.type := ct_2;
call attributeColumnsMR_2_1 {
p2n_2_1 := p2n_2;
@@ -534,14 +501,14 @@ map attributeColumnsMR_2 in ManualUML2RDBMS {
}
map attributeColumnsMR_2_1 in ManualUML2RDBMS {
- check middle (in p2n_2_1:PrimitiveToName;) {}
- enforce rdbms (in ct_2_1:String;) {}
+ check middle(in:middle p2n_2_1:PrimitiveToName;) {}
+ enforce rdbms(in:rdbms ct_2_1:String;) {}
set p2n_2_1.typeName := ct_2_1;
}
map attributeColumnsMR_3 in ManualUML2RDBMS {
- check middle (in a2c_3:AttributeToColumn;) {}
- enforce rdbms (in c_3:Column;) { }
+ check middle(in:middle a2c_3:AttributeToColumn;) {}
+ enforce rdbms(in:rdbms c_3:Column;) {}
set c_3.name := a2c_3.name;
set c_3.kind := a2c_3.kind;
}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiInterpreterTests.java b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiInterpreterTests.java
index 8eab30e06..3e2e658a2 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiInterpreterTests.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/QVTiInterpreterTests.java
@@ -444,7 +444,7 @@ public class QVTiInterpreterTests extends LoadTestCase
public void testClassesCS2AS_bug456900() throws Exception {
MyQVT myQVT = createQVT();
QVTiEnvironmentFactory environmentFactory = myQVT.getEnvironmentFactory();
- environmentFactory.setEvaluationTracingEnabled(true);
+ // environmentFactory.setEvaluationTracingEnabled(true);
MyQvtiExecutor testEvaluator = new MyQvtiExecutor(environmentFactory, "ClassesCS2AS/bug456900", "ClassesCS2AS.qvti");
testEvaluator.saveTransformation(null);
testEvaluator.loadModel("leftCS", "example_input.xmi");
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti
index 3e6189d0b..9d1b74d7f 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/SimpleUML2RDBMS/SimpleUML2RDBMS.qvti
@@ -14,7 +14,7 @@ package simpleUML2RDBMS = 'http://simpleUML2RDBMS'
map packageToSchema_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in p : Package;) {}
+ check uml(in:uml p : Package;) {}
new:middle p2s : PackageToSchema;
set p2s.umlPackage := p;
set p2s.name := p.name;
@@ -22,7 +22,7 @@ map packageToSchema_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map packageToSchema_MR in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check middle(in p2s : PackageToSchema;) {}
+ check middle(in:middle p2s : PackageToSchema;) {}
new:rdbms s : Schema;
set s.name := p2s.name;
set p2s.schema := s;
@@ -30,11 +30,11 @@ map packageToSchema_MR in simpleUML2RDBMS::SimpleUML2RDBMS
map integerToNumber_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in p : Package; in prim : PrimitiveDataType;) {}
- enforce middle(in p2s : PackageToSchema;) {}
- where (check p2s.umlPackage = p;
- check prim.namespace = p;
- check prim.name = 'Integer';) {}
+ check uml(in:uml p : Package; in:uml prim : PrimitiveDataType;) {}
+ enforce middle(in:middle p2s : PackageToSchema;) {}
+ check p2s.umlPackage = p;
+ check prim.namespace = p;
+ check prim.name = 'Integer';
new:middle p2n : IntegerToNumber;
set p2n.owner := p2s;
set p2n._'primitive' := prim;
@@ -43,32 +43,30 @@ map integerToNumber_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map integerToNumber_MR in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check middle(in p2s : PackageToSchema;
- in p2n : IntegerToNumber;) {}
- where (check p2n.owner = p2s;) {
- var sqlType : String := 'NUMBER';
- }
+ check middle(in:middle p2s : PackageToSchema;
+ in:middle p2n : IntegerToNumber;) {}
+ check p2n.owner = p2s;
+ var sqlType : String := 'NUMBER';
set p2n.typeName := sqlType;
}
map booleanToBoolean_MR in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check middle(in p2s : PackageToSchema;
- in p2n : BooleanToBoolean;) {}
- where (check p2n.owner = p2s;) {
- var sqlType : String := 'BOOLEAN';
- }
+ check middle(in:middle p2s : PackageToSchema;
+ in:middle p2n : BooleanToBoolean;) {}
+ check p2n.owner = p2s;
+ var sqlType : String := 'BOOLEAN';
set p2n.typeName := sqlType;
}
map booleanToBoolean_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in p : Package;
- in prim : PrimitiveDataType;) {}
- enforce middle(in p2s : PackageToSchema;) {}
- where (check p2s.umlPackage = p;
- check prim.namespace = p;
- check prim.name = 'Boolean';) {}
+ check uml(in:uml p : Package;
+ in:uml prim : PrimitiveDataType;) {}
+ enforce middle(in:middle p2s : PackageToSchema;) {}
+ check p2s.umlPackage = p;
+ check prim.namespace = p;
+ check prim.name = 'Boolean';
new:middle p2n : BooleanToBoolean;
set p2n._'primitive' := prim;
set p2n.name := prim.name + '2' + 'BOOLEAN';
@@ -77,23 +75,21 @@ map booleanToBoolean_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map stringToVarchar_MR in simpleUML2RDBMS::SimpleUML2RDBMS
{
- enforce rdbms() {}
- check middle(in p2s : PackageToSchema;
- in p2n : StringToVarchar;) {}
- where (check p2n.owner = p2s;) {
- var sqlType : String := 'VARCHAR';
- }
+ check middle(in:middle p2s : PackageToSchema;
+ in:middle p2n : StringToVarchar;) {}
+ check p2n.owner = p2s;
+ var sqlType : String := 'VARCHAR';
set p2n.typeName := sqlType;
}
map stringToVarchar_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in p : Package;
- in prim : PrimitiveDataType;) {}
- enforce middle(in p2s : PackageToSchema;) {}
- where (check p2s.umlPackage = p;
- check prim.namespace = p;
- check prim.name = 'String';) {}
+ check uml(in:uml p : Package;
+ in:uml prim : PrimitiveDataType;) {}
+ enforce middle(in:middle p2s : PackageToSchema;) {}
+ check p2s.umlPackage = p;
+ check prim.namespace = p;
+ check prim.name = 'String';
new:middle p2n : StringToVarchar;
set p2n.name := prim.name + '2' + 'VARCHAR';
set p2n.owner := p2s;
@@ -102,12 +98,12 @@ map stringToVarchar_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map classToTable_MR in simpleUML2RDBMS::SimpleUML2RDBMS
{
- enforce rdbms(in s : Schema;) {}
- check middle(in p2s : PackageToSchema;
- in c2t : ClassToTable;) {}
- where (check p2s.schema = s;
- check c2t.owner = p2s;) {
- var c2t_name : String[?] := c2t.name;}
+ enforce rdbms(in:rdbms s : Schema;) {}
+ check middle(in:middle p2s : PackageToSchema;
+ in:middle c2t : ClassToTable;) {}
+ check p2s.schema = s;
+ check c2t.owner = p2s;
+ var c2t_name : String[?] := c2t.name;
new:rdbms t : Table;
new:rdbms pk : Key;
new:rdbms pc : Column;
@@ -128,12 +124,12 @@ map classToTable_MR in simpleUML2RDBMS::SimpleUML2RDBMS
map classToTable_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in p : Package;
- in c : Class;) {}
- enforce middle(in p2s : PackageToSchema;) {}
- where (check p2s.umlPackage = p;
- check c.kind = 'persistent';
- check c.namespace = p;) {}
+ check uml(in:uml p : Package;
+ in:uml c : Class;) {}
+ enforce middle(in:middle p2s : PackageToSchema;) {}
+ check p2s.umlPackage = p;
+ check c.kind = 'persistent';
+ check c.namespace = p;
new:middle c2t : ClassToTable;
set c2t.owner := p2s;
set c2t.name := c.name;
@@ -142,23 +138,23 @@ map classToTable_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map associationToForeignKey_MR in simpleUML2RDBMS::SimpleUML2RDBMS
{
- enforce rdbms(in s : Schema;
- in st : Table;
- in dt : Table;
- in rk : Key;) {}
- check middle(in p2s : PackageToSchema;
- in sc2t : ClassToTable;
- in dc2t : ClassToTable;
- in a2f : AssociationToForeignKey;) {}
- where (check dc2t.table = dt;
- check sc2t.owner = p2s;
- check p2s.schema = s;
- check sc2t.table = st;
- check a2f.referenced = dc2t;
- check a2f.owner = sc2t;
- check rk.kind = 'primary';
- check rk.owner = dt;
- check st.schema = s;) {}
+ enforce rdbms(in:rdbms s : Schema;
+ in:rdbms st : Table;
+ in:rdbms dt : Table;
+ in:rdbms rk : Key;) {}
+ check middle(in:middle p2s : PackageToSchema;
+ in:middle sc2t : ClassToTable;
+ in:middle dc2t : ClassToTable;
+ in:middle a2f : AssociationToForeignKey;) {}
+ check dc2t.table = dt;
+ check sc2t.owner = p2s;
+ check p2s.schema = s;
+ check sc2t.table = st;
+ check a2f.referenced = dc2t;
+ check a2f.owner = sc2t;
+ check rk.kind = 'primary';
+ check rk.owner = dt;
+ check st.schema = s;
new:rdbms fk : ForeignKey;
new:rdbms fc : Column;
set fk.name := a2f.name;
@@ -174,22 +170,22 @@ map associationToForeignKey_MR in simpleUML2RDBMS::SimpleUML2RDBMS
map associationToForeignKey_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in p : Package;
- in sc : Class;
- in dc : Class;
- in a : Association;) {}
- enforce middle(in p2s : PackageToSchema;
- in sc2t : ClassToTable;
- in dc2t : ClassToTable;) {}
- where (check sc2t.owner = p2s;
- check dc2t.umlClass = dc;
- check sc2t.umlClass = sc;
- check p2s.umlPackage = p;
- check a.namespace = p;
- check sc.namespace = p;
- check a.source = sc;
- check a.destination = dc;) {
- var a2f_name : String := if a.destination = dc and a.source = sc
+ check uml(in:uml p : Package;
+ in:uml sc : Class;
+ in:uml dc : Class;
+ in:uml a : Association;) {}
+ enforce middle(in:middle p2s : PackageToSchema;
+ in:middle sc2t : ClassToTable;
+ in:middle dc2t : ClassToTable;) {}
+ check sc2t.owner = p2s;
+ check dc2t.umlClass = dc;
+ check sc2t.umlClass = sc;
+ check p2s.umlPackage = p;
+ check a.namespace = p;
+ check sc.namespace = p;
+ check a.source = sc;
+ check a.destination = dc;
+ var a2f_name : String := if a.destination = dc and a.source = sc
then a.name
else if a.destination <> dc and a.source = sc
then dc.name + '_' + a.name
@@ -199,7 +195,6 @@ map associationToForeignKey_LM in simpleUML2RDBMS::SimpleUML2RDBMS
endif
endif
endif;
- }
new:middle a2f : AssociationToForeignKey;
set a2f.association := a;
set a2f.referenced := dc2t;
@@ -213,15 +208,15 @@ map associationToForeignKey_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map classPrimitiveAttributes_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in t : PrimitiveDataType;
- in c : Class;
- in a : Attribute;) {}
- enforce middle(in fao : ClassToTable;
- in p2n : PrimitiveToName;) {}
- where (check fao.umlClass = c;
- check p2n._'primitive' = t;
- check a.owner = c;
- check a.type = t;) {}
+ check uml(in:uml t : PrimitiveDataType;
+ in:uml c : Class;
+ in:uml a : Attribute;) {}
+ enforce middle(in:middle fao : ClassToTable;
+ in:middle p2n : PrimitiveToName;) {}
+ check fao.umlClass = c;
+ check p2n._'primitive' = t;
+ check a.owner = c;
+ check a.type = t;
new:middle fa : AttributeToColumn;
set fa.owner := fao;
set fa.type := p2n;
@@ -236,13 +231,13 @@ map classPrimitiveAttributes_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map classComplexAttributes_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in t : Class;
- in c : Class;
- in a : Attribute;) {}
- enforce middle(in fao : ClassToTable;) {}
- where (check fao.umlClass = c;
- check a.owner = c;
- check a.type = t;) {}
+ check uml(in:uml t : Class;
+ in:uml c : Class;
+ in:uml a : Attribute;) {}
+ enforce middle(in:middle fao : ClassToTable;) {}
+ check fao.umlClass = c;
+ check a.owner = c;
+ check a.type = t;
new:middle fa : NonLeafAttribute;
set fa._'attribute' := a;
set fa.kind := a.kind;
@@ -255,18 +250,18 @@ map classComplexAttributes_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map complexAttributePrimitiveAttributes_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in ca : Attribute;
- in c : Class;
- in t : PrimitiveDataType;
- in a : Attribute;) {}
- enforce middle(in fao : NonLeafAttribute;
- in p2n : PrimitiveToName;) {}
- where (check fao._'attribute' = ca;
- check p2n._'primitive' = t;
- check a.owner = c;
- check a.type = t;
- check ca.type = c;
- check a.owner = c;) {}
+ check uml(in:uml ca : Attribute;
+ in:uml c : Class;
+ in:uml t : PrimitiveDataType;
+ in:uml a : Attribute;) {}
+ enforce middle(in:middle fao : NonLeafAttribute;
+ in:middle p2n : PrimitiveToName;) {}
+ check fao._'attribute' = ca;
+ check p2n._'primitive' = t;
+ check a.owner = c;
+ check a.type = t;
+ check ca.type = c;
+ check a.owner = c;
new:middle fa : AttributeToColumn;
set fa.owner := fao;
set fa._'attribute' := a;
@@ -281,16 +276,16 @@ map complexAttributePrimitiveAttributes_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map complexAttributeComplexAttributes_LM in simpleUML2RDBMS::SimpleUML2RDBMS
{
- check uml(in ca : Attribute;
- in c : Class;
- in t : Class;
- in a : Attribute;) {}
- enforce middle(in fao : NonLeafAttribute;) {}
- where (check fao._'attribute' = ca;
- check a.owner = c;
- check a.owner = c;
- check ca.type = c;
- check a.type = t;) {}
+ check uml(in:uml ca : Attribute;
+ in:uml c : Class;
+ in:uml t : Class;
+ in:uml a : Attribute;) {}
+ enforce middle(in:middle fao : NonLeafAttribute;) {}
+ check fao._'attribute' = ca;
+ check a.owner = c;
+ check a.owner = c;
+ check ca.type = c;
+ check a.type = t;
new:middle fa : NonLeafAttribute;
set fa.owner := fao;
set fa.kind := a.kind;
@@ -304,16 +299,16 @@ map complexAttributeComplexAttributes_LM in simpleUML2RDBMS::SimpleUML2RDBMS
map attributeColumns_MR in simpleUML2RDBMS::SimpleUML2RDBMS
{
- enforce rdbms(in t : Table;
- in ct : String;) {}
- check middle(in c2t : ClassToTable;
- in p2n : PrimitiveToName;
- in a2c : AttributeToColumn;) {}
- where (check c2t.table = t;
- check p2n.typeName = ct;
- check a2c.owner = c2t;
- check c2t.fromAttributes.leafs->includes(a2c);
- check a2c.type = p2n;) {}
+ enforce rdbms(in:rdbms t : Table;
+ in:rdbms ct : String;) {}
+ check middle(in:middle c2t : ClassToTable;
+ in:middle p2n : PrimitiveToName;
+ in:middle a2c : AttributeToColumn;) {}
+ check c2t.table = t;
+ check p2n.typeName = ct;
+ check a2c.owner = c2t;
+ check c2t.fromAttributes.leafs->includes(a2c);
+ check a2c.type = p2n;
new:rdbms c : Column;
set c.name := a2c.name;
set c.kind := a2c.kind;
@@ -324,7 +319,6 @@ map attributeColumns_MR in simpleUML2RDBMS::SimpleUML2RDBMS
map __root__ in simpleUML2RDBMS::SimpleUML2RDBMS
{
- where () {}
for p : simpleuml::Package in uml.objectsOfKind(Package) {
call packageToSchema_LM {
p := p;
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti
index 6452edbb1..7572ab835 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti
@@ -28,41 +28,35 @@ map __root__ in Tree2TallTree {
}
map Node2MiddleNode in Tree2TallTree {
- check tree(in node : Node;) {}
+ check tree(in:tree node : Node;) {}
new:tree2talltree node2tallNode : Node2TallNode;
set node2tallNode.node := node;
set node2tallNode.name := node.name;
}
map Edge2MiddleEdge in Tree2TallTree {
- check tree(in node : Node;) {}
- enforce tree2talltree {
- enforce Node2TallNode::parent
- } (in node2tallNode : Node2TallNode;) {
+ check tree(in:tree node : Node;) {}
+ enforce tree2talltree(in:tree2talltree node2tallNode : Node2TallNode;) {
-- realize node2tallNode : Node2TallNode
}
- where(check node.parent <> null;) {}
- set node2tallNode.parent := node.parent.Node2TallNode;
+ check node.parent <> null;
+ emit node2tallNode.parent := node.parent.Node2TallNode;
-- node2tallNode.name := node.name;
}
map MiddleNode2TallNode in Tree2TallTree {
check tree2talltree {
check Node2TallNode::tallNode, Node2TallNode::children
- enforce Node2TallNode::tallNode
- } (in node2tallNode : Node2TallNode;) {}
+ } (in:tree2talltree node2tallNode : Node2TallNode;) {}
enforce talltree {
check TallNode::height
- enforce TallNode::height
} () {}
- where () {
- var tallNode_name : String := node2tallNode.name;
- var tallNode_children : Set(TallNode) := node2tallNode.children?.tallNode->asSet();
- var tallNode_height : Integer := if node2tallNode.children->notEmpty() then node2tallNode.children.tallNode.height->max() + 1 else 0 endif;
- }
+ var tallNode_name : String := node2tallNode.name;
+ var tallNode_children : Set(TallNode) := node2tallNode.children?.tallNode->asSet();
+ var tallNode_height : Integer := if node2tallNode.children->notEmpty() then node2tallNode.children.tallNode.height->max() + 1 else 0 endif;
new:talltree tallNode : TallNode;
- set node2tallNode.tallNode := tallNode;
+ emit node2tallNode.tallNode := tallNode;
set tallNode.name := tallNode_name;
set tallNode.children := tallNode_children;
- set tallNode.height := tallNode_height;
+ emit tallNode.height := tallNode_height;
}
diff --git a/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java b/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java
index b6540e530..87f99f627 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java
@@ -106,54 +106,48 @@ public class Forward2Reverse extends AbstractTransformer
/**
*
* map __root__ in Forward2Reverse {
- * where ( |)
- * {_'\u00ABDoublyLinkedList\u00BB' : Set(doublylinkedlist::DoublyLinkedList) = forward.objectsOfKind(doublylinkedlist::DoublyLinkedList)
+ *
+ * var _'\u00ABDoublyLinkedList\u00BB' : Set(doublylinkedlist::DoublyLinkedList) := forward.objectsOfKind(doublylinkedlist::DoublyLinkedList)
* ;
- * ji_DoublyLinkedList : Set(doublylinkedlist::DoublyLinkedList)[*|1] = _'\u00ABDoublyLinkedList\u00BB';
- * _'\u00ABElement\u00BB' : Set(doublylinkedlist::Element) = forward.objectsOfKind(doublylinkedlist::Element)
+ * ::ji_DoublyLinkedList : Set(doublylinkedlist::DoublyLinkedList)[*|1]var _'\u00ABElement\u00BB' : Set(doublylinkedlist::Element) := forward.objectsOfKind(doublylinkedlist::Element)
* ;
- * ji_Element : Set(doublylinkedlist::Element)[*|1] = _'\u00ABElement\u00BB';
- * jm_Telement2element : Set(PForward2Reverse::Telement2element)[*|1] = Set{};
- * jm_Tlist2list : Set(PForward2Reverse::Tlist2list)[*|1] = Set{};
- * |}
- * }for loop0 : doublylinkedlist::DoublyLinkedList in ji_DoublyLinkedList {
+ * ::ji_Element : Set(doublylinkedlist::Element)[*|1]::jm_Telement2element : Set(PForward2Reverse::Telement2element)[*|1]::jm_Tlist2list : Set(PForward2Reverse::Tlist2list)[*|1]for loop0 : doublylinkedlist::DoublyLinkedList[1] in ji_DoublyLinkedList {
* call _'m_TemptyList2emptyList_DoublyLinkedList.r0' {
* forwardList := loop0;
* }}
- * for loop0 : doublylinkedlist::Element in ji_Element {
+ * for loop0 : doublylinkedlist::Element[1] in ji_Element {
* call _'m_Telement2element_Element.p0' {
* forwardElement := loop0;
* jm_Telement2element := jm_Telement2element;
* }}
- * for loop0 : doublylinkedlist::DoublyLinkedList in ji_DoublyLinkedList {
+ * for loop0 : doublylinkedlist::DoublyLinkedList[1] in ji_DoublyLinkedList {
* call _'m_Tlist2list_DoublyLinkedList.p0' {
* forwardList := loop0;
* jm_Tlist2list := jm_Tlist2list;
* }}
- * for loop0 : PForward2Reverse::Telement2element in jm_Telement2element {
+ * for loop0 : PForward2Reverse::Telement2element[1] in jm_Telement2element {
* call _'m_Telement2element_Element.p1' {
* trace := loop0;
* }}
- * for loop0 : doublylinkedlist::Element in ji_Element {
+ * for loop0 : doublylinkedlist::Element[1] in ji_Element {
* call _'m_Telement2element_Element.p3' {
* forwardTarget := loop0;
* }}
- * for loop0 : PForward2Reverse::Tlist2list in jm_Tlist2list {
+ * for loop0 : PForward2Reverse::Tlist2list[1] in jm_Tlist2list {
* call _'m_Tlist2list_DoublyLinkedList.p1' {
* trace := loop0;
* }}
- * for loop0 : PForward2Reverse::Telement2element in jm_Telement2element {
+ * for loop0 : PForward2Reverse::Telement2element[1] in jm_Telement2element {
* call _'m_Telement2element_Element.p2' {
* trace := loop0;
* }}
- * for loop0 : PForward2Reverse::Tlist2list in jm_Tlist2list {
+ * for loop0 : PForward2Reverse::Tlist2list[1] in jm_Tlist2list {
* call _'m_Tlist2list_DoublyLinkedList.p2' {
* trace := loop0;
* }}
*/
protected boolean MAP___root__() {
try {
- // predicates and unrealized variables
final /*@NonInvalid*/ org.eclipse.ocl.pivot.ids.@org.eclipse.jdt.annotation.NonNull IdResolver idResolver = executor.getIdResolver();
final /*@NonInvalid*/ org.eclipse.ocl.pivot.@org.eclipse.jdt.annotation.NonNull Class TYP_doublylinkedlist_c_c_DoublyLinkedList_0 = idResolver.getClass(CLSSid_DoublyLinkedList, null);
final /*@NonInvalid*/ org.eclipse.ocl.pivot.values.@org.eclipse.jdt.annotation.NonNull SetValue objectsOfKind = ModelObjectsOfKindOperation.INSTANCE.evaluate(executor, SET_CLSSid_DoublyLinkedList, models[1/*forward*/], TYP_doublylinkedlist_c_c_DoublyLinkedList_0);
@@ -204,24 +198,17 @@ public class Forward2Reverse extends AbstractTransformer
/**
*
- * map _'m_Telement2element_Element.p0' in Forward2Reverse {forward (forwardElement : doublylinkedlist::Element[1];
- * |)
- * {forwardList : doublylinkedlist::DoublyLinkedList[1];
- * forwardTarget : doublylinkedlist::Element[1];
- * |}
- * middle ( |)
- * { |}
- * where (jm_Telement2element : Set(PForward2Reverse::Telement2element)[*|1];
- * |)
- * {elementName : String[1];
- * |
- * elementName := forwardElement.name;
- * forwardList := forwardElement.list;
- * forwardTarget := forwardElement.target;
+ * map _'m_Telement2element_Element.p0' in Forward2Reverse {
+ * inout ::jm_Telement2element : Set(PForward2Reverse::Telement2element)[*|1];
+ * forward{
+ * in forwardElement : doublylinkedlist::Element[1];
* }
- * }new@middle trace : PForward2Reverse::Telement2element[1];
- * set trace.elementName := elementName;
+ * var elementName : String[1] := forwardElement.name;
+ * var forwardList : doublylinkedlist::DoublyLinkedList[1] := forwardElement.list;
+ * var forwardTarget : doublylinkedlist::Element[1] := forwardElement.target;
+ * new:middle trace : PForward2Reverse::Telement2element[1];
* set trace.forwardElement := forwardElement;
+ * set trace.elementName := elementName;
* set trace.forwardList := forwardList;
* set trace.forwardTarget := forwardTarget;
* add jm_Telement2element += trace;
@@ -229,7 +216,6 @@ public class Forward2Reverse extends AbstractTransformer
*/
protected boolean MAP_m_Telement2element_Element_46p0(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull Element forwardElement, final SetValue.@NonNull Accumulator jm_Telement2element) {
try {
- // predicates and unrealized variables
@SuppressWarnings("null")
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.NonNull String name = forwardElement.getName();
@SuppressWarnings("null")
@@ -241,9 +227,9 @@ public class Forward2Reverse extends AbstractTransformer
assert trace_3 != null;
models[0/*middle*/].add(trace_3);
// mapping statements
- trace_3.setElementName(name);
OPPOSITE_OF_Telement2element_forwardElement.put(forwardElement, trace_3);
trace_3.setForwardElement(forwardElement);
+ trace_3.setElementName(name);
trace_3.setForwardList(list);
OPPOSITE_OF_Telement2element_forwardTarget.put(target, trace_3);
trace_3.setForwardTarget(target);
@@ -257,34 +243,22 @@ public class Forward2Reverse extends AbstractTransformer
/**
*
- * map _'m_Telement2element_Element.p1' in Forward2Reverse {forward ( |)
- * {forwardList : doublylinkedlist::DoublyLinkedList[1];
- * forwardTarget : doublylinkedlist::Element[1];
- * |}
- * middle (trace : PForward2Reverse::Telement2element[1];
- * |)
- * {when_Tlist2list : PForward2Reverse::Tlist2list[1];
- * when_Telement2element : PForward2Reverse::Telement2element[1];
- * |}
- * reverse ( |)
- * { |}
- * where ( |)
- * {elementName : String[1];
- * |
- * elementName := trace.elementName;
- * forwardList := trace.forwardList;
- * forwardTarget := trace.forwardTarget;
- * when_Telement2element := forwardTarget.Telement2element;
- * when_Tlist2list := forwardList.Tlist2list;
+ * map _'m_Telement2element_Element.p1' in Forward2Reverse {
+ * middle{
+ * in trace : PForward2Reverse::Telement2element[1];
* }
- * }new@reverse reverseElement : doublylinkedlist::Element[1];
- * set reverseElement.name := elementName;
+ * var elementName : String[1] := trace.elementName;
+ * var forwardList : doublylinkedlist::DoublyLinkedList[1] := trace.forwardList;
+ * var forwardTarget : doublylinkedlist::Element[1] := trace.forwardTarget;
+ * var when_Telement2element : PForward2Reverse::Telement2element[1] := forwardTarget.Telement2element;
+ * var when_Tlist2list : PForward2Reverse::Tlist2list[1] := forwardList.Tlist2list;
+ * new:reverse reverseElement : doublylinkedlist::Element[1];
* set trace.reverseElement := reverseElement;
+ * set reverseElement.name := elementName;
*
*/
protected boolean MAP_m_Telement2element_Element_46p1(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.PForward2Reverse.@org.eclipse.jdt.annotation.NonNull Telement2element trace) {
try {
- // predicates and unrealized variables
@SuppressWarnings("null")
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.NonNull String elementName = trace.getElementName();
@SuppressWarnings("null")
@@ -310,8 +284,8 @@ public class Forward2Reverse extends AbstractTransformer
assert reverseElement != null;
models[2/*reverse*/].add(reverseElement);
// mapping statements
- reverseElement.setName(elementName);
trace.setReverseElement(reverseElement);
+ reverseElement.setName(elementName);
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean m_Telement2element_Element_p1 = ValueUtil.TRUE_VALUE;
raw_when_Tlist2list = m_Telement2element_Element_p1;
}
@@ -331,31 +305,20 @@ public class Forward2Reverse extends AbstractTransformer
/**
*
- * map _'m_Telement2element_Element.p2' in Forward2Reverse {forward ( |)
- * {forwardList : doublylinkedlist::DoublyLinkedList[1];
- * |}
- * middle (trace : PForward2Reverse::Telement2element[1];
- * |)
- * {when_Tlist2list : PForward2Reverse::Tlist2list[1];
- * |}
- * reverse ( |)
- * {reverseElement : doublylinkedlist::Element[1];
- * reverseList : doublylinkedlist::DoublyLinkedList[1];
- * |}
- * where ( |)
- * { |
- * forwardList := trace.forwardList;
- * reverseElement := trace.reverseElement;
- * when_Tlist2list := forwardList.Tlist2list;
- * reverseList := when_Tlist2list.reverseList;
+ * map _'m_Telement2element_Element.p2' in Forward2Reverse {
+ * middle{
+ * in trace : PForward2Reverse::Telement2element[1];
* }
- * }set trace.reverseList := reverseList;
+ * var forwardList : doublylinkedlist::DoublyLinkedList[1] := trace.forwardList;
+ * var reverseElement : doublylinkedlist::Element[1] := trace.reverseElement;
+ * var when_Tlist2list : PForward2Reverse::Tlist2list[1] := forwardList.Tlist2list;
+ * var reverseList : doublylinkedlist::DoublyLinkedList[1] := when_Tlist2list.reverseList;
* set reverseElement.list := reverseList;
+ * set trace.reverseList := reverseList;
*
*/
protected boolean MAP_m_Telement2element_Element_46p2(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.PForward2Reverse.@org.eclipse.jdt.annotation.NonNull Telement2element trace_0) {
try {
- // predicates and unrealized variables
@SuppressWarnings("null")
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull DoublyLinkedList forwardList_1 = trace_0.getForwardList();
@SuppressWarnings("null")
@@ -370,8 +333,8 @@ public class Forward2Reverse extends AbstractTransformer
@SuppressWarnings("null")
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull DoublyLinkedList reverseList = Tlist2list.getReverseList();
// mapping statements
- trace_0.setReverseList(reverseList);
reverseElement.setList(reverseList);
+ trace_0.setReverseList(reverseList);
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean m_Telement2element_Element_p2 = ValueUtil.TRUE_VALUE;
raw_when_Tlist2list = m_Telement2element_Element_p2;
}
@@ -386,31 +349,20 @@ public class Forward2Reverse extends AbstractTransformer
/**
*
- * map _'m_Telement2element_Element.p3' in Forward2Reverse {forward (forwardTarget : doublylinkedlist::Element[1];
- * |)
- * { |}
- * middle ( |)
- * {when_Telement2element : PForward2Reverse::Telement2element[1];
- * trace : PForward2Reverse::Telement2element[1];
- * |}
- * reverse ( |)
- * {reverseSource : doublylinkedlist::Element[1];
- * reverseElement : doublylinkedlist::Element[1];
- * |}
- * where ( |)
- * { |
- * trace := forwardTarget.Telement2element;
- * when_Telement2element := forwardTarget.Telement2element;
- * reverseElement := trace.reverseElement;
- * reverseSource := when_Telement2element.reverseElement;
+ * map _'m_Telement2element_Element.p3' in Forward2Reverse {
+ * forward{
+ * in forwardTarget : doublylinkedlist::Element[1];
* }
- * }set reverseElement.source := reverseSource;
+ * var trace : PForward2Reverse::Telement2element[1] := forwardTarget.Telement2element;
+ * var when_Telement2element : PForward2Reverse::Telement2element[1] := forwardTarget.Telement2element;
+ * var reverseElement : doublylinkedlist::Element[1] := trace.reverseElement;
+ * var reverseSource : doublylinkedlist::Element[1] := when_Telement2element.reverseElement;
* set trace.reverseSource := reverseSource;
+ * set reverseElement.source := reverseSource;
*
*/
protected boolean MAP_m_Telement2element_Element_46p3(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull Element forwardTarget) {
try {
- // predicates and unrealized variables
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.PForward2Reverse.@org.eclipse.jdt.annotation.Nullable Telement2element Telement2element = OPPOSITE_OF_Telement2element_forwardTarget.get(forwardTarget);
final /*@Thrown*/ boolean symbol_0 = Telement2element != null;
/*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean raw_trace;
@@ -430,8 +382,8 @@ public class Forward2Reverse extends AbstractTransformer
@SuppressWarnings("null")
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull Element reverseElement_0 = Telement2element_0.getReverseElement();
// mapping statements
- reverseElement.setSource(reverseElement_0);
Telement2element.setReverseSource(reverseElement_0);
+ reverseElement.setSource(reverseElement_0);
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean m_Telement2element_Element_p3 = ValueUtil.TRUE_VALUE;
raw_when_Telement2element = m_Telement2element_Element_p3;
}
@@ -451,37 +403,29 @@ public class Forward2Reverse extends AbstractTransformer
/**
*
- * map _'m_TemptyList2emptyList_DoublyLinkedList.r0' in Forward2Reverse {forward (forwardList : doublylinkedlist::DoublyLinkedList[1];
- * |)
- * { |}
- * middle ( |)
- * { |}
- * reverse ( |)
- * { |}
- * where ( |
- * forwardList.headElement = null)
- * {listName : String[1];
- * |
- * listName := forwardList.name;
+ * map _'m_TemptyList2emptyList_DoublyLinkedList.r0' in Forward2Reverse {
+ * forward{
+ * in forwardList : doublylinkedlist::DoublyLinkedList[1];
* }
- * }new@middle trace : PForward2Reverse::TemptyList2emptyList[1];
- * new@reverse reverseList : doublylinkedlist::DoublyLinkedList[1];
- * set reverseList.name := listName;
- * set trace.listName := listName;
+ * var listName : String[1] := forwardList.name;
+ * check forwardList.headElement = null;
+ * new:reverse reverseList : doublylinkedlist::DoublyLinkedList[1];
+ * new:middle trace : PForward2Reverse::TemptyList2emptyList[1];
+ * set reverseList.headElement := null;
* set trace.forwardList := forwardList;
* set trace.reverseList := reverseList;
- * set reverseList.headElement := null;
+ * set reverseList.name := listName;
+ * set trace.listName := listName;
*
*/
protected boolean MAP_m_TemptyList2emptyList_DoublyLinkedList_46r0(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull DoublyLinkedList forwardList) {
try {
- // predicates and unrealized variables
+ @SuppressWarnings("null")
+ final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.NonNull String name = forwardList.getName();
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.Nullable Element headElement = forwardList.getHeadElement();
final /*@Thrown*/ boolean symbol_0 = headElement == null;
/*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean symbol_7;
if (symbol_0) {
- @SuppressWarnings("null")
- final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.NonNull String name = forwardList.getName();
// creations
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.Nullable DoublyLinkedList reverseList = doublylinkedlistFactory.eINSTANCE.createDoublyLinkedList();
assert reverseList != null;
@@ -490,11 +434,11 @@ public class Forward2Reverse extends AbstractTransformer
assert trace_3 != null;
models[0/*middle*/].add(trace_3);
// mapping statements
- reverseList.setName(name);
- trace_3.setListName(name);
+ reverseList.setHeadElement(null);
trace_3.setForwardList(forwardList);
trace_3.setReverseList(reverseList);
- reverseList.setHeadElement(null);
+ reverseList.setName(name);
+ trace_3.setListName(name);
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean m_TemptyList2emptyList_DoublyLinkedList_r0 = ValueUtil.TRUE_VALUE;
symbol_7 = m_TemptyList2emptyList_DoublyLinkedList_r0;
}
@@ -509,29 +453,22 @@ public class Forward2Reverse extends AbstractTransformer
/**
*
- * map _'m_Tlist2list_DoublyLinkedList.p0' in Forward2Reverse {forward (forwardList : doublylinkedlist::DoublyLinkedList[1];
- * |)
- * {forwardHead : doublylinkedlist::Element[1];
- * |}
- * middle ( |)
- * { |}
- * where (jm_Tlist2list : Set(PForward2Reverse::Tlist2list)[*|1];
- * |)
- * {listName : String[1];
- * |
- * forwardHead := forwardList.headElement;
- * listName := forwardList.name;
+ * map _'m_Tlist2list_DoublyLinkedList.p0' in Forward2Reverse {
+ * inout ::jm_Tlist2list : Set(PForward2Reverse::Tlist2list)[*|1];
+ * forward{
+ * in forwardList : doublylinkedlist::DoublyLinkedList[1];
* }
- * }new@middle trace : PForward2Reverse::Tlist2list[1];
+ * var forwardHead : doublylinkedlist::Element[1] := forwardList.headElement;
+ * var listName : String[1] := forwardList.name;
+ * new:middle trace : PForward2Reverse::Tlist2list[1];
+ * set trace.forwardList := forwardList;
* set trace.listName := listName;
* set trace.forwardHead := forwardHead;
- * set trace.forwardList := forwardList;
* add jm_Tlist2list += trace;
*
*/
protected boolean MAP_m_Tlist2list_DoublyLinkedList_46p0(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull DoublyLinkedList forwardList_0, final SetValue.@NonNull Accumulator jm_Tlist2list) {
try {
- // predicates and unrealized variables
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.Nullable Element headElement = forwardList_0.getHeadElement();
final /*@Thrown*/ boolean symbol_0 = headElement != null;
/*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean raw_forwardHead;
@@ -546,10 +483,10 @@ public class Forward2Reverse extends AbstractTransformer
assert trace_3 != null;
models[0/*middle*/].add(trace_3);
// mapping statements
- trace_3.setListName(name);
- trace_3.setForwardHead(headElement);
OPPOSITE_OF_Tlist2list_forwardList.put(forwardList_0, trace_3);
trace_3.setForwardList(forwardList_0);
+ trace_3.setListName(name);
+ trace_3.setForwardHead(headElement);
jm_Tlist2list.add(trace_3);
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean m_Tlist2list_DoublyLinkedList_p0 = ValueUtil.TRUE_VALUE;
raw_forwardHead = m_Tlist2list_DoublyLinkedList_p0;
@@ -565,30 +502,20 @@ public class Forward2Reverse extends AbstractTransformer
/**
*
- * map _'m_Tlist2list_DoublyLinkedList.p1' in Forward2Reverse {forward ( |)
- * {forwardHead : doublylinkedlist::Element[1];
- * |}
- * middle (trace : PForward2Reverse::Tlist2list[1];
- * |)
- * {when_Telement2element : PForward2Reverse::Telement2element[1];
- * |}
- * reverse ( |)
- * { |}
- * where ( |)
- * {listName : String[1];
- * |
- * forwardHead := trace.forwardHead;
- * listName := trace.listName;
- * when_Telement2element := forwardHead.Telement2element;
+ * map _'m_Tlist2list_DoublyLinkedList.p1' in Forward2Reverse {
+ * middle{
+ * in trace : PForward2Reverse::Tlist2list[1];
* }
- * }new@reverse reverseList : doublylinkedlist::DoublyLinkedList[1];
- * set reverseList.name := listName;
+ * var forwardHead : doublylinkedlist::Element[1] := trace.forwardHead;
+ * var listName : String[1] := trace.listName;
+ * var when_Telement2element : PForward2Reverse::Telement2element[1] := forwardHead.Telement2element;
+ * new:reverse reverseList : doublylinkedlist::DoublyLinkedList[1];
* set trace.reverseList := reverseList;
+ * set reverseList.name := listName;
*
*/
protected boolean MAP_m_Tlist2list_DoublyLinkedList_46p1(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.PForward2Reverse.@org.eclipse.jdt.annotation.NonNull Tlist2list trace_1) {
try {
- // predicates and unrealized variables
@SuppressWarnings("null")
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull Element forwardHead = trace_1.getForwardHead();
@SuppressWarnings("null")
@@ -605,8 +532,8 @@ public class Forward2Reverse extends AbstractTransformer
assert reverseList != null;
models[2/*reverse*/].add(reverseList);
// mapping statements
- reverseList.setName(listName);
trace_1.setReverseList(reverseList);
+ reverseList.setName(listName);
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean m_Tlist2list_DoublyLinkedList_p1 = ValueUtil.TRUE_VALUE;
raw_when_Telement2element = m_Tlist2list_DoublyLinkedList_p1;
}
@@ -621,31 +548,20 @@ public class Forward2Reverse extends AbstractTransformer
/**
*
- * map _'m_Tlist2list_DoublyLinkedList.p2' in Forward2Reverse {forward ( |)
- * {forwardHead : doublylinkedlist::Element[1];
- * |}
- * middle (trace : PForward2Reverse::Tlist2list[1];
- * |)
- * {when_Telement2element : PForward2Reverse::Telement2element[1];
- * |}
- * reverse ( |)
- * {reverseList : doublylinkedlist::DoublyLinkedList[1];
- * reverseHead : doublylinkedlist::Element[1];
- * |}
- * where ( |)
- * { |
- * forwardHead := trace.forwardHead;
- * reverseList := trace.reverseList;
- * when_Telement2element := forwardHead.Telement2element;
- * reverseHead := when_Telement2element.reverseElement;
+ * map _'m_Tlist2list_DoublyLinkedList.p2' in Forward2Reverse {
+ * middle{
+ * in trace : PForward2Reverse::Tlist2list[1];
* }
- * }set trace.reverseHead := reverseHead;
+ * var forwardHead : doublylinkedlist::Element[1] := trace.forwardHead;
+ * var reverseList : doublylinkedlist::DoublyLinkedList[1] := trace.reverseList;
+ * var when_Telement2element : PForward2Reverse::Telement2element[1] := forwardHead.Telement2element;
+ * var reverseHead : doublylinkedlist::Element[1] := when_Telement2element.reverseElement;
+ * set trace.reverseHead := reverseHead;
* set reverseList.headElement := reverseHead;
*
*/
protected boolean MAP_m_Tlist2list_DoublyLinkedList_46p2(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.PForward2Reverse.@org.eclipse.jdt.annotation.NonNull Tlist2list trace_2) {
try {
- // predicates and unrealized variables
@SuppressWarnings("null")
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull Element forwardHead = trace_2.getForwardHead();
@SuppressWarnings("null")

Back to the top