Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-09-08 10:19:58 +0000
committerEd Willink2016-09-19 11:17:32 +0000
commit3f8f5bb4b01533288deb574ec97a7c2b4c4a5903 (patch)
treef3c255c4e696ff8623423cbc37ba3c1ef83270e2
parent0c1f04f21a30b27fd707daaa25e0555a37d0f785 (diff)
downloadorg.eclipse.qvtd-3f8f5bb4b01533288deb574ec97a7c2b4c4a5903.tar.gz
org.eclipse.qvtd-3f8f5bb4b01533288deb574ec97a7c2b4c4a5903.tar.xz
org.eclipse.qvtd-3f8f5bb4b01533288deb574ec97a7c2b4c4a5903.zip
[500369] Support StatementCS, Statement
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java30
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java5
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java6
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java13
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java5
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java32
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java12
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/QVTimperativeDomainUsageAnalysis.java21
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/MappingAttribution.java4
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/BasicQVTiExecutor.java9
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractTracingEvaluationVisitor.java17
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java39
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTuneUpVisitor.java15
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java30
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java12
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeUtil.java54
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/labeling/QVTimperativeLabelProvider.java7
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/outline/QVTimperativeOutlineTreeProvider.java5
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/emf-gen/org/eclipse/qvtd/xtext/qvtimperativecs/MappingSequenceCS.java48
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/emf-gen/org/eclipse/qvtd/xtext/qvtimperativecs/impl/MappingSequenceCSImpl.java167
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java63
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java16
22 files changed, 182 insertions, 428 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 81f71f939..fca2e1dd9 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
@@ -116,12 +116,12 @@ 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.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NavigationAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.OppositePropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
+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.analysis.QVTimperativeDomainUsageAnalysis;
@@ -830,10 +830,14 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
PredicateTreeBuilder bodyBuilder = new PredicateTreeBuilder(pMapping, cgMapping);
bodyBuilder.doGuards();
bodyBuilder.doBottoms(cgMappingExp);
- MappingStatement mappingStatements = pMapping.getMappingStatement();
- if (mappingStatements != null) {
- cgMappingExp.setBody(doVisit(CGValuedElement.class, mappingStatements));
+
+ CGSequence cgSequence = QVTiCGModelFactory.eINSTANCE.createCGSequence();
+ List<CGValuedElement> cgMappingStatements = cgSequence.getStatements();
+ for (Statement asStatement : pMapping.getOwnedStatements()) {
+ CGValuedElement cgMappingStatement = doVisit(CGValuedElement.class, asStatement);
+ cgMappingStatements.add(cgMappingStatement);
}
+ cgMappingExp.setBody(cgSequence);
List<CGGuardVariable> cgFreeVariables = cgMapping.getFreeVariables();
List<CGGuardVariable> sortedVariables = new ArrayList<CGGuardVariable>(cgFreeVariables);
Collections.sort(sortedVariables, CGVariableComparator.INSTANCE);
@@ -893,24 +897,19 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
CollectionType collectionType = standardLibrary.getCollectionType();
Operation forAllIteration = NameUtil.getNameable(collectionType.getOwnedOperations(), "forAll");
cgMappingLoop.setReferredIteration((Iteration) forAllIteration);
- cgMappingLoop.setBody(doVisit(CGValuedElement.class, asMappingLoop.getOwnedBody()));
- return cgMappingLoop;
- }
-
- @Override
- public @Nullable CGNamedElement visitMappingSequence(@NonNull MappingSequence asMappingSequence) {
CGSequence cgSequence = QVTiCGModelFactory.eINSTANCE.createCGSequence();
List<CGValuedElement> cgMappingStatements = cgSequence.getStatements();
- for (MappingStatement asMappingStatement : asMappingSequence.getMappingStatements()) {
+ for (MappingStatement asMappingStatement : asMappingLoop.getOwnedMappingStatements()) {
CGValuedElement cgMappingStatement = doVisit(CGValuedElement.class, asMappingStatement);
cgMappingStatements.add(cgMappingStatement);
}
- return cgSequence;
+ cgMappingLoop.setBody(cgSequence);
+ return cgMappingLoop;
}
@Override
public @Nullable CGNamedElement visitMappingStatement(@NonNull MappingStatement object) {
- return visiting(object);
+ return visitStatement(object);
}
@Override
@@ -1056,6 +1055,11 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
+ public @Nullable CGNamedElement visitStatement(@NonNull Statement object) {
+ return visiting(object);
+ }
+
+ @Override
public @Nullable CGNamedElement visitTransformation(@NonNull Transformation asTransformation) {
/*QVTiTransformationAnalysis transformationAnalysis =*/ analyzer.getCodeGenerator().getTransformationAnalysis(asTransformation);
CGTransformation cgTransformation = QVTiCGModelFactory.eINSTANCE.createCGTransformation();
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 eb2a6859a..4149b4f2f 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
@@ -38,7 +38,7 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
connection2variable = new HashMap<@NonNull NodeConnection, @NonNull Variable>();
}
- protected @NonNull MappingStatement createCall(@Nullable MappingStatement mappingStatement, @NonNull Region calledRegion, @Nullable Map<@NonNull Variable, @NonNull OCLExpression> guardVariable2expression) {
+ protected @NonNull MappingStatement createCall(@NonNull Region calledRegion, @Nullable Map<@NonNull Variable, @NonNull OCLExpression> guardVariable2expression) {
// Iterable<Connection> connectionRegions = getConnectionRegions(calledRegion);
// assert !calledRegion.isConnectionRegion();
AbstractRegion2Mapping calledRegion2Mapping = visitor.getRegion2Mapping(calledRegion);
@@ -112,8 +112,7 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
@NonNull OCLExpression loopSource = loopEntry.getValue();
mappingCallStatement = QVTimperativeUtil.createMappingLoop(loopSource, loopVariable, mappingCallStatement);
}
- mappingStatement = QVTimperativeUtil.addMappingStatement(mappingStatement, mappingCallStatement);
- return mappingStatement;
+ return mappingCallStatement;
}
/* protected @NonNull MappingStatement createCalls(@Nullable MappingStatement mappingStatement, @NonNull Region calledRegion) {
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 26d9d26db..6e3a8bd75 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
@@ -916,7 +916,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
}
private void createMappingStatements(@NonNull Map<@NonNull Region, @NonNull Map<@NonNull Node, @NonNull Node>> calls) {
- MappingStatement mappingStatement = null;
+ List<@NonNull MappingStatement> mappingStatements = new ArrayList<>();
Map<@NonNull Variable, @NonNull OCLExpression> loopVariables = null;
for (Map.Entry<@NonNull Region, @NonNull Map<@NonNull Node, @NonNull Node>> entry : calls.entrySet()) {
@NonNull Region calledRegion = entry.getKey();
@@ -968,9 +968,9 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
mappingCallStatement = QVTimperativeUtil.createMappingLoop(loopSource, loopVariable, mappingCallStatement);
}
}
- mappingStatement = QVTimperativeUtil.addMappingStatement(mappingStatement, mappingCallStatement);
+ mappingStatements.add(mappingCallStatement);
}
- mapping.setMappingStatement(mappingStatement);
+ mapping.getOwnedStatements().addAll(mappingStatements);
}
/**
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 f3763e25d..47cf0a958 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.qvtd.compiler.internal.qvts2qvti;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -271,7 +272,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
@Override
public void createStatements() {
- MappingStatement mappingStatement = null;
+ 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>();
@@ -294,7 +295,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
// }
}
}
- mappingStatement = createCall(mappingStatement, callableRegion, guardVariable2expression);
+ mappingStatements.add(createCall(callableRegion, guardVariable2expression));
}
//
// Create connection assignments to pass local creations to the accumulated result.
@@ -318,7 +319,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
ConnectionStatement connectionStatement1 = QVTimperativeFactory.eINSTANCE.createConnectionStatement();
connectionStatement1.setTargetVariable(newVariable);
connectionStatement1.setValue(excludingAllCallExp);
- mappingStatement = QVTimperativeUtil.addMappingStatement(mappingStatement, connectionStatement1);
+ mappingStatements.add(connectionStatement1);
}
else {
newVariable = localVariable;
@@ -327,7 +328,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
ConnectionStatement connectionStatement2 = QVTimperativeFactory.eINSTANCE.createConnectionStatement();
connectionStatement2.setTargetVariable(accumulatedVariable);
connectionStatement2.setValue(PivotUtil.createVariableExp(newVariable));
- mappingStatement = QVTimperativeUtil.addMappingStatement(mappingStatement, connectionStatement2);
+ mappingStatements.add(connectionStatement2);
}
}
//
@@ -343,8 +344,8 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
VariableExp localVariableExp = PivotUtil.createVariableExp(newVariable);
guardVariable2expression.put(guardVariable, localVariableExp);
}
- mappingStatement = createCall(mappingStatement, region, guardVariable2expression);
- mapping.setMappingStatement(mappingStatement);
+ mappingStatements.add(createCall(region, guardVariable2expression));
+ mapping.getOwnedStatements().addAll(mappingStatements);
}
@Override
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 4e8fc4bc6..005d9a191 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
@@ -55,7 +55,6 @@ 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.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
@@ -241,7 +240,6 @@ public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
}
bottomPattern.getVariable().addAll(connection2variable.values());
// } */
- MappingStatement mappingStatement = null;
/* ChainNode chain = visitor.getChain(region);
for (ChainNode child : chain.getChildren()) {
Region calledRegion = child.getRegion();
@@ -262,9 +260,8 @@ public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
}
} */
for (@NonNull Region callableRegion : region.getCallableChildren()) {
- mappingStatement = createCall(mappingStatement, callableRegion, null);
+ mapping.getOwnedStatements().add(createCall(callableRegion, null));
}
- mapping.setMappingStatement(mappingStatement);
}
private @NonNull OCLExpression getFilteredExpression(@NonNull OCLExpression initExpression, @NonNull NavigableEdge edge) {
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 852981ab8..9be5aae9b 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
@@ -46,6 +46,21 @@ implements QVTimperativeVisitor<IStepper>
}
@Override
+ public @Nullable IStepper visitConnectionAssignment(org.eclipse.qvtd.pivot.qvtimperative.@NonNull ConnectionAssignment object) {
+ return visitAssignment(object);
+ }
+
+ @Override
+ public @Nullable IStepper visitConnectionStatement(org.eclipse.qvtd.pivot.qvtimperative.@NonNull ConnectionStatement object) {
+ return visitMappingStatement(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);
}
@@ -72,7 +87,7 @@ implements QVTimperativeVisitor<IStepper>
@Override
public @Nullable IStepper visitMappingCall(org.eclipse.qvtd.pivot.qvtimperative.@NonNull MappingCall object) {
- return visitOCLExpression(object);
+ return visitMappingStatement(object);
}
@Override
@@ -81,6 +96,16 @@ implements QVTimperativeVisitor<IStepper>
}
@Override
+ public @Nullable IStepper visitMappingLoop(org.eclipse.qvtd.pivot.qvtimperative.@NonNull MappingLoop object) {
+ return visitMappingStatement(object);
+ }
+
+ @Override
+ public @Nullable IStepper visitMappingStatement(org.eclipse.qvtd.pivot.qvtimperative.@NonNull MappingStatement object) {
+ return visitStatement(object);
+ }
+
+ @Override
public @Nullable IStepper visitNavigationAssignment(org.eclipse.qvtd.pivot.qvtimperative.@NonNull NavigationAssignment object) {
return visitAssignment(object);
}
@@ -101,6 +126,11 @@ implements QVTimperativeVisitor<IStepper>
}
@Override
+ public @Nullable IStepper visitStatement(org.eclipse.qvtd.pivot.qvtimperative.@NonNull Statement object) {
+ return visitElement(object);
+ }
+
+ @Override
public @Nullable IStepper visitVariableAssignment(org.eclipse.qvtd.pivot.qvtimperative.@NonNull VariableAssignment object) {
return visitAssignment(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 25626d92d..8e6b08f01 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
@@ -28,9 +28,9 @@ 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.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.Statement;
public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
{
@@ -96,11 +96,6 @@ public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
}
@Override
- public @Nullable IStepper visitMappingSequence(@NonNull MappingSequence object) {
- return NonStepper.INSTANCE;
- }
-
- @Override
public @Nullable IStepper visitMappingStatement(@NonNull MappingStatement object) {
return PreStepper.INSTANCE;
}
@@ -116,6 +111,11 @@ public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
}
@Override
+ public @Nullable IStepper visitStatement(@NonNull Statement object) {
+ return PreStepper.INSTANCE;
+ }
+
+ @Override
public @Nullable IStepper visitTransformation(@NonNull Transformation object) {
return PrePostStepper.INSTANCE;
}
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 d6409a6f3..4a357d3f8 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
@@ -28,8 +28,8 @@ 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.MappingSequence;
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;
@@ -78,7 +78,9 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
visitRule(object);
visit(object.getGuardPattern());
visit(object.getBottomPattern());
- visit(object.getMappingStatement());
+ for (Statement mappingStatement : object.getOwnedStatements()) {
+ visit(mappingStatement);
+ }
return usage;
}
@@ -105,13 +107,7 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
setUsage(iterator, sourceUsage);
}
}
- visit(object.getOwnedBody());
- return getNoneUsage();
- }
-
- @Override
- public @NonNull DomainUsage visitMappingSequence(@NonNull MappingSequence object) {
- for (MappingStatement mappingStatement : object.getMappingStatements()) {
+ for (MappingStatement mappingStatement : object.getOwnedMappingStatements()) {
visit(mappingStatement);
}
return getNoneUsage();
@@ -119,7 +115,7 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
@Override
public @NonNull DomainUsage visitMappingStatement(@NonNull MappingStatement object) {
- return visitOCLExpression(object);
+ return visitStatement(object);
}
@Override
@@ -135,6 +131,11 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
}
@Override
+ public @NonNull DomainUsage visitStatement(@NonNull Statement object) {
+ return visiting(object);
+ }
+
+ @Override
public @NonNull DomainUsage visitVariableExp(@NonNull VariableExp object) {
StandardLibraryInternal standardLibrary = (StandardLibraryInternal) context.getStandardLibrary();
Type transformationType = standardLibrary.getLibraryType("Transformation");
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 375f6d444..41bd8a5f2 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
@@ -33,7 +33,7 @@ public class MappingAttribution extends AbstractAttribution
return null;
}
Mapping mapping = (Mapping)target;
- if (scopeView.getContainmentFeature() == QVTimperativePackage.Literals.MAPPING__MAPPING_STATEMENT) {
+ if (scopeView.getContainmentFeature() == QVTimperativePackage.Literals.MAPPING__OWNED_STATEMENTS) {
QVTimperativeEnvironmentUtil.addMiddleGuardVariables(environmentView, mapping);
QVTimperativeEnvironmentUtil.addSideGuardVariables(environmentView, mapping, null);
QVTimperativeEnvironmentUtil.addMiddleBottomVariables(environmentView, mapping);
@@ -49,7 +49,7 @@ public class MappingAttribution extends AbstractAttribution
}
}
}
-
+
}
return scopeView.getParent();
}
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 8091335e6..c0cad2d4a 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
@@ -63,9 +63,9 @@ 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.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NavigationAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
+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;
@@ -385,7 +385,7 @@ public class BasicQVTiExecutor extends AbstractExecutor implements QVTiExecutor
public @Nullable Object internalExecuteMappingCall(@NonNull MappingCall mappingCall, @NonNull Object @NonNull [] boundValues, @NonNull EvaluationVisitor undecoratedVisitor) {
Mapping calledMapping = mappingCall.getReferredMapping();
if (calledMapping != null) {
- pushEvaluationEnvironment(calledMapping, (TypedElement)mappingCall);
+ pushEvaluationEnvironment(calledMapping, mappingCall);
try {
int index = 0;
for (MappingCallBinding binding : mappingCall.getBinding()) {
@@ -429,9 +429,8 @@ public class BasicQVTiExecutor extends AbstractExecutor implements QVTiExecutor
//
// Invoke any corrolaries
//
- MappingStatement mappingStatement = mapping.getMappingStatement();
- if (mappingStatement != null) {
- mappingStatement.accept(undecoratedVisitor);
+ for (Statement statement : mapping.getOwnedStatements()) {
+ statement.accept(undecoratedVisitor);
}
return true;
}
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
index 81c339ca0..91ab89153 100644
--- 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
@@ -38,9 +38,9 @@ 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.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
+import org.eclipse.qvtd.pivot.qvtimperative.Statement;
import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.VariablePredicate;
@@ -288,14 +288,8 @@ public abstract class QVTiAbstractTracingEvaluationVisitor extends QVTiEvaluatio
}
@Override
- public @Nullable Object visitMappingSequence(@NonNull MappingSequence mappingSequence) {
- Object result = delegate.visitMappingSequence(mappingSequence);
- return result;
- }
-
- @Override
- public @Nullable Object visitMappingStatement(@NonNull MappingStatement vappingStatement) {
- return visiting(vappingStatement);
+ public @Nullable Object visitMappingStatement(@NonNull MappingStatement mappingStatement) {
+ return visitStatement(mappingStatement);
}
/* (non-Javadoc)
@@ -346,6 +340,11 @@ public abstract class QVTiAbstractTracingEvaluationVisitor extends QVTiEvaluatio
}
+ @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)
*/
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 35fb9dbd8..db27dd9aa 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
@@ -42,20 +42,20 @@ import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
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.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.MappingLoop;
-import org.eclipse.qvtd.pivot.qvtimperative.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NavigationAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.OppositePropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
+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;
@@ -246,23 +246,15 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
Variable iterator = ClassUtil.nonNullState(iterators.get(0));
for (Object object : (Iterable<?>)inValues) {
((QVTiExecutor)context).replace(iterator, object, false);
- mappingLoop.getOwnedBody().accept(undecoratedVisitor);
- }
- }
- }
- return true;
- }
-
- @Override
- public @Nullable Object visitMappingSequence(@NonNull MappingSequence mappingSequence) {
- for (MappingStatement mappingStatement : mappingSequence.getMappingStatements()) {
- if (mappingStatement != null) {
- context.pushEvaluationEnvironment(mappingStatement, mappingSequence);
- try {
- mappingStatement.accept(undecoratedVisitor);
- }
- finally {
- context.popEvaluationEnvironment();
+ for (@NonNull MappingStatement mappingStatement : ClassUtil.nullFree(mappingLoop.getOwnedMappingStatements())) {
+ context.pushEvaluationEnvironment(mappingStatement, mappingLoop);
+ try {
+ mappingStatement.accept(undecoratedVisitor);
+ }
+ finally {
+ context.popEvaluationEnvironment();
+ }
+ }
}
}
}
@@ -271,7 +263,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
@Override
public @Nullable Object visitMappingStatement(@NonNull MappingStatement object) {
- return visiting(object); // MappingStatement is abstract
+ return visitStatement(object); // MappingStatement is abstract
}
@Override
@@ -372,6 +364,11 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
@Override
+ public @Nullable Object visitStatement(@NonNull Statement object) {
+ return visitNamedElement(object); // Statement is abstract
+ }
+
+ @Override
public @Nullable Object visitTransformation(@NonNull Transformation transformation) {
return executor.internalExecuteTransformation(transformation, undecoratedVisitor);
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTuneUpVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTuneUpVisitor.java
index 073f10674..6ca1cc67b 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTuneUpVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTuneUpVisitor.java
@@ -46,10 +46,10 @@ 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.MappingLoop;
-import org.eclipse.qvtd.pivot.qvtimperative.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
+import org.eclipse.qvtd.pivot.qvtimperative.Statement;
import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.util.AbstractExtendingQVTimperativeVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
@@ -231,9 +231,8 @@ public class QVTiTuneUpVisitor extends AbstractExtendingQVTimperativeVisitor<Boo
}
object.getGuardPattern().accept(this);
object.getBottomPattern().accept(this);
- MappingStatement mappingStatement = object.getMappingStatement();
- if (mappingStatement != null) {
- mappingStatement.accept(this);
+ for (Statement statement : object.getOwnedStatements()) {
+ statement.accept(this);
}
return Boolean.TRUE;
}
@@ -246,13 +245,7 @@ public class QVTiTuneUpVisitor extends AbstractExtendingQVTimperativeVisitor<Boo
@Override
public @Nullable Boolean visitMappingLoop(@NonNull MappingLoop object) {
- object.getOwnedBody().accept(this);
- return Boolean.TRUE;
- }
-
- @Override
- public @Nullable Boolean visitMappingSequence(@NonNull MappingSequence object) {
- for (MappingStatement mappingStatement : object.getMappingStatements()) {
+ for (MappingStatement mappingStatement : object.getOwnedMappingStatements()) {
if (mappingStatement != null) {
mappingStatement.accept(this);
}
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 91988ef40..e9baec9b8 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
@@ -25,20 +25,20 @@ import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
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.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.MappingLoop;
-import org.eclipse.qvtd.pivot.qvtimperative.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NavigationAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.OppositePropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
+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.util.QVTimperativeVisitor;
@@ -159,7 +159,10 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
context.append("where");
doArea(pMapping);
- safeVisit(pMapping.getMappingStatement());
+ context.append("}");
+ for (Statement pStatement : pMapping.getOwnedStatements()) {
+ safeVisit(pStatement);
+ }
context.pop();
return null;
}
@@ -198,23 +201,17 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
context.appendElement(pMappingLoop.getOwnedSource());
context.append(" {");
context.push("", "");
- safeVisit(pMappingLoop.getOwnedBody());
- context.append("}");
- context.pop();
- return null;
- }
-
- @Override
- public Object visitMappingSequence(@NonNull MappingSequence pMappingSequence) {
- for (MappingStatement pMappingStatement : pMappingSequence.getMappingStatements()) {
+ for (MappingStatement pMappingStatement : pMappingLoop.getOwnedMappingStatements()) {
safeVisit(pMappingStatement);
}
+ context.append("}");
+ context.pop();
return null;
}
@Override
public Object visitMappingStatement(@NonNull MappingStatement object) {
- return visiting(object);
+ return visitStatement(object);
}
@Override
@@ -252,6 +249,11 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
@Override
+ public Object visitStatement(@NonNull Statement object) {
+ return visiting(object);
+ }
+
+ @Override
public Object visitVariable(@NonNull Variable pVariable) {
if (pVariable.eContainer() instanceof MappingLoop) {
context.appendName(pVariable);
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 ca79ee186..9f5313401 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
@@ -30,13 +30,13 @@ 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.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NavigationAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.OppositePropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
+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.util.QVTimperativeVisitor;
@@ -181,11 +181,6 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
- public @Nullable String visitMappingSequence(@NonNull MappingSequence object) {
- return null;
- }
-
- @Override
public @Nullable String visitMappingStatement(@NonNull MappingStatement object) {
return null;
}
@@ -218,6 +213,11 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
+ public @Nullable String visitStatement(@NonNull Statement object) {
+ return null;
+ }
+
+ @Override
public String visitVariableAssignment(@NonNull VariableAssignment variableAssignment) {
appendName(variableAssignment.getTargetVariable());
append(" := ");
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 0c5ee333c..3fea951d7 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
@@ -55,7 +55,6 @@ 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.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NavigationAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.OppositePropertyAssignment;
@@ -111,7 +110,7 @@ public class QVTimperativeUtil extends QVTbaseUtil
/**
* Return a MappingStatement comprising the concatenation of mappingStatementOrStatements and mappingStatement.
* mappingStatementOrStatements may be null, a MappingStatement or a composite MappingSequence.
- */
+ *
public static @NonNull MappingStatement addMappingStatement(@Nullable MappingStatement mappingStatementOrStatements, @NonNull MappingStatement mappingStatement) {
if (mappingStatementOrStatements == null) {
return mappingStatement;
@@ -127,7 +126,7 @@ public class QVTimperativeUtil extends QVTbaseUtil
mappingStatements.add(mappingStatement);
return mappingSequence;
}
- }
+ } */
public static @NonNull ImperativeDomain createImperativeDomain(@NonNull TypedModel typedModel) {
ImperativeDomain coreDomain = QVTimperativeFactory.eINSTANCE.createImperativeDomain();
@@ -176,15 +175,15 @@ public class QVTimperativeUtil extends QVTbaseUtil
MappingLoop ml = QVTimperativeFactory.eINSTANCE.createMappingLoop();
ml.setOwnedSource(source);
ml.getOwnedIterators().add(iterator);
- ml.setOwnedBody(mappingStatement);
+ ml.getOwnedMappingStatements().add(mappingStatement);
return ml;
}
- public static @NonNull MappingSequence createMappingSequence(@NonNull List<@NonNull MappingStatement> mappingStatements) {
+ /* public static @NonNull MappingSequence createMappingSequence(@NonNull List<@NonNull MappingStatement> mappingStatements) {
MappingSequence mappingSequence = QVTimperativeFactory.eINSTANCE.createMappingSequence();
mappingSequence.getMappingStatements().addAll(mappingStatements);
return mappingSequence;
- }
+ } */
/* public static @NonNull OperationCallExp createOperationCallExp(@NonNull OCLExpression sourceExp, @NonNull Operation operation, OCLExpression... arguments) {
OperationCallExp exp = PivotFactory.eINSTANCE.createOperationCallExp();
@@ -339,7 +338,7 @@ public class QVTimperativeUtil extends QVTbaseUtil
*/
public static void sortPatternVariables(@NonNull List<@NonNull Variable> variables) {
if (variables.size() > 1) {
- final Map<@NonNull Variable, @Nullable List<@NonNull VariableDeclaration>> def2refs = new HashMap<@NonNull Variable, @Nullable List<@NonNull VariableDeclaration>>();
+ final Map<@NonNull Variable, @Nullable List<@NonNull VariableDeclaration>> def2refs = new HashMap<>();
//
// Initialize the def2refs.keySet as a fast is-a-pattern-variable lookup.
//
@@ -359,7 +358,7 @@ public class QVTimperativeUtil extends QVTbaseUtil
assert referredVariable != null;
if (def2refs.containsKey(referredVariable)) {
if (refs == null) {
- refs = new ArrayList<@NonNull VariableDeclaration>();
+ refs = new ArrayList<>();
def2refs.put(variable, refs);
}
if (!refs.contains(referredVariable)) {
@@ -404,48 +403,51 @@ public class QVTimperativeUtil extends QVTbaseUtil
/**
* Return a copy of asVariablePredicates sorted to avoid reverse references from the predicate expressions.
*/
- public static @NonNull List<VariablePredicate> sortVariablePredicates(@NonNull Mapping asMapping, @NonNull List<VariablePredicate> asVariablePredicates) {
- Set<Variable> asGuardVariables = new HashSet<Variable>();
- asGuardVariables.addAll(asMapping.getGuardPattern().getVariable());
+ 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()));
for (Domain asDomain : asMapping.getDomain()) {
- asGuardVariables.addAll(((ImperativeDomain)asDomain).getGuardPattern().getVariable());
+ asGuardVariables.addAll(ClassUtil.nullFree(((ImperativeDomain)asDomain).getGuardPattern().getVariable()));
}
- List<VariableDeclaration> pendingVariables = new ArrayList<VariableDeclaration>();
- Map<VariableDeclaration, VariablePredicate> variable2predicate = new HashMap<VariableDeclaration, VariablePredicate>();
- Map<VariableDeclaration, Set<VariablePredicate>> variable2predicates = new HashMap<VariableDeclaration, Set<VariablePredicate>>();
- Map<VariablePredicate, @NonNull Set<VariableDeclaration>> predicate2variables = new HashMap<VariablePredicate, @NonNull Set<VariableDeclaration>>();
- for (VariablePredicate asVariablePredicate : asVariablePredicates) {
+ List<@NonNull VariableDeclaration> pendingVariables = new ArrayList<>();
+ Map<@NonNull VariableDeclaration, @NonNull VariablePredicate> variable2predicate = new HashMap<>();
+ Map<@NonNull VariableDeclaration, @NonNull Set<@NonNull VariablePredicate>> variable2predicates = new HashMap<>();
+ Map<@NonNull VariablePredicate, @NonNull Set<@NonNull VariableDeclaration>> predicate2variables = new HashMap<>();
+ for (@NonNull VariablePredicate asVariablePredicate : asVariablePredicates) {
for (TreeIterator<EObject> tit = asVariablePredicate.eAllContents(); tit.hasNext(); ) {
EObject eObject = tit.next();
if (eObject instanceof VariableExp) {
VariableDeclaration asVariable = ((VariableExp)eObject).getReferredVariable();
if ((asVariable != null) && asGuardVariables.contains(asVariable)) {
- Set<VariablePredicate> predicates = variable2predicates.get(asVariable);
+ Set<@NonNull VariablePredicate> predicates = variable2predicates.get(asVariable);
if (predicates == null){
- predicates = new HashSet<VariablePredicate>();
+ predicates = new HashSet<>();
variable2predicates.put(asVariable, predicates);
}
predicates.add(asVariablePredicate);
- Set<VariableDeclaration> variables = predicate2variables.get(asVariablePredicate);
+ Set<@NonNull VariableDeclaration> variables = predicate2variables.get(asVariablePredicate);
if (variables == null){
- variables = new HashSet<VariableDeclaration>();
+ variables = new HashSet<>();
predicate2variables.put(asVariablePredicate, variables);
}
variables.add(asVariable);
- pendingVariables.add(asVariablePredicate.getTargetVariable());
- variable2predicate.put(asVariablePredicate.getTargetVariable(), asVariablePredicate);
+ Variable targetVariable = asVariablePredicate.getTargetVariable();
+ assert targetVariable != null;
+ pendingVariables.add(targetVariable);
+ variable2predicate.put(targetVariable, asVariablePredicate);
}
}
}
}
int oldSize;
- List<VariablePredicate> asSortedVariablePredicates = new ArrayList<VariablePredicate>();
+ List<@NonNull VariablePredicate> asSortedVariablePredicates = new ArrayList<>();
Collections.sort(pendingVariables, NameUtil.NAMEABLE_COMPARATOR); // Ensure deterministic order
while (pendingVariables.size() > 0) {
oldSize = asSortedVariablePredicates.size();
- for (VariableDeclaration asVariable : pendingVariables) {
+ for (@NonNull VariableDeclaration asVariable : pendingVariables) {
VariablePredicate asVariablePredicate1 = variable2predicate.get(asVariable);
- Set<VariableDeclaration> variables = predicate2variables.get(asVariablePredicate1);
+ assert asVariablePredicate1 != null;
+ Set<@NonNull VariableDeclaration> variables = predicate2variables.get(asVariablePredicate1);
if (variables != null){
variables.retainAll(pendingVariables);
if (variables.size() <= 0) {
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 d381a91e9..906763cd7 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
@@ -21,14 +21,13 @@ 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.GuardPattern;
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.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
@@ -144,10 +143,6 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
return "«for»";
}
- protected String text(MappingSequence ele) {
- return "«sequence»";
- }
-
protected String text(Predicate ele) {
return "«predicate»";
}
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 4385ea165..8ae0a14e9 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
@@ -19,6 +19,7 @@ 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.MappingLoop;
+import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
import org.eclipse.qvtd.xtext.qvtbase.ui.outline.QVTbaseOutlineTreeProvider;
@@ -71,8 +72,8 @@ public class QVTimperativeOutlineTreeProvider extends QVTbaseOutlineTreeProvider
for (Variable asIterator : ele.getOwnedIterators()) {
createNode(parentNode, asIterator);
}
- if (ele.getOwnedBody() != null) {
- createNode(parentNode, ele.getOwnedBody());
+ for (MappingStatement asStatement : ele.getOwnedMappingStatements()) {
+ createNode(parentNode, asStatement);
}
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/emf-gen/org/eclipse/qvtd/xtext/qvtimperativecs/MappingSequenceCS.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/emf-gen/org/eclipse/qvtd/xtext/qvtimperativecs/MappingSequenceCS.java
deleted file mode 100644
index 743ee9a2d..000000000
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/emf-gen/org/eclipse/qvtd/xtext/qvtimperativecs/MappingSequenceCS.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 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.xtext.qvtimperativecs;
-
-import org.eclipse.emf.common.util.EList;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Mapping Sequence CS</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * </p>
- * <ul>
- * <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.MappingSequenceCS#getOwnedMappingStatements <em>Owned Mapping Statements</em>}</li>
- * </ul>
- *
- * @see org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage#getMappingSequenceCS()
- * @model
- * @generated
- */
-public interface MappingSequenceCS extends MappingStatementCS {
- /**
- * Returns the value of the '<em><b>Owned Mapping Statements</b></em>' containment reference list.
- * The list contents are of type {@link org.eclipse.qvtd.xtext.qvtimperativecs.MappingStatementCS}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Owned Mapping Statements</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Owned Mapping Statements</em>' containment reference list.
- * @see org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage#getMappingSequenceCS_OwnedMappingStatements()
- * @model containment="true" required="true"
- * @generated
- */
- EList<MappingStatementCS> getOwnedMappingStatements();
-
-} // MappingSequenceCS
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/emf-gen/org/eclipse/qvtd/xtext/qvtimperativecs/impl/MappingSequenceCSImpl.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/emf-gen/org/eclipse/qvtd/xtext/qvtimperativecs/impl/MappingSequenceCSImpl.java
deleted file mode 100644
index 490f6f0ae..000000000
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/emf-gen/org/eclipse/qvtd/xtext/qvtimperativecs/impl/MappingSequenceCSImpl.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 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.xtext.qvtimperativecs.impl;
-
-import java.util.Collection;
-
-import org.eclipse.emf.common.notify.NotificationChain;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EObjectContainmentEList;
-import org.eclipse.emf.ecore.util.InternalEList;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
-import org.eclipse.qvtd.xtext.qvtimperativecs.MappingSequenceCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.MappingStatementCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage;
-import org.eclipse.qvtd.xtext.qvtimperativecs.util.QVTimperativeCSVisitor;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Mapping Sequence CS</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * </p>
- * <ul>
- * <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingSequenceCSImpl#getOwnedMappingStatements <em>Owned Mapping Statements</em>}</li>
- * </ul>
- *
- * @generated
- */
-public class MappingSequenceCSImpl extends MappingStatementCSImpl implements MappingSequenceCS {
- /**
- * The cached value of the '{@link #getOwnedMappingStatements() <em>Owned Mapping Statements</em>}' containment reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getOwnedMappingStatements()
- * @generated
- * @ordered
- */
- protected EList<MappingStatementCS> ownedMappingStatements;
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected MappingSequenceCSImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return QVTimperativeCSPackage.Literals.MAPPING_SEQUENCE_CS;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EList<MappingStatementCS> getOwnedMappingStatements() {
- if (ownedMappingStatements == null) {
- ownedMappingStatements = new EObjectContainmentEList<MappingStatementCS>(MappingStatementCS.class, this, QVTimperativeCSPackage.MAPPING_SEQUENCE_CS__OWNED_MAPPING_STATEMENTS);
- }
- return ownedMappingStatements;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case QVTimperativeCSPackage.MAPPING_SEQUENCE_CS__OWNED_MAPPING_STATEMENTS:
- return ((InternalEList<?>)getOwnedMappingStatements()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case QVTimperativeCSPackage.MAPPING_SEQUENCE_CS__OWNED_MAPPING_STATEMENTS:
- return getOwnedMappingStatements();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case QVTimperativeCSPackage.MAPPING_SEQUENCE_CS__OWNED_MAPPING_STATEMENTS:
- getOwnedMappingStatements().clear();
- getOwnedMappingStatements().addAll((Collection<? extends MappingStatementCS>)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case QVTimperativeCSPackage.MAPPING_SEQUENCE_CS__OWNED_MAPPING_STATEMENTS:
- getOwnedMappingStatements().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case QVTimperativeCSPackage.MAPPING_SEQUENCE_CS__OWNED_MAPPING_STATEMENTS:
- return ownedMappingStatements != null && !ownedMappingStatements.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * {@inheritDoc}
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
- return (R) ((QVTimperativeCSVisitor<?>)visitor).visitMappingSequenceCS(this);
- }
-
-} //MappingSequenceCSImpl
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 400794795..96b2d7e44 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
@@ -84,12 +84,12 @@ 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.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NavigationAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.OppositePropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
+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.util.QVTimperativeVisitor;
@@ -107,15 +107,14 @@ 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.MappingSequenceCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingStatementCS;
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.QVTimperativeCSFactory;
import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage;
import org.eclipse.qvtd.xtext.qvtimperativecs.QueryCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.RealizedVariableCS;
+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;
@@ -551,25 +550,7 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
refreshUsedProperties(asTransformation, csDomain.getCheckedProperties(), ClassUtil.nullFree(asMapping.getCheckedProperties()));
csMapping.setOwnedMiddle(csDomain);
csMapping.setOwnedKeyExpression(createExpCS(asMapping.getOwnedKeyExpression()));
- MappingStatementCS csMappingStatement = context.visitDeclaration(MappingStatementCS.class, asMapping.getMappingStatement());
- MappingSequenceCS csMappingSequence;
- if (csMappingStatement instanceof MappingSequenceCS) {
- csMappingSequence = (MappingSequenceCS) csMappingStatement;
- }
- else if (csMappingStatement != null) {
- csMappingSequence = csMapping.getOwnedMappingSequence();
- if (csMappingSequence == null) {
- csMappingSequence = QVTimperativeCSFactory.eINSTANCE.createMappingSequenceCS();
- }
- else {
- csMappingSequence.getOwnedMappingStatements().clear();
- }
- csMappingSequence.getOwnedMappingStatements().add(csMappingStatement);
- }
- else {
- csMappingSequence = null;
- }
- csMapping.setOwnedMappingSequence(csMappingSequence);
+ context.refreshList(csMapping.getOwnedStatements(), context.visitDeclarations(StatementCS.class, asMapping.getOwnedStatements(), null));
return csMapping;
}
@@ -599,42 +580,13 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
csMappingLoop.setPivot(asMappingLoop);
csMappingLoop.setOwnedIterator(context.visitDeclaration(VariableCS.class, asMappingLoop.getOwnedIterators().get(0)));
csMappingLoop.setOwnedInExpression(createExpCS(asMappingLoop.getOwnedSource()));
- MappingStatementCS csMappingStatement = context.visitDeclaration(MappingStatementCS.class, asMappingLoop.getOwnedBody());
- MappingSequenceCS csMappingSequence;
- if (csMappingStatement instanceof MappingSequenceCS) {
- csMappingSequence = (MappingSequenceCS) csMappingStatement;
- }
- else if (csMappingStatement != null) {
- csMappingSequence = csMappingLoop.getOwnedMappingSequence();
- if (csMappingSequence == null) {
- csMappingSequence = QVTimperativeCSFactory.eINSTANCE.createMappingSequenceCS();
- }
- else {
- csMappingSequence.getOwnedMappingStatements().clear();
- }
- csMappingSequence.getOwnedMappingStatements().add(csMappingStatement);
- }
- else {
- csMappingSequence = null;
- }
- csMappingLoop.setOwnedMappingSequence(csMappingSequence);
+ context.refreshList(csMappingLoop.getOwnedMappingStatements(), context.visitDeclarations(MappingStatementCS.class, asMappingLoop.getOwnedMappingStatements(), null));
return csMappingLoop;
}
@Override
- public ElementCS visitMappingSequence(@NonNull MappingSequence asMappingSequence) {
- List<MappingStatement> asMappingStatements = asMappingSequence.getMappingStatements();
- if (asMappingStatements.size() <= 0) {
- return null;
- }
- MappingSequenceCS csMappingSequence = context.refreshElement(MappingSequenceCS.class, QVTimperativeCSPackage.Literals.MAPPING_SEQUENCE_CS, asMappingSequence);
- context.refreshList(csMappingSequence.getOwnedMappingStatements(), context.visitDeclarations(MappingStatementCS.class, asMappingStatements, null));
- return csMappingSequence;
- }
-
- @Override
public ElementCS visitMappingStatement(@NonNull MappingStatement object) {
- return visiting(object);
+ return visitStatement(object);
}
@Override
@@ -734,6 +686,11 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
@Override
+ public ElementCS visitStatement(@NonNull Statement object) {
+ return visiting(object);
+ }
+
+ @Override
public ElementCS visitTransformation(@NonNull Transformation asTransformation) {
TransformationCS csTransformation = context.refreshNamedElement(TransformationCS.class, QVTimperativeCSPackage.Literals.TRANSFORMATION_CS, asTransformation);
// csTransformation.setPivot(asTransformation);
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 4a2c92def..e5f2f52ee 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
@@ -50,19 +50,19 @@ import org.eclipse.qvtd.pivot.qvtimperative.BottomPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
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.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.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
-import org.eclipse.qvtd.pivot.qvtimperative.MappingSequence;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.PropertyAssignment;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.Statement;
import org.eclipse.qvtd.pivot.qvtimperative.VariableAssignment;
import org.eclipse.qvtd.xtext.qvtimperativecs.BottomPatternCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.ConnectionStatementCS;
@@ -73,7 +73,6 @@ 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.MappingSequenceCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.ParamDeclarationCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.PatternCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.PredicateCS;
@@ -293,7 +292,7 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
}
}
context.refreshPivotList(ImperativeDomain.class, pivotElement.getDomain(), csElement.getOwnedDomains());
- pivotElement.setMappingStatement(PivotUtil.getPivot(MappingStatement.class, csElement.getOwnedMappingSequence()));
+ context.refreshPivotList(Statement.class, pivotElement.getOwnedStatements(), csElement.getOwnedStatements());
pivotElement.setIsDefault(csElement.isIsDefault());
return null;
}
@@ -321,7 +320,7 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
@NonNull Variable iterator = refreshNamedElement(Variable.class, PivotPackage.Literals.VARIABLE, ClassUtil.nonNullState(csMappingLoop.getOwnedIterator()));
pivotElement.getOwnedIterators().clear();
pivotElement.getOwnedIterators().add(iterator);
- pivotElement.setOwnedBody(PivotUtil.getPivot(MappingStatement.class, csMappingLoop.getOwnedMappingSequence()));
+ context.refreshPivotList(MappingStatement.class, pivotElement.getOwnedMappingStatements(), csMappingLoop.getOwnedMappingStatements());
// CollectionType collectionType = metamodelManager.getCollectionType();
// DomainOperation forAllIteration = ClassUtil.getNamedElement(collectionType.getLocalOperations(), "forAll");
// pivotElement.setReferredIteration((Iteration) forAllIteration);
@@ -330,13 +329,6 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
}
@Override
- public Continuation<?> visitMappingSequenceCS(@NonNull MappingSequenceCS csMappingSequence) {
- @NonNull MappingSequence pivotElement = context.refreshModelElement(MappingSequence.class, QVTimperativePackage.Literals.MAPPING_SEQUENCE, csMappingSequence);
- context.refreshPivotList(MappingStatement.class, pivotElement.getMappingStatements(), csMappingSequence.getOwnedMappingStatements());
- return null;
- }
-
- @Override
public Continuation<?> visitParamDeclarationCS(@NonNull ParamDeclarationCS csElement) {
refreshNamedElement(FunctionParameter.class, QVTbasePackage.Literals.FUNCTION_PARAMETER, csElement);
return null;

Back to the top