Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-09-09 13:35:33 +0000
committerEd Willink2016-09-19 11:18:00 +0000
commitd0c1b32a6108e3ebd1a5f700fa6bb1c743018208 (patch)
treee15930a647e6301f64efd86f8ce1e37b9260b8f8
parent59a5b8001441884703fcc0a50bf88a80d2be629b (diff)
downloadorg.eclipse.qvtd-d0c1b32a6108e3ebd1a5f700fa6bb1c743018208.tar.gz
org.eclipse.qvtd-d0c1b32a6108e3ebd1a5f700fa6bb1c743018208.tar.xz
org.eclipse.qvtd-d0c1b32a6108e3ebd1a5f700fa6bb1c743018208.zip
[500369] Support AddStatement
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java65
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java12
-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.java18
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java15
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java18
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/QVTimperativeDomainUsageAnalysis.java12
-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.java18
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeHelper.java12
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java31
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java32
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java45
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java14
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java33
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java10
16 files changed, 133 insertions, 247 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 17d9b49d9..38f651f3b 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
@@ -102,12 +102,11 @@ 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.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.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;
@@ -386,17 +385,10 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
CGRealizedVariable cgVariable = getRealizedVariable(pRealizedVariable);
cgRealizedVariables.add(cgVariable);
}
- List<@NonNull CGConnectionAssignment> cgConnectionAssignments = ClassUtil.nullFree(cgMappingExp.getConnectionAssignments());
- List<@NonNull CGPropertyAssignment> cgPropertyAssignments = ClassUtil.nullFree(cgMappingExp.getAssignments());
for (@NonNull BottomPattern pBottomPattern : pBottomPatterns) {
List<@NonNull Assignment> assignment = ClassUtil.nullFree(pBottomPattern.getAssignment());
for (@NonNull Assignment pAssignment : assignment) {
- if (pAssignment instanceof ConnectionAssignment) {
- cgConnectionAssignments.add(doVisit(CGConnectionAssignment.class, pAssignment));
- }
- else {
- assert pAssignment instanceof VariableAssignment;
- }
+ assert pAssignment instanceof VariableAssignment;
}
}
appendSubTree(cgMappingExp);
@@ -690,6 +682,24 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
+ public @Nullable CGNamedElement visitAddStatement(@NonNull AddStatement asAddStatement) {
+ Variable asVariable = asAddStatement.getTargetVariable();
+ if (asVariable == null) {
+ return null;
+ }
+ CGVariable cgVariable = getVariable(asVariable);
+ OCLExpression asInitValue = asAddStatement.getValue();
+ assert (cgVariable instanceof CGConnectionVariable) || (cgVariable instanceof CGAccumulator);
+ CGValuedElement initValue = doVisit(CGValuedElement.class, asInitValue);
+ CGConnectionAssignment cgConnectionAssignment = QVTiCGModelFactory.eINSTANCE.createCGConnectionAssignment();
+ cgConnectionAssignment.setConnectionVariable(cgVariable);
+ cgConnectionAssignment.setInitValue(initValue);
+ cgConnectionAssignment.setTypeId(initValue.getTypeId());
+ cgConnectionAssignment.setRequired(initValue.isRequired());
+ return cgConnectionAssignment;
+ }
+
+ @Override
public @Nullable CGNamedElement visitAssignment(@NonNull Assignment object) {
return visiting(object);
}
@@ -710,41 +720,6 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitConnectionAssignment(@NonNull ConnectionAssignment asConnectionAssignment) {
- Variable asVariable = asConnectionAssignment.getTargetVariable();
- if (asVariable == null) {
- return null;
- }
- CGVariable cgVariable = getVariable(asVariable);
- OCLExpression asInitValue = asConnectionAssignment.getValue();
- CGValuedElement initValue = doVisit(CGValuedElement.class, asInitValue);
- CGConnectionAssignment cgConnectionAssignment = QVTiCGModelFactory.eINSTANCE.createCGConnectionAssignment();
- cgConnectionAssignment.setConnectionVariable(cgVariable);
- cgConnectionAssignment.setInitValue(initValue);
- cgConnectionAssignment.setTypeId(initValue.getTypeId());
- cgConnectionAssignment.setRequired(initValue.isRequired());
- return cgConnectionAssignment;
- }
-
- @Override
- public @Nullable CGNamedElement visitConnectionStatement(@NonNull ConnectionStatement asConnectionStatement) {
- Variable asVariable = asConnectionStatement.getTargetVariable();
- if (asVariable == null) {
- return null;
- }
- CGVariable cgVariable = getVariable(asVariable);
- OCLExpression asInitValue = asConnectionStatement.getValue();
- assert (cgVariable instanceof CGConnectionVariable) || (cgVariable instanceof CGAccumulator);
- CGValuedElement initValue = doVisit(CGValuedElement.class, asInitValue);
- CGConnectionAssignment cgConnectionAssignment = QVTiCGModelFactory.eINSTANCE.createCGConnectionAssignment();
- cgConnectionAssignment.setConnectionVariable(cgVariable);
- cgConnectionAssignment.setInitValue(initValue);
- cgConnectionAssignment.setTypeId(initValue.getTypeId());
- cgConnectionAssignment.setRequired(initValue.isRequired());
- return cgConnectionAssignment;
- }
-
- @Override
public @Nullable CGNamedElement visitConnectionVariable(@NonNull ConnectionVariable asConnectionVariable) {
CGVariable cgVariable = getVariable(asConnectionVariable);
CGValuedElement initValue = doVisit(CGValuedElement.class, asConnectionVariable.getOwnedInit());
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 200307f74..a0dab8210 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
@@ -45,7 +45,7 @@ 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.compiler.internal.qvtp2qvts.SchedulerConstants;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionAssignment;
+import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
@@ -96,6 +96,11 @@ public abstract class AbstractRegion2Mapping
}
}
+ protected void createAddStatement(@NonNull ConnectionVariable connectionVariable, @NonNull OCLExpression childrenExpression) {
+ AddStatement addStatement = helper.createAddStatement(connectionVariable, childrenExpression);
+ mapping.getOwnedStatements().add(addStatement);
+ }
+
protected @NonNull CallExp createCallExp(@NonNull OCLExpression asSource, @NonNull Property asProperty) {
if (asProperty.eContainer() == null) {
Type asType = asProperty.getType();
@@ -113,11 +118,6 @@ public abstract class AbstractRegion2Mapping
return PivotUtil.createNavigationCallExp(asSource, asProperty);
}
- protected void createConnectionAssignment(@NonNull ConnectionVariable connectionVariable, @NonNull OCLExpression childrenExpression) {
- ConnectionAssignment connectionAssignment = helper.createConnectionAssignment(connectionVariable, childrenExpression);
- mapping.getBottomPattern().getAssignment().add(connectionAssignment);
- }
-
protected @NonNull ConnectionVariable createConnectionVariable(@NonNull NodeConnection connection) {
Type asType = getConnectionSourcesType(connection);
String name = connection.getName();
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 492be8464..6e7b52287 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
@@ -578,7 +578,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
createExternalPredicates();
createRealizedVariables();
createPropertyAssignments();
- createConnectionAssignments();
+ createAddStatements();
createPollingDependencies();
}
@@ -740,14 +740,14 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
/**
* Create accumulation assignments for connections.
*/
- private void createConnectionAssignments() {
+ private void createAddStatements() {
if (connection2variable != null) {
for (@NonNull NodeConnection connection : connection2variable.keySet()) {
Node sourceNode = connection.getSource(region);
OCLExpression variableExpression = createVariableExp(sourceNode);
ConnectionVariable connectionVariable = (ConnectionVariable)connection2variable.get(connection);
assert connectionVariable != null;
- createConnectionAssignment(connectionVariable, variableExpression);
+ createAddStatement(connectionVariable, variableExpression);
}
}
}
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 47cf0a958..32d83c181 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
@@ -35,7 +35,7 @@ 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.ConnectionStatement;
+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;
@@ -316,19 +316,19 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
excludingAllCallExp.setIsRequired(localVariableExp.isIsRequired());
- ConnectionStatement connectionStatement1 = QVTimperativeFactory.eINSTANCE.createConnectionStatement();
- connectionStatement1.setTargetVariable(newVariable);
- connectionStatement1.setValue(excludingAllCallExp);
- mappingStatements.add(connectionStatement1);
+ AddStatement addStatement1 = QVTimperativeFactory.eINSTANCE.createAddStatement();
+ addStatement1.setTargetVariable(newVariable);
+ addStatement1.setValue(excludingAllCallExp);
+ mappingStatements.add(addStatement1);
}
else {
newVariable = localVariable;
}
//
- ConnectionStatement connectionStatement2 = QVTimperativeFactory.eINSTANCE.createConnectionStatement();
- connectionStatement2.setTargetVariable(accumulatedVariable);
- connectionStatement2.setValue(PivotUtil.createVariableExp(newVariable));
- mappingStatements.add(connectionStatement2);
+ AddStatement addStatement2 = QVTimperativeFactory.eINSTANCE.createAddStatement();
+ addStatement2.setTargetVariable(accumulatedVariable);
+ addStatement2.setValue(PivotUtil.createVariableExp(newVariable));
+ mappingStatements.add(addStatement2);
}
}
//
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 764a4e2d1..953376c00 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
@@ -36,6 +36,11 @@ implements QVTimperativeVisitor<IStepper>
}
@Override
+ public @Nullable IStepper visitAddStatement(org.eclipse.qvtd.pivot.qvtimperative.@NonNull AddStatement object) {
+ return visitMappingStatement(object);
+ }
+
+ @Override
public @Nullable IStepper visitAssignment(org.eclipse.qvtd.pivot.qvtimperative.@NonNull Assignment object) {
return visitElement(object);
}
@@ -46,16 +51,6 @@ 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);
}
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 5776d4259..6e2eedc5d 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
@@ -18,11 +18,10 @@ 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.ConnectionAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
@@ -42,6 +41,11 @@ public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
}
@Override
+ public @Nullable IStepper visitAddStatement(@NonNull AddStatement object) {
+ return visitMappingStatement(object);
+ }
+
+ @Override
public @Nullable IStepper visitAssignment(@NonNull Assignment object) {
return PostStepper.INSTANCE;
}
@@ -57,16 +61,6 @@ public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
}
@Override
- public @Nullable IStepper visitConnectionAssignment(@NonNull ConnectionAssignment object) {
- return visitAssignment(object);
- }
-
- @Override
- public @Nullable IStepper visitConnectionStatement(@NonNull ConnectionStatement object) {
- return visitMappingStatement(object);
- }
-
- @Override
public @Nullable IStepper visitConnectionVariable(@NonNull ConnectionVariable object) {
return NonStepper.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 4a357d3f8..4b986e7b1 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
@@ -20,8 +20,7 @@ import org.eclipse.ocl.pivot.VariableExp;
import org.eclipse.ocl.pivot.internal.complete.StandardLibraryInternal;
import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
+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.Mapping;
@@ -48,14 +47,7 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
}
@Override
- public @NonNull DomainUsage visitConnectionAssignment(@NonNull ConnectionAssignment object) {
- DomainUsage valueUsage = visit(object.getValue());
- DomainUsage variableUsage = visit(object.getTargetVariable());
- return intersection(variableUsage, valueUsage);
- }
-
- @Override
- public @NonNull DomainUsage visitConnectionStatement(@NonNull ConnectionStatement object) {
+ public @NonNull DomainUsage visitAddStatement(@NonNull AddStatement object) {
DomainUsage valueUsage = visit(object.getValue());
DomainUsage variableUsage = visit(object.getTargetVariable());
return intersection(variableUsage, valueUsage);
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 5cad01098..3fa8db8b4 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
@@ -37,11 +37,10 @@ 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.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.ConnectionAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
@@ -98,6 +97,18 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
@Override
+ public @Nullable Object visitAddStatement(@NonNull AddStatement connectionStatement) {
+ ConnectionVariable targetVariable = connectionStatement.getTargetVariable() ;
+ if (targetVariable != null) {
+ OCLExpression valueExpression = connectionStatement.getValue();
+ if (valueExpression != null) {
+ return doConnectionAccumulation(targetVariable, valueExpression);
+ }
+ }
+ return null;
+ }
+
+ @Override
public @Nullable Object visitAssignment(@NonNull Assignment object) {
return visiting(object);
}
@@ -118,30 +129,6 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
@Override
- public @Nullable Object visitConnectionAssignment(@NonNull ConnectionAssignment connectionAssignment) {
- ConnectionVariable targetVariable = connectionAssignment.getTargetVariable() ;
- if (targetVariable != null) {
- OCLExpression valueExpression = connectionAssignment.getValue();
- if (valueExpression != null) {
- return doConnectionAccumulation(targetVariable, valueExpression);
- }
- }
- return null;
- }
-
- @Override
- public @Nullable Object visitConnectionStatement(@NonNull ConnectionStatement connectionStatement) {
- ConnectionVariable targetVariable = connectionStatement.getTargetVariable() ;
- if (targetVariable != null) {
- OCLExpression valueExpression = connectionStatement.getValue();
- if (valueExpression != null) {
- return doConnectionAccumulation(targetVariable, valueExpression);
- }
- }
- return null;
- }
-
- @Override
public Object visitConnectionVariable(@NonNull ConnectionVariable object) {
return visiting(object);
}
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 4d4a67055..5709d7729 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
@@ -37,10 +37,9 @@ import org.eclipse.ocl.pivot.utilities.ClassUtil;
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.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Assignment;
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.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativePattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
@@ -97,14 +96,16 @@ public class QVTiTuneUpVisitor extends AbstractExtendingQVTimperativeVisitor<Boo
}
@Override
+ public Boolean visitAddStatement(@NonNull AddStatement object) {
+ return Boolean.TRUE;
+ }
+
+ @Override
public @Nullable Boolean visitBottomPattern(@NonNull BottomPattern object) {
List<Assignment> variableAssignments = new ArrayList<Assignment>();
List<Assignment> propertyAssignments = new ArrayList<Assignment>();
for (Assignment assignment : object.getAssignment()) {
- if (assignment instanceof ConnectionAssignment) {
- variableAssignments.add(assignment);
- }
- else if (assignment instanceof VariableAssignment) {
+ if (assignment instanceof VariableAssignment) {
variableAssignments.add(assignment);
}
else {
@@ -154,11 +155,6 @@ public class QVTiTuneUpVisitor extends AbstractExtendingQVTimperativeVisitor<Boo
}
@Override
- public Boolean visitConnectionStatement(@NonNull ConnectionStatement object) {
- return Boolean.TRUE;
- }
-
- @Override
public @Nullable Boolean visitIfExp(@NonNull IfExp object) {
OCLExpression ownedCondition = object.getOwnedCondition();
OCLExpression ownedThen = object.getOwnedThen();
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 ca5041ea0..d2ab39ae0 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
@@ -18,7 +18,7 @@ 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.utilities.QVTbaseHelper;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionAssignment;
+import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
import org.eclipse.qvtd.pivot.qvtimperative.RealizedVariable;
@@ -34,11 +34,11 @@ public class QVTimperativeHelper extends QVTbaseHelper
super(environmentFactory);
}
- public @NonNull ConnectionAssignment createConnectionAssignment(@NonNull ConnectionVariable connectionVariable, @NonNull OCLExpression childrenExpression) {
- ConnectionAssignment connectionAssignment = QVTimperativeFactory.eINSTANCE.createConnectionAssignment();
- connectionAssignment.setTargetVariable(connectionVariable);
- connectionAssignment.setValue(childrenExpression);
- return connectionAssignment;
+ public @NonNull AddStatement createAddStatement(@NonNull ConnectionVariable connectionVariable, @NonNull OCLExpression childrenExpression) {
+ AddStatement addStatement = QVTimperativeFactory.eINSTANCE.createAddStatement();
+ addStatement.setTargetVariable(connectionVariable);
+ addStatement.setValue(childrenExpression);
+ return addStatement;
}
public @NonNull ConnectionVariable createConnectionVariable(@NonNull String name, @NonNull Type asType, @Nullable OCLExpression initExpression) {
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 75ede3489..99163534a 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
@@ -19,12 +19,11 @@ 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.ConnectionAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
@@ -57,6 +56,16 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
@Override
+ public Object visitAddStatement(@NonNull AddStatement asAddStatement) {
+ context.append("add ");
+ context.appendName(asAddStatement.getTargetVariable());
+ context.append(" += ");
+ safeVisit(asAddStatement.getValue());
+ context.append(";\n");
+ return null;
+ }
+
+ @Override
public Object visitAssignment(@NonNull Assignment object) {
return null;
}
@@ -93,24 +102,6 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
@Override
- public Object visitConnectionAssignment(@NonNull ConnectionAssignment asConnectionAssignment) {
- context.appendName(asConnectionAssignment.getTargetVariable());
- context.append(" += ");
- safeVisit(asConnectionAssignment.getValue());
- context.append(";\n");
- return null;
- }
-
- @Override
- public Object visitConnectionStatement(@NonNull ConnectionStatement asConnectionStatement) {
- context.appendName(asConnectionStatement.getTargetVariable());
- context.append(" += ");
- safeVisit(asConnectionStatement.getValue());
- context.append(";\n");
- return null;
- }
-
- @Override
public Object visitConnectionVariable(@NonNull ConnectionVariable object) {
return visitVariable(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 a9e7abd71..95b792946 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
@@ -17,16 +17,15 @@ import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.Variable;
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.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;
@@ -73,6 +72,15 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
+ public @Nullable String visitAddStatement(@NonNull AddStatement asAddStatement) {
+ append("add ");
+ appendName(asAddStatement.getTargetVariable());
+ append(" += ");
+ safeVisit(asAddStatement.getValue());
+ return null;
+ }
+
+ @Override
public String visitAssignment(@NonNull Assignment object) {
append("Assignment ");
// appendName(object);
@@ -92,22 +100,6 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
- public @Nullable String visitConnectionAssignment(@NonNull ConnectionAssignment connectionAssignment) {
- appendName(connectionAssignment.getTargetVariable());
- append(" += ");
- safeVisit(connectionAssignment.getValue());
- return null;
- }
-
- @Override
- public @Nullable String visitConnectionStatement(@NonNull ConnectionStatement asConnectionStatement) {
- appendName(asConnectionStatement.getTargetVariable());
- append(" += ");
- safeVisit(asConnectionStatement.getValue());
- return null;
- }
-
- @Override
public @Nullable String visitConnectionVariable(@NonNull ConnectionVariable object) {
return visitVariable(object);
}
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 94317c5ea..8b9ca352e 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
@@ -69,12 +69,11 @@ 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.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.ConnectionAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
@@ -367,6 +366,19 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
@Override
+ public ElementCS visitAddStatement(@NonNull AddStatement asAddStatement) {
+ ConnectionStatementCS csStatement = context.refreshElement(ConnectionStatementCS.class, QVTimperativeCSPackage.Literals.CONNECTION_STATEMENT_CS, asAddStatement);
+ csStatement.setPivot(asAddStatement);
+ Variable asVariable = asAddStatement.getTargetVariable();
+ if (asVariable != null) {
+ assert asVariable.eContainer().eContainer() instanceof Mapping;
+ csStatement.setTargetVariable(asVariable);
+ }
+ csStatement.setOwnedExpression(context.visitDeclaration(ExpCS.class, asAddStatement.getValue()));
+ return csStatement;
+ }
+
+ @Override
public ElementCS visitAssignment(@NonNull Assignment object) {
throw new UnsupportedOperationException();
}
@@ -400,34 +412,6 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
@Override
- public ElementCS visitConnectionAssignment(@NonNull ConnectionAssignment asConnectionAssignment) {
- PredicateOrAssignmentCS csAssignment = context.refreshElement(PredicateOrAssignmentCS.class, QVTimperativeCSPackage.Literals.PREDICATE_OR_ASSIGNMENT_CS, asConnectionAssignment);
- csAssignment.setPivot(asConnectionAssignment);
- Variable asVariable = asConnectionAssignment.getTargetVariable();
- if (asVariable != null) {
- assert asVariable.eContainer().eContainer() instanceof Mapping;
- csAssignment.setOwnedTarget(createNameExpCS(asVariable));
- csAssignment.setIsAccumulate(true);
- }
- csAssignment.setOwnedInitExpression(context.visitDeclaration(ExpCS.class, asConnectionAssignment.getValue()));
- assert !asConnectionAssignment.isIsDefault();
- return csAssignment;
- }
-
- @Override
- public ElementCS visitConnectionStatement(@NonNull ConnectionStatement asConnectionStatement) {
- ConnectionStatementCS csStatement = context.refreshElement(ConnectionStatementCS.class, QVTimperativeCSPackage.Literals.CONNECTION_STATEMENT_CS, asConnectionStatement);
- csStatement.setPivot(asConnectionStatement);
- Variable asVariable = asConnectionStatement.getTargetVariable();
- if (asVariable != null) {
- assert asVariable.eContainer().eContainer() instanceof Mapping;
- csStatement.setTargetVariable(asVariable);
- }
- csStatement.setOwnedExpression(context.visitDeclaration(ExpCS.class, asConnectionStatement.getValue()));
- return csStatement;
- }
-
- @Override
public ElementCS visitConnectionVariable(@NonNull ConnectionVariable object) {
return visitVariable(object);
}
@@ -799,7 +783,6 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
csAssignment.setOwnedTarget(createNameExpCS(asVariable));
}
csAssignment.setOwnedInitExpression(context.visitDeclaration(ExpCS.class, asVariableAssignment.getValue()));
- csAssignment.setIsDefault(asVariableAssignment.isIsDefault());
return csAssignment;
}
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 0604e4e29..c0cf72597 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
@@ -45,10 +45,9 @@ 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.ConnectionAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
@@ -77,9 +76,9 @@ 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.QueryCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.RealizedVariableCS;
+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;
@@ -225,7 +224,7 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
@Override
public @Nullable Continuation<?> visitConnectionStatementCS(@NonNull ConnectionStatementCS csElement) {
- context.refreshModelElement(ConnectionStatement.class, QVTimperativePackage.Literals.CONNECTION_STATEMENT, csElement);
+ context.refreshModelElement(AddStatement.class, QVTimperativePackage.Literals.ADD_STATEMENT, csElement);
return null;
}
@@ -349,12 +348,7 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
context.refreshModelElement(Predicate.class, QVTbasePackage.Literals.PREDICATE, csElement);
}
else if (csTarget instanceof NameExpCS) {
- if (csElement.isIsAccumulate()) {
- context.refreshModelElement(ConnectionAssignment.class, QVTimperativePackage.Literals.CONNECTION_ASSIGNMENT, csElement);
- }
- else {
- context.refreshModelElement(VariableAssignment.class, QVTimperativePackage.Literals.VARIABLE_ASSIGNMENT, csElement);
- }
+ context.refreshModelElement(VariableAssignment.class, QVTimperativePackage.Literals.VARIABLE_ASSIGNMENT, csElement);
}
else {
throw new IllegalStateException();
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 38b164cbb..3c97ffe63 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
@@ -33,10 +33,9 @@ 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.ConnectionAssignment;
-import org.eclipse.qvtd.pivot.qvtimperative.ConnectionStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
@@ -61,10 +60,10 @@ 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.QueryCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.RealizeableVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.RealizedVariableCS;
+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;
@@ -115,18 +114,11 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
} */
protected @Nullable Assignment refreshVariableAssignment(@NonNull VariableExp variableExp, @NonNull PredicateOrAssignmentCS csConstraint) {
- Assignment assignment = PivotUtil.getPivot(Assignment.class, csConstraint);
- if (assignment instanceof ConnectionAssignment) {
- ((ConnectionAssignment)assignment).setTargetVariable((ConnectionVariable) variableExp.getReferredVariable());
- return assignment;
- }
- else {
- VariableAssignment variableAssignment = PivotUtil.getPivot(VariableAssignment.class, csConstraint);
- if (variableAssignment != null) {
- variableAssignment.setTargetVariable((Variable) variableExp.getReferredVariable());
- }
- return variableAssignment;
+ VariableAssignment variableAssignment = PivotUtil.getPivot(VariableAssignment.class, csConstraint);
+ if (variableAssignment != null) {
+ variableAssignment.setTargetVariable((Variable) variableExp.getReferredVariable());
}
+ return variableAssignment;
}
@Override
@@ -143,7 +135,6 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
for (PredicateOrAssignmentCS csConstraint : csElement.getOwnedConstraints()) {
ExpCS csTarget = csConstraint.getOwnedTarget();
ExpCS csInitialiser = csConstraint.getOwnedInitExpression();
- boolean isDefault = csConstraint.isIsDefault();
OCLExpression target = csTarget != null ? context.visitLeft2Right(OCLExpression.class, csTarget) : null;
if (csInitialiser != null) {
Assignment assignment = null;
@@ -159,15 +150,11 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
}
if (assignment != null) {
OCLExpression initialiser = context.visitLeft2Right(OCLExpression.class, csInitialiser);
- assignment.setIsDefault(isDefault);
assignment.setValue(initialiser);
pAssignments.add(assignment);
}
}
else {
- if (isDefault) {
- context.addDiagnostic(csElement, "misplaced default ignored");
- }
Predicate predicate = PivotUtil.getPivot(Predicate.class, csConstraint);
if (predicate != null) {
predicate.setConditionExpression(target);
@@ -183,13 +170,13 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
@Override
public @Nullable Continuation<?> visitConnectionStatementCS(@NonNull ConnectionStatementCS csElement) {
- ConnectionStatement asConnectionStatement = PivotUtil.getPivot(ConnectionStatement.class, csElement);
- if (asConnectionStatement != null) {
- asConnectionStatement.setTargetVariable((ConnectionVariable) csElement.getTargetVariable());
+ AddStatement asAddStatement = PivotUtil.getPivot(AddStatement.class, csElement);
+ if (asAddStatement != null) {
+ asAddStatement.setTargetVariable((ConnectionVariable) csElement.getTargetVariable());
ExpCS csInitialiser = csElement.getOwnedExpression();
if (csInitialiser != null) {
OCLExpression initialiser = context.visitLeft2Right(OCLExpression.class, csInitialiser);
- asConnectionStatement.setValue(initialiser);
+ asAddStatement.setValue(initialiser);
}
}
return null;
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 f4e4ecdc6..2234f5a86 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
@@ -12,8 +12,8 @@ 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.ConnectionStatementCSElements;
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.ImportCSElements;
@@ -139,7 +139,7 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
}
protected void configurePredicateOrAssignmentCS(FormattingConfig c, PredicateOrAssignmentCSElements a) {
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_3());
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_2());
}
protected void configureQualifiedPackageCS(FormattingConfig c, QualifiedPackageCSElements a) {
@@ -216,8 +216,8 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
{
- ConnectionStatementCSElements a = f.getConnectionStatementCSAccess();
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_3());
+ AddStatementCSElements a = f.getAddStatementCSAccess();
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_4());
}
{
MappingCSElements a = f.getMappingCSAccess();
@@ -325,7 +325,7 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
}
{
PredicateOrAssignmentCSElements a = f.getPredicateOrAssignmentCSAccess();
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_3());
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_2());
}
{
RealizedVariableCSElements a = f.getRealizedVariableCSAccess();

Back to the top