Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-09-17 09:30:53 +0000
committerEd Willink2016-09-19 11:19:56 +0000
commit3a10a69ffa041fc7c61b86e4d54b73015587bbbd (patch)
tree79bbf1338cf0da27c58258f27948ed5a505b30c6 /plugins
parent28450c3b0c0dce0b146ffc0e55fda4e88cdadfe3 (diff)
downloadorg.eclipse.qvtd-3a10a69ffa041fc7c61b86e4d54b73015587bbbd.tar.gz
org.eclipse.qvtd-3a10a69ffa041fc7c61b86e4d54b73015587bbbd.tar.xz
org.eclipse.qvtd-3a10a69ffa041fc7c61b86e4d54b73015587bbbd.zip
[500369] Support ObservableStatements, eliminate QVTo Domains
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java72
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java5
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalyzer.java8
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java46
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java7
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java88
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java4
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java45
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java242
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java4
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java11
-rw-r--r--plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java52
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/AbstractQVTimperativeStepperVisitor.java5
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/stepper/QVTiStepperVisitor.java6
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java20
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/QVTimperativeDomainUsageAnalysis.java4
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java8
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/CoreDomainAttribution.java48
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/BasicQVTiExecutor.java6
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java36
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java9
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java18
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java133
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java2
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java6
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeHelper.java8
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java27
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java29
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeUtil.java79
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/CoreDomain.gifbin235 -> 0 bytes
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/labeling/QVTimperativeLabelProvider.java26
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/outline/QVTimperativeOutlineTreeProvider.java8
-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.java36
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java32
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java34
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java61
37 files changed, 502 insertions, 786 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 e4785c707..48ca5efe2 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
@@ -15,6 +15,7 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
@@ -47,6 +48,7 @@ import org.eclipse.ocl.pivot.CollectionType;
import org.eclipse.ocl.pivot.CompleteClass;
import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.Iteration;
+import org.eclipse.ocl.pivot.LanguageExpression;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.OperationCallExp;
@@ -101,8 +103,8 @@ import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
@@ -113,8 +115,8 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
@@ -123,7 +125,7 @@ import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiTransformationAnalysi
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
-public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisitor<CGNamedElement>
+public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisitor<@Nullable CGNamedElement>
{
public static class CGMappingCallBindingComparator implements Comparator<@NonNull CGMappingCallBinding>
{
@@ -552,13 +554,41 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
+ protected @Nullable CGValuedElement inlineOperationCall(@NonNull OperationCallExp callExp, @NonNull LanguageExpression specification) {
+ CGValuedElement cgInlineOperationCall = super.inlineOperationCall(callExp, specification);
+ if (cgInlineOperationCall != null) {
+ //
+ // We need to follow the path from an inlined property call to thge outer statement to mark the
+ // outer statement as observing the property. The OCL CG leaves the inline code as orphans, so
+ // add an adapter to workaround the broken containment path.
+ //
+ Element asInlineOperationCall = cgInlineOperationCall.getAst();
+ asInlineOperationCall.eAdapters().add(new InlinedBodyAdapter(callExp));
+ }
+ return cgInlineOperationCall;
+ }
+
+ public static class InlinedBodyAdapter extends AdapterImpl
+ {
+ protected final @NonNull OperationCallExp operationCallExp;
+
+ public InlinedBodyAdapter(@NonNull OperationCallExp operationCallExp) {
+ this.operationCallExp = operationCallExp;
+ }
+
+ public @NonNull OperationCallExp getOperationCallExp() {
+ return operationCallExp;
+ }
+ }
+
+ @Override
public @Nullable CGNamedElement visitAddStatement(@NonNull AddStatement asAddStatement) {
ConnectionVariable asVariable = asAddStatement.getTargetVariable();
if (asVariable == null) {
return null;
}
CGVariable cgVariable = getVariable(asVariable);
- OCLExpression asInitValue = asAddStatement.getOwnedInit();
+ OCLExpression asInitValue = asAddStatement.getOwnedExpression();
assert (cgVariable instanceof CGConnectionVariable) || (cgVariable instanceof CGAccumulator);
CGValuedElement initValue = doVisit(CGValuedElement.class, asInitValue);
CGConnectionAssignment cgConnectionAssignment = QVTiCGModelFactory.eINSTANCE.createCGConnectionAssignment();
@@ -579,7 +609,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
CGIfExp cgPredicate = CGModelFactory.eINSTANCE.createCGIfExp();
cgPredicate.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
cgPredicate.setRequired(true);
- OCLExpression asConditionExpression = asPredicate.getOwnedCondition();
+ OCLExpression asConditionExpression = asPredicate.getOwnedExpression();
assert asConditionExpression != null;
cgPredicate.setCondition(doVisit(CGValuedElement.class, asConditionExpression));
CGConstantExp cgElse = analyzer.createCGConstantExp(asConditionExpression, analyzer.getBoolean(false));
@@ -598,11 +628,11 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
@Override
public CGNamedElement visitDeclareStatement(@NonNull DeclareStatement asVariable) {
- OCLExpression asInit = asVariable.getOwnedInit();
+ OCLExpression asInit = asVariable.getOwnedExpression();
assert asInit != null;
if (!asVariable.isIsChecked()) {
/* CGVariable cgVariable = getVariable(asVariable);
- CGValuedElement initValue = doVisit(CGValuedElement.class, asVariable.getOwnedInit());
+ CGValuedElement initValue = doVisit(CGValuedElement.class, asVariable.getOwnedExpression());
cgVariable.setInit(initValue);
cgVariable.setTypeId(initValue.getTypeId());
cgVariable.setRequired(initValue.isRequired());
@@ -682,7 +712,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
return null;
}
CGVariable cgVariable = getVariable(asVariable);
- OCLExpression asInitValue = asCheckVariableStatement.getOwnedInit();
+ OCLExpression asInitValue = asCheckVariableStatement.getOwnedExpression();
assert !(cgVariable instanceof CGConnectionVariable);
CGValuedElement initValue = doVisit(CGValuedElement.class, asInitValue);
cgVariable.setInit(initValue);
@@ -690,7 +720,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
cgVariable.setRequired(initValue.isRequired());
return cgVariable; * /
VariableDeclaration asVariable = asCheckVariableStatement.getTargetVariable();
- OCLExpression asInit = asCheckVariableStatement.getOwnedInit();
+ OCLExpression asInit = asCheckVariableStatement.getOwnedExpression();
assert (asVariable != null) && (asInit != null);
getBodyBuilder().appendCheckedLetVariable(asVariable, asInit);
return null;
@@ -742,11 +772,6 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
- public @Nullable CGNamedElement visitImperativeDomain(@NonNull ImperativeDomain object) {
- return visiting(object);
- }
-
- @Override
public @Nullable CGNamedElement visitImperativeModel(@NonNull ImperativeModel object) {
return visiting(object);
}
@@ -833,7 +858,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
cgMappingLoop.getIterators().add(cgIterator);
}
}
- cgMappingLoop.setSource(doVisit(CGValuedElement.class, asMappingLoop.getOwnedSource()));
+ cgMappingLoop.setSource(doVisit(CGValuedElement.class, asMappingLoop.getOwnedExpression()));
// cgIterator.setNonInvalid();
// cgIterator.setNonNull();
cgMappingLoop.setAst(asMappingLoop);
@@ -857,7 +882,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
@Override
public @Nullable CGNamedElement visitNewStatement(@NonNull NewStatement asNewStatement) {
- OCLExpression asInit = asNewStatement.getOwnedInit();
+ OCLExpression asInit = asNewStatement.getOwnedExpression();
if (asInit == null) {
getBodyBuilder().addRealizedVariable(asNewStatement);
}
@@ -868,14 +893,19 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
@Override
+ public CGNamedElement visitObservableStatement(@NonNull ObservableStatement object) {
+ return visiting(object);
+ }
+
+ @Override
public @Nullable CGNamedElement visitOutConnectionVariable(@NonNull OutConnectionVariable asVariable) {
/* CGVariable cgVariable = getVariable(asConnectionVariable);
- CGValuedElement initValue = doVisit(CGValuedElement.class, asConnectionVariable.getOwnedInit());
+ CGValuedElement initValue = doVisit(CGValuedElement.class, asConnectionVariable.getOwnedExpression());
cgVariable.setInit(initValue);
cgVariable.setTypeId(initValue.getTypeId());
cgVariable.setRequired(initValue.isRequired());
return cgVariable; */
- OCLExpression asInit = asVariable.getOwnedInit();
+ OCLExpression asInit = asVariable.getOwnedExpression();
CGAccumulator cgAccumulator = CGModelFactory.eINSTANCE.createCGAccumulator();
cgAccumulator.setAst(asVariable);
cgAccumulator.setName(asVariable.getName());
@@ -927,7 +957,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
// cgPredicate.setName(asPredicate.getName());
cgPropertyAssignment.setTypeId(analyzer.getTypeId(TypeId.OCL_VOID));
// cgMappingCallBinding.setValueName(localnameasMappingCallBinding.getBoundVariable().getName());
- cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asSetStatement.getOwnedInit()));
+ cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asSetStatement.getOwnedExpression()));
EStructuralFeature eStructuralFeature = (EStructuralFeature) asProperty.getESObject();
if (eStructuralFeature != null) {
try {
@@ -983,7 +1013,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
// cgPredicate.setName(asPredicate.getName());
cgPropertyAssignment.setTypeId(analyzer.getTypeId(TypeId.OCL_VOID));
// cgMappingCallBinding.setValueName(localnameasMappingCallBinding.getBoundVariable().getName());
- cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asSetStatement.getOwnedInit()));
+ cgPropertyAssignment.setInitValue(doVisit(CGValuedElement.class, asSetStatement.getOwnedExpression()));
CGExecutorProperty cgExecutorProperty = analyzer.createExecutorProperty(asTargetProperty);
cgPropertyAssignment.setExecutorProperty(cgExecutorProperty);
@@ -1029,7 +1059,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
public @Nullable CGNamedElement visitVariable(@NonNull Variable object) {
return visiting(object); // Really should not be happening.
/* CGVariable cgVariable = getVariable(asVariable);
- CGValuedElement initValue = doVisit(CGValuedElement.class, asVariable.getOwnedInit());
+ CGValuedElement initValue = doVisit(CGValuedElement.class, asVariable.getOwnedExpression());
cgVariable.setInit(initValue);
cgVariable.setTypeId(initValue.getTypeId());
cgVariable.setRequired(initValue.isRequired());
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java
index 63c657d70..c640f2003 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalysisVisitor.java
@@ -4,13 +4,14 @@
* 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.codegen.qvti.analyzer;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.analyzer.AnalysisVisitor;
import org.eclipse.ocl.examples.codegen.generator.GlobalContext;
import org.eclipse.ocl.examples.codegen.generator.LocalContext;
@@ -39,7 +40,7 @@ import org.eclipse.qvtd.codegen.qvticgmodel.CGTypedModel;
import org.eclipse.qvtd.codegen.qvticgmodel.util.QVTiCGModelVisitor;
import org.eclipse.qvtd.pivot.qvtbase.Function;
-public class QVTiAnalysisVisitor extends AnalysisVisitor implements QVTiCGModelVisitor<Object>
+public class QVTiAnalysisVisitor extends AnalysisVisitor implements QVTiCGModelVisitor<@Nullable Object>
{
public QVTiAnalysisVisitor(@NonNull QVTiAnalyzer analyzer) {
super(analyzer);
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalyzer.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalyzer.java
index f230fbe43..6c6d677c2 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalyzer.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAnalyzer.java
@@ -4,7 +4,7 @@
* 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
*******************************************************************************/
@@ -29,9 +29,9 @@ import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
public class QVTiAnalyzer extends CodeGenAnalyzer
{
- private final @NonNull Map<Function, CGFunction> cgFunctions = new HashMap<Function, CGFunction>();
- private final @NonNull Map<Mapping, CGMapping> cgMappings = new HashMap<Mapping, CGMapping>();
- private final @NonNull Map<TypedModel, CGTypedModel> cgTypedModels = new HashMap<TypedModel, CGTypedModel>();
+ private final @NonNull Map<@NonNull Function, @NonNull CGFunction> cgFunctions = new HashMap<>();
+ private final @NonNull Map<@NonNull Mapping, @NonNull CGMapping> cgMappings = new HashMap<>();
+ private final @NonNull Map<@NonNull TypedModel, @NonNull CGTypedModel> cgTypedModels = new HashMap<>();
public QVTiAnalyzer(@NonNull QVTiCodeGenerator codeGenerator) {
super(codeGenerator);
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java
index d96300930..d458d7e21 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiBoxingAnalyzer.java
@@ -46,7 +46,7 @@ import org.eclipse.qvtd.codegen.qvticgmodel.util.QVTiCGModelVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
-public class QVTiBoxingAnalyzer extends BoxingAnalyzer implements QVTiCGModelVisitor<Object>
+public class QVTiBoxingAnalyzer extends BoxingAnalyzer implements QVTiCGModelVisitor<@Nullable Object>
{
public QVTiBoxingAnalyzer(@NonNull QVTiAnalyzer analyzer) {
super(analyzer);
@@ -61,17 +61,17 @@ public class QVTiBoxingAnalyzer extends BoxingAnalyzer implements QVTiCGModelVis
}
@Override
- public Object visitCGConnectionAssignment(@NonNull CGConnectionAssignment object) {
+ public @Nullable Object visitCGConnectionAssignment(@NonNull CGConnectionAssignment object) {
return visitCGValuedElement(object);
}
@Override
- public Object visitCGConnectionVariable(@NonNull CGConnectionVariable object) {
+ public @Nullable Object visitCGConnectionVariable(@NonNull CGConnectionVariable object) {
return visitCGGuardVariable(object);
}
@Override
- public Object visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment cgEcoreContainerAssignment) {
+ public @Nullable Object visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment cgEcoreContainerAssignment) {
EStructuralFeature eStructuralFeature = cgEcoreContainerAssignment.getEStructuralFeature();
boolean isRequired = eStructuralFeature.isRequired();
rewriteAsEcore(cgEcoreContainerAssignment.getSlotValue(), eStructuralFeature.getEType());
@@ -83,7 +83,7 @@ public class QVTiBoxingAnalyzer extends BoxingAnalyzer implements QVTiCGModelVis
}
@Override
- public Object visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment cgEcorePropertyAssignment) {
+ public @Nullable Object visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment cgEcorePropertyAssignment) {
EStructuralFeature eStructuralFeature = cgEcorePropertyAssignment.getEStructuralFeature();
rewriteAsEcore(cgEcorePropertyAssignment.getSlotValue(), eStructuralFeature.getEContainingClass());
rewriteAsEcore(cgEcorePropertyAssignment.getInitValue(), eStructuralFeature.getEType());
@@ -98,20 +98,20 @@ public class QVTiBoxingAnalyzer extends BoxingAnalyzer implements QVTiCGModelVis
}
@Override
- public Object visitCGEcoreRealizedVariable(@NonNull CGEcoreRealizedVariable cgEcoreRealizedVariable) {
+ public @Nullable Object visitCGEcoreRealizedVariable(@NonNull CGEcoreRealizedVariable cgEcoreRealizedVariable) {
rewriteAsAssertNonNulled(cgEcoreRealizedVariable);
return visitCGRealizedVariable(cgEcoreRealizedVariable);
}
@Override
- public Object visitCGFunction(@NonNull CGFunction cgFunction) {
+ public @Nullable Object visitCGFunction(@NonNull CGFunction cgFunction) {
visitCGOperation(cgFunction);
rewriteAsUnboxed(cgFunction.getBody());
return null;
}
@Override
- public Object visitCGFunctionCallExp(@NonNull CGFunctionCallExp cgFunctionCallExp) {
+ public @Nullable Object visitCGFunctionCallExp(@NonNull CGFunctionCallExp cgFunctionCallExp) {
visitCGOperationCallExp(cgFunctionCallExp);
for (CGValuedElement cgArgument : cgFunctionCallExp.getArguments()) {
rewriteAsUnboxed(cgArgument);
@@ -120,27 +120,27 @@ public class QVTiBoxingAnalyzer extends BoxingAnalyzer implements QVTiCGModelVis
}
@Override
- public Object visitCGFunctionParameter(@NonNull CGFunctionParameter object) {
+ public @Nullable Object visitCGFunctionParameter(@NonNull CGFunctionParameter object) {
return visitCGParameter(object);
}
@Override
- public Object visitCGGuardVariable(@NonNull CGGuardVariable object) {
+ public @Nullable Object visitCGGuardVariable(@NonNull CGGuardVariable object) {
return visitCGParameter(object);
}
@Override
- public Object visitCGMapping(@NonNull CGMapping cgMapping) {
+ public @Nullable Object visitCGMapping(@NonNull CGMapping cgMapping) {
return visitCGNamedElement(cgMapping);
}
@Override
- public Object visitCGMappingCall(@NonNull CGMappingCall cgMappingCall) {
+ public @Nullable Object visitCGMappingCall(@NonNull CGMappingCall cgMappingCall) {
return visitCGValuedElement(cgMappingCall);
}
@Override
- public Object visitCGMappingCallBinding(@NonNull CGMappingCallBinding cgMappingCallBinding) {
+ public @Nullable Object visitCGMappingCallBinding(@NonNull CGMappingCallBinding cgMappingCallBinding) {
MappingCallBinding mappingCallBinding = (MappingCallBinding)cgMappingCallBinding.getAst();
VariableDeclaration boundVariable = mappingCallBinding.getBoundVariable();
assert boundVariable != null;
@@ -157,56 +157,56 @@ public class QVTiBoxingAnalyzer extends BoxingAnalyzer implements QVTiCGModelVis
}
@Override
- public Object visitCGMappingExp(@NonNull CGMappingExp object) {
+ public @Nullable Object visitCGMappingExp(@NonNull CGMappingExp object) {
return visitCGValuedElement(object);
}
@Override
- public Object visitCGMappingLoop(@NonNull CGMappingLoop cgMappingLoop) {
+ public @Nullable Object visitCGMappingLoop(@NonNull CGMappingLoop cgMappingLoop) {
visitCGIterationCallExp(cgMappingLoop);
// rewriteAsUnboxed(cgMappingLoop.getSource());
return null;
}
@Override
- public Object visitCGMiddlePropertyAssignment(@NonNull CGMiddlePropertyAssignment cgMiddlePropertyAssignment) {
+ public @Nullable Object visitCGMiddlePropertyAssignment(@NonNull CGMiddlePropertyAssignment cgMiddlePropertyAssignment) {
rewriteAsUnboxed(cgMiddlePropertyAssignment.getSlotValue());
rewriteAsUnboxed(cgMiddlePropertyAssignment.getInitValue());
return visitCGPropertyAssignment(cgMiddlePropertyAssignment);
}
@Override
- public Object visitCGMiddlePropertyCallExp(@NonNull CGMiddlePropertyCallExp object) {
+ public @Nullable Object visitCGMiddlePropertyCallExp(@NonNull CGMiddlePropertyCallExp object) {
return visitCGOppositePropertyCallExp(object);
}
@Override
- public Object visitCGPropertyAssignment(@NonNull CGPropertyAssignment cgPropertyAssignment) {
+ public @Nullable Object visitCGPropertyAssignment(@NonNull CGPropertyAssignment cgPropertyAssignment) {
return visitCGValuedElement(cgPropertyAssignment);
}
@Override
- public Object visitCGRealizedVariable(@NonNull CGRealizedVariable cgRealizedVariable) {
+ public @Nullable Object visitCGRealizedVariable(@NonNull CGRealizedVariable cgRealizedVariable) {
return visitCGVariable(cgRealizedVariable);
}
@Override
- public Object visitCGSequence(@NonNull CGSequence object) {
+ public @Nullable Object visitCGSequence(@NonNull CGSequence object) {
return visitCGValuedElement(object);
}
@Override
- public Object visitCGTransformation(@NonNull CGTransformation cgTransformation) {
+ public @Nullable Object visitCGTransformation(@NonNull CGTransformation cgTransformation) {
return visitCGClass(cgTransformation);
}
@Override
- public Object visitCGTypedModel(@NonNull CGTypedModel object) {
+ public @Nullable Object visitCGTypedModel(@NonNull CGTypedModel object) {
return visitCGNamedElement(object);
}
@Override
- public Object visitCGVariable(@NonNull CGVariable object) {
+ public @Nullable Object visitCGVariable(@NonNull CGVariable object) {
Object visitCGVariable = super.visitCGVariable(object);
Element asElement = object.getAst();
if ((asElement instanceof TypedElement) && ((TypedElement)asElement).isIsRequired()) {
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java
index 08ddcc4cd..aed795939 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiDependencyVisitor.java
@@ -4,13 +4,14 @@
* 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.codegen.qvti.analyzer;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.cse.GlobalPlace;
import org.eclipse.ocl.examples.codegen.java.JavaDependencyVisitor;
import org.eclipse.qvtd.codegen.qvti.java.QVTiGlobalContext;
@@ -37,8 +38,8 @@ import org.eclipse.qvtd.codegen.qvticgmodel.CGTransformation;
import org.eclipse.qvtd.codegen.qvticgmodel.CGTypedModel;
import org.eclipse.qvtd.codegen.qvticgmodel.util.QVTiCGModelVisitor;
-public class QVTiDependencyVisitor extends JavaDependencyVisitor implements QVTiCGModelVisitor<Object>
-{
+public class QVTiDependencyVisitor extends JavaDependencyVisitor implements QVTiCGModelVisitor<@Nullable Object>
+{
public QVTiDependencyVisitor(@NonNull QVTiAnalyzer analyzer, @NonNull QVTiGlobalContext globalContext, @NonNull GlobalPlace globalPlace) {
super(analyzer, globalContext, globalPlace);
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java
index 240694aec..951844c94 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiFieldingAnalyzer.java
@@ -42,191 +42,191 @@ import org.eclipse.qvtd.codegen.qvticgmodel.util.QVTiCGModelVisitor;
public class QVTiFieldingAnalyzer extends FieldingAnalyzer
{
- public static class QVTiAnalysisVisitor extends AnalysisVisitor implements QVTiCGModelVisitor<Set<CGVariable>>
+ public static class QVTiAnalysisVisitor extends AnalysisVisitor implements QVTiCGModelVisitor<@Nullable Set<@NonNull CGVariable>>
{
public QVTiAnalysisVisitor(@NonNull QVTiFieldingAnalyzer context) {
super(context);
}
@Override
- public @Nullable Set<CGVariable> visitCGConnectionAssignment(@NonNull CGConnectionAssignment object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGConnectionAssignment(@NonNull CGConnectionAssignment object) {
return visitCGValuedElement(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGConnectionVariable(@NonNull CGConnectionVariable object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGConnectionVariable(@NonNull CGConnectionVariable object) {
return visitCGGuardVariable(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
return visitCGPropertyAssignment(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGEcoreRealizedVariable(@NonNull CGEcoreRealizedVariable object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGEcoreRealizedVariable(@NonNull CGEcoreRealizedVariable object) {
return visitCGRealizedVariable(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGFunction(@NonNull CGFunction object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGFunction(@NonNull CGFunction object) {
return visitCGOperation(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGFunctionCallExp(@NonNull CGFunctionCallExp object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGFunctionCallExp(@NonNull CGFunctionCallExp object) {
return visitCGOperationCallExp(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGFunctionParameter(@NonNull CGFunctionParameter object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGFunctionParameter(@NonNull CGFunctionParameter object) {
return visitCGParameter(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGGuardVariable(@NonNull CGGuardVariable object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGGuardVariable(@NonNull CGGuardVariable object) {
return visitCGParameter(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGMapping(@NonNull CGMapping object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGMapping(@NonNull CGMapping object) {
return visitCGNamedElement(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGMappingCall(@NonNull CGMappingCall object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGMappingCall(@NonNull CGMappingCall object) {
return visitCGValuedElement(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGMappingCallBinding(@NonNull CGMappingCallBinding object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGMappingCallBinding(@NonNull CGMappingCallBinding object) {
return visitCGValuedElement(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGMappingExp(@NonNull CGMappingExp object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGMappingExp(@NonNull CGMappingExp object) {
return visitCGValuedElement(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGMappingLoop(@NonNull CGMappingLoop object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGMappingLoop(@NonNull CGMappingLoop object) {
return visitCGIterationCallExp(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGMiddlePropertyAssignment(@NonNull CGMiddlePropertyAssignment object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGMiddlePropertyAssignment(@NonNull CGMiddlePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGMiddlePropertyCallExp(@NonNull CGMiddlePropertyCallExp object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGMiddlePropertyCallExp(@NonNull CGMiddlePropertyCallExp object) {
return visitCGOppositePropertyCallExp(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGPropertyAssignment(@NonNull CGPropertyAssignment object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGPropertyAssignment(@NonNull CGPropertyAssignment object) {
return visitCGValuedElement(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGRealizedVariable(@NonNull CGRealizedVariable object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGRealizedVariable(@NonNull CGRealizedVariable object) {
return visitCGVariable(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGSequence(@NonNull CGSequence object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGSequence(@NonNull CGSequence object) {
return visitCGValuedElement(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGTransformation(@NonNull CGTransformation object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGTransformation(@NonNull CGTransformation object) {
return visitCGClass(object);
}
@Override
- public @Nullable Set<CGVariable> visitCGTypedModel(@NonNull CGTypedModel object) {
+ public @Nullable Set<@NonNull CGVariable> visitCGTypedModel(@NonNull CGTypedModel object) {
return visitCGNamedElement(object);
}
}
- public static class QVTiRewriteVisitor extends RewriteVisitor implements QVTiCGModelVisitor<Boolean>
+ public static class QVTiRewriteVisitor extends RewriteVisitor implements QVTiCGModelVisitor<@NonNull Boolean>
{
public QVTiRewriteVisitor(@NonNull QVTiAnalyzer context, @NonNull Set<@NonNull CGVariable> caughtVariables) {
super(context, caughtVariables);
}
@Override
- public Boolean visitCGConnectionAssignment(@NonNull CGConnectionAssignment object) {
+ public @NonNull Boolean visitCGConnectionAssignment(@NonNull CGConnectionAssignment object) {
return visitCGValuedElement(object);
}
@Override
- public Boolean visitCGConnectionVariable(@NonNull CGConnectionVariable object) {
+ public @NonNull Boolean visitCGConnectionVariable(@NonNull CGConnectionVariable object) {
return visitCGGuardVariable(object);
}
@Override
- public Boolean visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
+ public @NonNull Boolean visitCGEcoreContainerAssignment(@NonNull CGEcoreContainerAssignment object) {
return visitCGPropertyAssignment(object);
}
@Override
- public Boolean visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
+ public @NonNull Boolean visitCGEcorePropertyAssignment(@NonNull CGEcorePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
@Override
- public Boolean visitCGEcoreRealizedVariable(@NonNull CGEcoreRealizedVariable object) {
+ public @NonNull Boolean visitCGEcoreRealizedVariable(@NonNull CGEcoreRealizedVariable object) {
return visitCGRealizedVariable(object);
}
@Override
- public Boolean visitCGFunction(@NonNull CGFunction object) {
+ public @NonNull Boolean visitCGFunction(@NonNull CGFunction object) {
return visitCGOperation(object);
}
@Override
- public Boolean visitCGFunctionCallExp(@NonNull CGFunctionCallExp object) {
+ public @NonNull Boolean visitCGFunctionCallExp(@NonNull CGFunctionCallExp object) {
return visitCGOperationCallExp(object);
}
@Override
- public Boolean visitCGFunctionParameter(@NonNull CGFunctionParameter object) {
+ public @NonNull Boolean visitCGFunctionParameter(@NonNull CGFunctionParameter object) {
return visitCGParameter(object);
}
@Override
- public Boolean visitCGGuardVariable(@NonNull CGGuardVariable object) {
+ public @NonNull Boolean visitCGGuardVariable(@NonNull CGGuardVariable object) {
return visitCGParameter(object);
}
@Override
- public Boolean visitCGMapping(@NonNull CGMapping object) {
+ public @NonNull Boolean visitCGMapping(@NonNull CGMapping object) {
return visitCGNamedElement(object);
}
@Override
- public Boolean visitCGMappingCall(@NonNull CGMappingCall object) {
+ public @NonNull Boolean visitCGMappingCall(@NonNull CGMappingCall object) {
return visitCGValuedElement(object);
}
@Override
- public Boolean visitCGMappingCallBinding(@NonNull CGMappingCallBinding object) {
+ public @NonNull Boolean visitCGMappingCallBinding(@NonNull CGMappingCallBinding object) {
return visitCGValuedElement(object);
}
@Override
- public Boolean visitCGMappingExp(@NonNull CGMappingExp object) {
+ public @NonNull Boolean visitCGMappingExp(@NonNull CGMappingExp object) {
return visitCGValuedElement(object);
}
@Override
- public Boolean visitCGMappingLoop(@NonNull CGMappingLoop cgElement) {
+ public @NonNull Boolean visitCGMappingLoop(@NonNull CGMappingLoop cgElement) {
// return visitCGIterationCallExp(object);
rewriteAsThrown(cgElement.getSource());
for (CGIterator cgIterator : cgElement.getIterators()) {
@@ -243,37 +243,37 @@ public class QVTiFieldingAnalyzer extends FieldingAnalyzer
}
@Override
- public Boolean visitCGMiddlePropertyAssignment(@NonNull CGMiddlePropertyAssignment object) {
+ public @NonNull Boolean visitCGMiddlePropertyAssignment(@NonNull CGMiddlePropertyAssignment object) {
return visitCGPropertyAssignment(object);
}
@Override
- public Boolean visitCGMiddlePropertyCallExp(@NonNull CGMiddlePropertyCallExp object) {
+ public @NonNull Boolean visitCGMiddlePropertyCallExp(@NonNull CGMiddlePropertyCallExp object) {
return visitCGOppositePropertyCallExp(object);
}
@Override
- public Boolean visitCGPropertyAssignment(@NonNull CGPropertyAssignment object) {
+ public @NonNull Boolean visitCGPropertyAssignment(@NonNull CGPropertyAssignment object) {
return visitCGValuedElement(object);
}
@Override
- public Boolean visitCGRealizedVariable(@NonNull CGRealizedVariable object) {
+ public @NonNull Boolean visitCGRealizedVariable(@NonNull CGRealizedVariable object) {
return visitCGVariable(object);
}
@Override
- public Boolean visitCGSequence(@NonNull CGSequence object) {
+ public @NonNull Boolean visitCGSequence(@NonNull CGSequence object) {
return visitCGValuedElement(object);
}
@Override
- public Boolean visitCGTransformation(@NonNull CGTransformation object) {
+ public @NonNull Boolean visitCGTransformation(@NonNull CGTransformation object) {
return visitCGClass(object);
}
@Override
- public Boolean visitCGTypedModel(@NonNull CGTypedModel object) {
+ public @NonNull Boolean visitCGTypedModel(@NonNull CGTypedModel object) {
return visitCGNamedElement(object);
}
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java
index 26d7fdca6..8765ff1fe 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaPreVisitor.java
@@ -4,7 +4,7 @@
* 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
*******************************************************************************/
@@ -36,7 +36,7 @@ import org.eclipse.qvtd.codegen.qvticgmodel.CGTransformation;
import org.eclipse.qvtd.codegen.qvticgmodel.CGTypedModel;
import org.eclipse.qvtd.codegen.qvticgmodel.util.QVTiCGModelVisitor;
-public class QVTiCG2JavaPreVisitor extends CG2JavaPreVisitor implements QVTiCGModelVisitor<Object>
+public class QVTiCG2JavaPreVisitor extends CG2JavaPreVisitor implements QVTiCGModelVisitor<@Nullable Object>
{
public QVTiCG2JavaPreVisitor(@NonNull QVTiGlobalContext javaContext) {
super(javaContext);
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
index 393e8b220..bf1b3f71c 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
@@ -19,6 +19,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
@@ -70,7 +71,9 @@ import org.eclipse.ocl.pivot.library.oclany.OclElementOclContainerProperty;
import org.eclipse.ocl.pivot.oclstdlib.OCLstdlibPackage;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.NameUtil;
+import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.ocl.pivot.utilities.ValueUtil;
+import org.eclipse.qvtd.codegen.qvti.analyzer.QVTiAS2CGVisitor;
import org.eclipse.qvtd.codegen.qvti.analyzer.QVTiAnalyzer;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionAssignment;
import org.eclipse.qvtd.codegen.qvticgmodel.CGConnectionVariable;
@@ -95,15 +98,14 @@ import org.eclipse.qvtd.codegen.qvticgmodel.CGTransformation;
import org.eclipse.qvtd.codegen.qvticgmodel.CGTypedModel;
import org.eclipse.qvtd.codegen.qvticgmodel.util.QVTiCGModelVisitor;
import org.eclipse.qvtd.codegen.utilities.QVTiCGUtil;
-import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiTransformationAnalysis;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
@@ -778,7 +780,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
CGValuedElement source = getExpression(cgPropertyCallExp.getSource());
boolean isHazardous = false;
if ((asMapping != null) && (asPropertyCallExp instanceof NavigationCallExp)) {
- isHazardous = transformationAnalysis.isHazardousRead(asMapping, (NavigationCallExp)asPropertyCallExp);
+ isHazardous = isHazardous2((NavigationCallExp) asPropertyCallExp);
}
if (isHazardous) {
EPackage ePackage = ClassUtil.nonNullModel(eStructuralFeature.getEContainingClass().getEPackage());
@@ -795,6 +797,30 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
}
}
+ private boolean isHazardous2(@NonNull NavigationCallExp asNavigationCallExp) {
+ for (EObject eObject = asNavigationCallExp; eObject != null; eObject = getContainer(eObject)) {
+ if (eObject instanceof ObservableStatement) {
+ List<Property> observedProperties = ((ObservableStatement)eObject).getObservedProperties();
+ Property navigatedProperty = PivotUtil.getReferredProperty(asNavigationCallExp);
+ return observedProperties.contains(navigatedProperty);
+ }
+ }
+ return false;
+ }
+
+ private EObject getContainer(EObject eObject) {
+ EObject eContainer = eObject.eContainer();
+ if (eContainer != null) {
+ return eContainer;
+ }
+ for (Adapter eAdapter : eObject.eAdapters()) {
+ if (eAdapter instanceof QVTiAS2CGVisitor.InlinedBodyAdapter) {
+ return ((QVTiAS2CGVisitor.InlinedBodyAdapter)eAdapter).getOperationCallExp();
+ }
+ }
+ return null;
+ }
+
protected void doGot(@NonNull CGNavigationCallExp cgPropertyCallExp, @NonNull CGValuedElement source, @NonNull EStructuralFeature eStructuralFeature) {
if (useGot) {
EPackage ePackage = ClassUtil.nonNullModel(eStructuralFeature.getEContainingClass().getEPackage());
@@ -1157,18 +1183,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
return true;
}
Mapping asMapping = ClassUtil.nonNullState((Mapping) cgMapping.getAst());
- boolean isHazardous = false;
- if (asMapping.getCheckedProperties().size() > 0) {
- isHazardous = true;
- }
- for (Domain domain : asMapping.getDomain()) {
- if (((ImperativeDomain)domain).getCheckedProperties().size() > 0) {
- isHazardous = true;
- break;
- }
- }
- assert isHazardous == transformationAnalysis.isHazardous(asMapping);
- return isHazardous;
+ return QVTimperativeUtil.isObserver(asMapping);
}
@Override
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 356647735..b5d7b0dd9 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
@@ -26,15 +26,12 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.ocl.pivot.AnyType;
import org.eclipse.ocl.pivot.CollectionItem;
import org.eclipse.ocl.pivot.CollectionLiteralExp;
import org.eclipse.ocl.pivot.CollectionLiteralPart;
import org.eclipse.ocl.pivot.CollectionRange;
import org.eclipse.ocl.pivot.CollectionType;
-import org.eclipse.ocl.pivot.DataType;
import org.eclipse.ocl.pivot.IfExp;
-import org.eclipse.ocl.pivot.InvalidType;
import org.eclipse.ocl.pivot.IterateExp;
import org.eclipse.ocl.pivot.Iteration;
import org.eclipse.ocl.pivot.IteratorExp;
@@ -42,13 +39,12 @@ import org.eclipse.ocl.pivot.LetExp;
import org.eclipse.ocl.pivot.MapLiteralExp;
import org.eclipse.ocl.pivot.MapLiteralPart;
import org.eclipse.ocl.pivot.MapType;
+import org.eclipse.ocl.pivot.NavigationCallExp;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.OperationCallExp;
-import org.eclipse.ocl.pivot.OppositePropertyCallExp;
import org.eclipse.ocl.pivot.PrimitiveLiteralExp;
import org.eclipse.ocl.pivot.Property;
-import org.eclipse.ocl.pivot.PropertyCallExp;
import org.eclipse.ocl.pivot.ShadowExp;
import org.eclipse.ocl.pivot.ShadowPart;
import org.eclipse.ocl.pivot.StandardLibrary;
@@ -61,12 +57,12 @@ import org.eclipse.ocl.pivot.TypedElement;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.VariableExp;
-import org.eclipse.ocl.pivot.VoidType;
import org.eclipse.ocl.pivot.internal.manager.PivotMetamodelManager;
import org.eclipse.ocl.pivot.util.Visitable;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.NameUtil;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
+import org.eclipse.ocl.pivot.utilities.TreeIterable;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.ClassDatumAnalysis;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Edge;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.EdgeRole;
@@ -76,7 +72,6 @@ import org.eclipse.qvtd.compiler.internal.qvtp2qvts.NodeConnection;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.Region;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.RegionUtil;
import org.eclipse.qvtd.compiler.internal.qvtp2qvts.SchedulerConstants;
-import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Function;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
@@ -84,18 +79,17 @@ import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
-import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.util.AbstractExtendingQVTimperativeVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.StatementComparator;
@@ -109,11 +103,24 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
protected final @NonNull Set<@NonNull Node> multiAccessedNodes = new HashSet<>();
protected final @NonNull Set<@NonNull Node> conditionalNodes = new HashSet<>();
+ private /*@LazyNonNull*/ ExpressionCreator inlineExpressionCreator = null;
+ // private /*@LazyNonNull*/ List<@NonNull Property> navigations = null;
+
public ExpressionCreator() {
super(BasicRegion2Mapping.this);
analyzeExpressions(multiAccessedNodes, conditionalNodes);
}
+ protected void addNavigation(@NonNull Property asProperty) {
+ // not used since nested expressions cached in local variables are not suppressed
+ /* if (navigations == null) {
+ navigations = new ArrayList<>();
+ }
+ if (!navigations.contains(asProperty)) {
+ navigations.add(asProperty);
+ } */
+ }
+
/**
* Compute the nodes that are only evaluated if a run-time if-condition is satisfied, and the nodes that are always accessed more than once.
*/
@@ -183,6 +190,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
return initExpression;
}
theVariable = createBottomVariable(node, initExpression);
+
}
return PivotUtil.createVariableExp(theVariable);
}
@@ -255,7 +263,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
if (node.isOperation()) {
Iterable<@NonNull TypedElement> typedElements = node.getTypedElements();
assert Iterables.size(typedElements) >= 1;
- return typedElements.iterator().next().accept(inlineExpressionCreator);
+ return typedElements.iterator().next().accept(getInlineExpressionCreator());
}
for (@NonNull Edge edge : node.getArgumentEdges()) {
@@ -297,6 +305,14 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
return null;
}
+ public @NonNull ExpressionCreator getInlineExpressionCreator() {
+ ExpressionCreator inlineExpressionCreator2 = inlineExpressionCreator ;
+ if (inlineExpressionCreator2 == null) {
+ inlineExpressionCreator = inlineExpressionCreator2 = new InlineExpressionCreator(this);
+ }
+ return inlineExpressionCreator2;
+ }
+
private boolean hasRealizedVariableReference(@NonNull OCLExpression oclExpression) {
for (TreeIterator<EObject> tit = oclExpression.eAllContents(); tit.hasNext(); ) {
EObject eObject = tit.next();
@@ -348,6 +364,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
@Override
public @NonNull OCLExpression visitIfExp(@NonNull IfExp pIfExp) {
PivotMetamodelManager metamodelManager = visitor.getMetamodelManager();
+ ExpressionCreator inlineExpressionCreator = getInlineExpressionCreator();
return metamodelManager.createIfExp(createNonNull(pIfExp.getOwnedCondition()),
inlineExpressionCreator.createNonNull(pIfExp.getOwnedThen()),
inlineExpressionCreator.createNonNull(pIfExp.getOwnedElse()));
@@ -361,7 +378,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
Variable result = createVariable(ClassUtil.nonNull(pIterateExp.getOwnedResult()));
Iteration referredIteration = (Iteration) visitor.create(pIterateExp.getReferredIteration());
assert referredIteration != null;
- OCLExpression iBody = inlineExpressionCreator.create(pIterateExp.getOwnedBody());
+ OCLExpression iBody = getInlineExpressionCreator().create(pIterateExp.getOwnedBody());
assert iBody != null;
return helper.createIterateExp(iSource, referredIteration, iIterators, result, iBody);
}
@@ -373,7 +390,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
List<@NonNull ? extends Variable> iIterators = createVariables(ClassUtil.nullFree(pIteratorExp.getOwnedIterators()));
Iteration referredIteration = (Iteration) visitor.create(pIteratorExp.getReferredIteration());
assert referredIteration != null;
- OCLExpression iBody = inlineExpressionCreator.create(pIteratorExp.getOwnedBody());
+ OCLExpression iBody = getInlineExpressionCreator().create(pIteratorExp.getOwnedBody());
assert iBody != null;
return helper.createIteratorExp(iSource, referredIteration, iIterators, iBody);
}
@@ -415,13 +432,11 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
}
@Override
- public @NonNull OCLExpression visitOppositePropertyCallExp(@NonNull OppositePropertyCallExp pOppositePropertyCallExp) {
- OCLExpression iSource = createNonNull(pOppositePropertyCallExp.getOwnedSource());
- Property referredProperty = pOppositePropertyCallExp.getReferredProperty();
- assert referredProperty != null;
- Property oppositeProperty = referredProperty.getOpposite();
- assert oppositeProperty != null;
- return PivotUtil.createNavigationCallExp(iSource, oppositeProperty);
+ public @NonNull OCLExpression visitNavigationCallExp(@NonNull NavigationCallExp pNavigationCallExp) {
+ OCLExpression iSource = createNonNull(pNavigationCallExp.getOwnedSource());
+ Property referredProperty = PivotUtil.getReferredProperty(pNavigationCallExp);
+ addNavigation(referredProperty);
+ return helper.createNavigationCallExp(iSource, referredProperty);
}
@Override
@@ -430,15 +445,6 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
}
@Override
- public @NonNull OCLExpression visitPropertyCallExp(@NonNull PropertyCallExp pPropertyCallExp) {
- OCLExpression iSource = createNonNull(pPropertyCallExp.getOwnedSource());
- Property referredProperty = pPropertyCallExp.getReferredProperty();
- assert referredProperty != null;
- assert referredProperty.eContainer() != null;
- return helper.createNavigationCallExp(iSource, referredProperty);
- }
-
- @Override
public @NonNull OCLExpression visitShadowExp(@NonNull ShadowExp pShadowExp) {
List<@NonNull ShadowPart> clonedParts = new ArrayList<>();
for (@NonNull ShadowPart pPart : ClassUtil.nullFree(pShadowExp.getOwnedParts())) {
@@ -519,6 +525,17 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
private class InlineExpressionCreator extends ExpressionCreator
{
+ protected final @NonNull ExpressionCreator expressionCreator;
+
+ private InlineExpressionCreator(@NonNull ExpressionCreator expressionCreator) {
+ this.expressionCreator = expressionCreator;
+ }
+
+ @Override
+ protected void addNavigation(@NonNull Property asProperty) {
+ expressionCreator.addNavigation(asProperty);
+ }
+
@Override
public @NonNull OCLExpression create(/*@NonNull*/ Node node) {
if (node.isExplicitNull()) {
@@ -560,27 +577,21 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
*/
private final @NonNull Map<@NonNull Node, @NonNull VariableDeclaration> node2variable = new HashMap<>();
- /**
- * Mapping from the TypedModel to its ImperativeDomain.
- */
- private final @NonNull Map<@NonNull ImperativeTypedModel, @NonNull ImperativeDomain> typedModel2domain = new HashMap<>();
-
- private final @NonNull ExpressionCreator expressionCreator;
- private final @NonNull ExpressionCreator inlineExpressionCreator;
+ // private final @NonNull ExpressionCreator expressionCreator;
+ // private final @NonNull ExpressionCreator inlineExpressionCreator;
public BasicRegion2Mapping(@NonNull QVTs2QVTiVisitor visitor, @NonNull Region region) {
super(visitor, region);
- this.expressionCreator = new ExpressionCreator();
- this.inlineExpressionCreator = new InlineExpressionCreator();
+ // this.expressionCreator = new ExpressionCreator();
+ // this.inlineExpressionCreator = new InlineExpressionCreator();
@SuppressWarnings("unused")String name = region.getName();
- createEmptyDomainsAndPatterns();
createHeadAndGuardNodeVariables();
createNavigablePredicates();
createExternalPredicates();
createRealizedVariables();
- createPollingDependencies();
createPropertyAssignments();
createAddStatements();
+ createObservedProperties();
}
/* @Override
@@ -678,7 +689,8 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
return node2variable.get(node);
}
- private @NonNull VariableStatement createBottomVariable(@NonNull Node node, @NonNull OCLExpression initExpression) {
+ private @NonNull DeclareStatement createBottomVariable(@NonNull Node node, @NonNull OCLExpression initExpression) {
+ // String string = initExpression.toString();
Type variableType = node.getCompleteClass().getPrimaryClass();
assert variableType != null;
boolean isRequired = true;
@@ -691,7 +703,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
isRequired = true;
}
String safeName = getSafeName(node);
- VariableStatement newVariable = helper.createDeclareStatement(safeName, variableType, isRequired, initExpression);
+ DeclareStatement newVariable = helper.createDeclareStatement(safeName, variableType, isRequired, initExpression);
mapping.getOwnedStatements().add(newVariable);
VariableDeclaration oldVariable = node2variable.put(node, newVariable);
assert oldVariable == null;
@@ -706,8 +718,8 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
VariableDeclaration slotVariable = getVariable(sourceNode);
Property property = edge.getProperty();
OCLExpression targetVariableExp = createVariableExp(targetNode);
- boolean isEmit = isHazardousWrite(property, sourceNode.getClassDatumAnalysis().getTypedModel());
- SetStatement setStatement = QVTimperativeUtil.createSetStatement(slotVariable, property, targetVariableExp, isEmit);
+ boolean isNotify = isHazardousWrite(edge);
+ SetStatement setStatement = QVTimperativeUtil.createSetStatement(slotVariable, property, targetVariableExp, isNotify);
mapping.getOwnedStatements().add(setStatement);
}
}
@@ -729,57 +741,6 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
}
/**
- * Create the domains and guard/bottom patterns.
- */
- private void createEmptyDomainsAndPatterns() {
- Set<@NonNull ImperativeTypedModel> checkableTypedModels = new HashSet<>();
- Set<@NonNull ImperativeTypedModel> enforceableTypedModels = new HashSet<>();
- for (@NonNull Node node : region.getNodes()) {
- ClassDatumAnalysis classDatumAnalysis = node.getClassDatumAnalysis();
- Type type = classDatumAnalysis.getClassDatum().getType();
- if (!(type instanceof DataType) && !(type instanceof AnyType) && !(type instanceof VoidType) && !(type instanceof InvalidType)) {
- DomainUsage domainUsage = classDatumAnalysis.getDomainUsage();
- if (domainUsage.isInput()) { // EObject is $primitive$
- for (@NonNull TypedModel typedModel : domainUsage.getTypedModels()) {
- ImperativeTypedModel qvtiTypedModel = visitor.getQVTiTypedModel(typedModel);
- assert qvtiTypedModel != null;
- checkableTypedModels.add(qvtiTypedModel);
- }
- }
- else if (domainUsage.isMiddle()) {
- ImperativeTypedModel qvtiTypedModel = visitor.getQVTiTypedModel(null);
- assert qvtiTypedModel != null;
- enforceableTypedModels.add(qvtiTypedModel);
- }
- else if (domainUsage.isOutput()) { // EObject is $primitive$
- for (@NonNull TypedModel typedModel : domainUsage.getTypedModels()) {
- ImperativeTypedModel qvtiTypedModel = visitor.getQVTiTypedModel(typedModel);
- assert qvtiTypedModel != null;
- enforceableTypedModels.add(qvtiTypedModel);
- }
- }
- }
- }
- checkableTypedModels.removeAll(enforceableTypedModels);
- for (@NonNull ImperativeTypedModel qvtiTypedModel : checkableTypedModels) {
- ImperativeDomain domain = QVTimperativeUtil.createImperativeDomain(qvtiTypedModel);
- domain.setIsCheckable(true);
- mapping.getDomain().add(domain);
- ImperativeDomain oldDomain = typedModel2domain.put(qvtiTypedModel, domain);
- assert oldDomain == null;
- }
- for (@NonNull ImperativeTypedModel qvtiTypedModel : enforceableTypedModels) {
- ImperativeDomain domain = QVTimperativeUtil.createImperativeDomain(qvtiTypedModel);
- domain.setIsEnforceable(true);
- mapping.getDomain().add(domain);
- ImperativeDomain oldDomain = typedModel2domain.put(qvtiTypedModel, domain);
- assert oldDomain == null;
- }
- EList<@NonNull Domain> domains = ClassUtil.nullFree(mapping.getDomain());
- ECollections.sort(domains, QVTbaseUtil.DomainNameComparator.INSTANCE);
- }
-
- /**
* Create a predicate expression for each TRUE 'head'.
*/
private void createExternalPredicates() {
@@ -797,6 +758,8 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
} */
for (@NonNull Edge edge : region.getEdges()) {
if (edge.isPredicate()) {
+ ExpressionCreator expressionCreator = new ExpressionCreator();
+ ExpressionCreator inlineExpressionCreator = expressionCreator.getInlineExpressionCreator();
Node sourceNode = edge.getSource();
Node targetNode = edge.getTarget();
OCLExpression conditionExpression = inlineExpressionCreator.getExpression(sourceNode);
@@ -811,7 +774,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
conditionExpression = helper.createOperationCallExp(conditionExpression, name, targetExpression);
}
CheckStatement asPredicate = QVTimperativeFactory.eINSTANCE.createCheckStatement();
- asPredicate.setOwnedCondition(conditionExpression);
+ asPredicate.setOwnedExpression(conditionExpression);
mapping.getOwnedStatements().add(asPredicate);
}
}
@@ -979,13 +942,19 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
if (!targetNode.isExplicitNull()) {
VariableDeclaration nodeVariable = node2variable.get(targetNode);
assert nodeVariable == null;
- createBottomVariable(targetNode, source2targetExp);
+ /*DeclareStatement declareStatement =*/ createBottomVariable(targetNode, source2targetExp);
+ // if (isHazardousRead(traversedEdge)) {
+ // declareStatement.getObservedProperties().add(property);
+ // }
}
else {
OCLExpression targetExp = helper.createNullLiteralExp();
OCLExpression conditionExpression = helper.createOperationCallExp(source2targetExp, "=", targetExp);
- CheckStatement asPredicate = helper.createCheckStatement(conditionExpression);
- mapping.getOwnedStatements().add(asPredicate);
+ CheckStatement checkStatement = helper.createCheckStatement(conditionExpression);
+ // if (isHazardousRead(traversedEdge)) {
+ // checkStatement.getObservedProperties().add(property);
+ // }
+ mapping.getOwnedStatements().add(checkStatement);
}
}
//
@@ -1099,18 +1068,33 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
} */
}
- private void createPollingDependencies() {
+ private void createObservedProperties() {
+ //
+ // Ideally we could install each observed property as it is actually used. But
+ // this needs to be coded in many places.
+ //
+ // Better, we would not be pessimistic about input/output typedModel ambiguity in endogeneous
+ // mappings, but that incurs many typedModel accuracy issues.
+ //
+ Set<@NonNull Property> allCheckedProperties = new HashSet<>();
DomainUsage anyUsage = region.getSchedulerConstants().getDomainAnalysis().getAnyUsage();
for (@NonNull TypedModel qvtpTypedModel : anyUsage.getTypedModels()) {
- ImperativeTypedModel qvtiTypedModel = visitor.getQVTiTypedModel(qvtpTypedModel);
- if (qvtiTypedModel != null) {
- ImperativeDomain domain = typedModel2domain.get(qvtiTypedModel);
- if (domain != null) {
- Iterable<@NonNull NavigableEdge> checkedEdges = region.getCheckedEdges(qvtpTypedModel);
- if (checkedEdges != null) {
- List<Property> checkedProperties = domain.getCheckedProperties();
- for (NavigableEdge checkedEdge : checkedEdges) {
- checkedProperties.add(checkedEdge.getProperty());
+ Iterable<@NonNull NavigableEdge> checkedEdges = region.getCheckedEdges(qvtpTypedModel);
+ if (checkedEdges != null) {
+ for (NavigableEdge checkedEdge : checkedEdges) {
+ allCheckedProperties.add(checkedEdge.getProperty());
+ }
+ }
+ }
+ //
+ for (Statement asStatement : mapping.getOwnedStatements()) {
+ if (asStatement instanceof ObservableStatement) {
+ List<Property> observedProperties = ((ObservableStatement)asStatement).getObservedProperties();
+ for (EObject eObject : new TreeIterable(asStatement, false)) {
+ if (eObject instanceof NavigationCallExp) {
+ Property property = PivotUtil.getReferredProperty((NavigationCallExp) eObject);
+ if (allCheckedProperties.contains(property) && !observedProperties.contains(property)) {
+ observedProperties.add(property);
}
}
}
@@ -1126,14 +1110,17 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
if (targetNode.isDataType()) {
VariableDeclaration asVariable = getVariable(sourceNode);
Property property = edge.getProperty();
+ ExpressionCreator expressionCreator = new ExpressionCreator();
OCLExpression valueExp = expressionCreator.getExpression(targetNode);
if (valueExp == null) {
- valueExp = expressionCreator.getExpression(targetNode); // FIXME debugging
+ ExpressionCreator expressionCreator2 = new ExpressionCreator();
+ valueExp = expressionCreator2.getExpression(targetNode); // FIXME debugging
}
if (valueExp != null) {
- boolean isEmit = isHazardousWrite(property, sourceNode.getClassDatumAnalysis().getTypedModel());
- SetStatement propertyAssignment = QVTimperativeUtil.createSetStatement(asVariable, property, valueExp, isEmit);
- mapping.getOwnedStatements().add(propertyAssignment);
+ boolean isNotify = isHazardousWrite(edge);
+ SetStatement setStatement = QVTimperativeUtil.createSetStatement(asVariable, property, valueExp, isNotify);
+ // addObservedProperties(setStatement);
+ mapping.getOwnedStatements().add(setStatement);
}
else {
System.err.println("No assignment in " + this + " to " + asVariable + "." + property);
@@ -1161,7 +1148,27 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
ECollections.sort(statements, new StatementComparator(statements));
}
- private boolean isHazardousWrite(@NonNull Property asProperty, @NonNull TypedModel typedModel) {
+ /* private boolean isHazardousRead(@NonNull NavigableEdge edge) {
+ Node sourceNode = edge.getSource();
+ Property asProperty = edge.getProperty();
+ TypedModel typedModel = sourceNode.getClassDatumAnalysis().getTypedModel();
+ Iterable<@NonNull NavigableEdge> checkedEdges = region.getCheckedEdges(typedModel);
+ if (checkedEdges != null) {
+ Property asOppositeProperty = asProperty.getOpposite();
+ for (@NonNull NavigableEdge checkedEdge : checkedEdges) {
+ Property edgeProperty = checkedEdge.getProperty();
+ if ((edgeProperty == asProperty) || (edgeProperty == asOppositeProperty)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }*/
+
+ private boolean isHazardousWrite(@NonNull NavigableEdge edge) {
+ Node sourceNode = edge.getSource();
+ Property asProperty = edge.getProperty();
+ TypedModel typedModel = sourceNode.getClassDatumAnalysis().getTypedModel();
Iterable<@NonNull NavigableEdge> enforcedEdges = region.getEnforcedEdges(typedModel);
if (enforcedEdges != null) {
Property asOppositeProperty = asProperty.getOpposite();
@@ -1178,6 +1185,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
private void createRealizedVariables() {
for (@NonNull Node newNode : region.getNewNodes()) {
if (newNode.isPattern() && newNode.isClass()) {
+ ExpressionCreator expressionCreator = new ExpressionCreator();
OCLExpression constructor = null;
for (Edge edge : newNode.getIncomingEdges()) {
if (edge.isExpression()) {
@@ -1191,7 +1199,7 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
TypedModel pTypedModel = classDatumAnalysis.getTypedModel();
ImperativeTypedModel iTypedModel = ClassUtil.nonNullState(visitor.getQVTiTypedModel(pTypedModel));
NewStatement newStatement = QVTimperativeUtil.createNewStatement(getSafeName(newNode), iTypedModel, classDatumAnalysis.getCompleteClass().getPrimaryClass());
- newStatement.setOwnedInit(constructor);
+ newStatement.setOwnedExpression(constructor);
mapping.getOwnedStatements().add(newStatement);
VariableDeclaration oldVariable = node2variable.put(newNode, newStatement);
assert oldVariable == null;
@@ -1310,7 +1318,9 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
protected @NonNull VariableDeclaration getVariable(Node node) {
VariableDeclaration variable = node2variable.get(node);
if (variable == null) {
- OCLExpression initExpression = node.getTypedElements().iterator().next().accept(expressionCreator);
+ ExpressionCreator expressionCreator = new ExpressionCreator();
+ TypedElement expression = node.getTypedElements().iterator().next();
+ OCLExpression initExpression = expression.accept(expressionCreator);
variable = createBottomVariable(node, initExpression);
}
return variable;
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 dbd2b8c5f..c22b60ec2 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
@@ -312,7 +312,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
AddStatement addStatement1 = QVTimperativeFactory.eINSTANCE.createAddStatement();
addStatement1.setTargetVariable(newVariable);
- addStatement1.setOwnedInit(excludingAllCallExp);
+ addStatement1.setOwnedExpression(excludingAllCallExp);
mappingStatements.add(addStatement1);
}
else {
@@ -321,7 +321,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
//
AddStatement addStatement2 = QVTimperativeFactory.eINSTANCE.createAddStatement();
addStatement2.setTargetVariable(accumulatedVariable);
- addStatement2.setOwnedInit(PivotUtil.createVariableExp(newVariable));
+ addStatement2.setOwnedExpression(PivotUtil.createVariableExp(newVariable));
mappingStatements.add(addStatement2);
}
}
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 f322df4a2..e0c920cbf 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
@@ -52,10 +52,8 @@ import org.eclipse.qvtd.compiler.internal.qvtp2qvts.SchedulerConstants;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
+import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
{
@@ -89,13 +87,6 @@ public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
}
}
}
- for (@NonNull TypedModel qvtiTypedModel : checkableTypedModels) {
- ImperativeDomain domain = QVTimperativeUtil.createImperativeDomain(qvtiTypedModel);
- domain.setIsCheckable(true);
- mapping.getDomain().add(domain);
- // CoreDomain oldDomain = typedModel2domain.put(qvtiTypedModel, domain);
- // assert oldDomain == null;
- }
/* for (ConnectionRegion connectionRegion : rootConnections) {
SimpleNode connectionNode = connectionRegion.getConnectionNode();
CompleteClass completeClass = connectionNode.getCompleteClass();
diff --git a/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java b/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java
index 5a065f048..3677906ea 100644
--- a/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java
+++ b/plugins/org.eclipse.qvtd.debug.ui/src/org/eclipse/qvtd/debug/ui/launching/QVTiMainTab.java
@@ -12,10 +12,7 @@
package org.eclipse.qvtd.debug.ui.launching;
import java.io.IOException;
-import java.util.HashSet;
import java.util.Map;
-import java.util.Set;
-
import org.eclipse.emf.common.util.URI;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -23,12 +20,9 @@ import org.eclipse.qvtd.compiler.CompilerChain;
import org.eclipse.qvtd.compiler.QVTiCompilerChain;
import org.eclipse.qvtd.debug.launching.QVTiLaunchConstants;
import org.eclipse.qvtd.debug.ui.QVTdDebugUIPlugin;
-import org.eclipse.qvtd.pivot.qvtbase.Domain;
-import org.eclipse.qvtd.pivot.qvtbase.Rule;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
+import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
import org.eclipse.swt.graphics.Image;
@@ -69,39 +63,17 @@ public class QVTiMainTab extends MainTab implements QVTiLaunchConstants
@NonNull Map<@NonNull String, @Nullable String> oldOutputsMap, @NonNull Map<@NonNull String, @Nullable String> newOutputsMap,
@NonNull Map<@NonNull String, @Nullable String> intermediateMap) {
super.updateGroups(transformation, oldInputsMap, newInputsMap, oldOutputsMap, newOutputsMap, intermediateMap);
- Set<@NonNull TypedModel> inputs = new HashSet<@NonNull TypedModel>();
- Set<@NonNull TypedModel> outputs = new HashSet<@NonNull TypedModel>();
- for (Rule rule : transformation.getRule()) {
- if (rule instanceof Mapping) {
- Mapping mapping = (Mapping)rule;
- for (Domain domain : mapping.getDomain()) {
- if (domain instanceof ImperativeDomain) {
- ImperativeDomain coreDomain = (ImperativeDomain)domain;
- /* BottomPattern bottomPattern = coreDomain.getBottomPattern();
- assert bottomPattern != null;
- TypedModel typedModel = coreDomain.getTypedModel();
- assert typedModel != null;
- if ((bottomPattern != null) && (typedModel != null)) {
- String name = typedModel.getName();
- if (bottomPattern.getRealizedVariable().isEmpty()) {
- if (inputs.add(typedModel)) {
- assert name != null;
- if (name != null) {
- newInputsMap.put(name, null); //getDefaultPath(inputsGroup, name));
- }
- }
- }
- else {
- if (outputs.add(typedModel)) {
- assert name != null;
- if (name != null) {
- newOutputsMap.put(name, null); //getDefaultPath(outputsGroup, name));
- }
- }
- }
- } */
- }
- }
+ for (TypedModel typedModel : transformation.getModelParameter()) {
+ ImperativeTypedModel imperativeTypedModel = (ImperativeTypedModel)typedModel;
+ if (imperativeTypedModel.isIsChecked()) {
+ String name = imperativeTypedModel.getName();
+ assert name != null;
+ newInputsMap.put(name, null); //getDefaultPath(inputsGroup, name));
+ }
+ if (imperativeTypedModel.isIsEnforced()) {
+ String name = imperativeTypedModel.getName();
+ assert name != null;
+ newOutputsMap.put(name, null); //getDefaultPath(inputsGroup, name));
}
}
for (String key : newOutputsMap.keySet()) {
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 b31dc32cc..0e63b6407 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,11 +46,6 @@ implements QVTimperativeVisitor<IStepper>
}
@Override
- public @Nullable IStepper visitImperativeDomain(org.eclipse.qvtd.pivot.qvtimperative.@NonNull ImperativeDomain object) {
- return visitDomain(object);
- }
-
- @Override
public @Nullable IStepper visitImperativeModel(org.eclipse.qvtd.pivot.qvtimperative.@NonNull ImperativeModel object) {
return visitBaseModel(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 0dcf0009a..1058c8ddf 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
@@ -31,6 +31,7 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
@@ -119,6 +120,11 @@ public class QVTiStepperVisitor extends AbstractQVTimperativeStepperVisitor
}
@Override
+ public @Nullable IStepper visitObservableStatement(@NonNull ObservableStatement object) {
+ return PreStepper.INSTANCE;
+ }
+
+ @Override
public @Nullable IStepper visitOutConnectionVariable(@NonNull OutConnectionVariable object) {
return NonStepper.INSTANCE;
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java
index 0d022d3af..a9d78f277 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java
@@ -81,7 +81,6 @@ import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
@@ -128,7 +127,7 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
protected @NonNull DomainUsage doSetStatement(@NonNull Property property, @NonNull SetStatement object) {
DomainUsage slotUsage = visit(object.getTargetVariable());
- DomainUsage valueUsage = visit(object.getOwnedInit());
+ DomainUsage valueUsage = visit(object.getOwnedExpression());
DomainUsage knownSourceUsage = getRootAnalysis().property2containingClassUsage.get(property);
if (knownSourceUsage != null) {
DomainUsage knownTargetUsage = getRootAnalysis().getUsage(property);
@@ -373,7 +372,7 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
@Override
public @NonNull DomainUsage visitCheckStatement(@NonNull CheckStatement object) {
- return visit(object.getOwnedCondition());
+ return visit(object.getOwnedExpression());
}
@Override
@@ -416,9 +415,9 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
@Override
public @NonNull DomainUsage visitDeclareStatement(@NonNull DeclareStatement object) {
- OCLExpression ownedInit = object.getOwnedInit();
- if (ownedInit != null) {
- return visit(ownedInit);
+ OCLExpression ownedExpression = object.getOwnedExpression();
+ if (ownedExpression != null) {
+ return visit(ownedExpression);
}
return visit(object.getType());
}
@@ -476,13 +475,6 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
- public @NonNull DomainUsage visitImperativeDomain(@NonNull ImperativeDomain object) {
- DomainUsage usage = visit(object.getTypedModel());
- setUsage(object, usage);
- return usage;
- }
-
- @Override
public @NonNull DomainUsage visitIterateExp(@NonNull IterateExp object) {
DomainUsage sourceUsage = visit(object.getOwnedSource());
for (Variable iterator : object.getOwnedIterators()) {
@@ -635,7 +627,7 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
String operationName = object.getReferredOperation().getName();
if ("allInstances".equals(operationName)) { // FIXME BUG 487257 Revise this
- return getAllInstancesUsage(object, sourceUsage);
+ return /*getAllInstancesUsage(object,*/ sourceUsage;//);
}
//
// Special case: left/right of "="/"<>" have same usage. Result is primitive.
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 9c05f38eb..a54c7b5e7 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
@@ -47,7 +47,7 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
@Override
public @NonNull DomainUsage visitAddStatement(@NonNull AddStatement object) {
- DomainUsage valueUsage = visit(object.getOwnedInit());
+ DomainUsage valueUsage = visit(object.getOwnedExpression());
DomainUsage variableUsage = visit(object.getTargetVariable());
return intersection(variableUsage, valueUsage);
}
@@ -90,7 +90,7 @@ public class QVTimperativeDomainUsageAnalysis extends RootDomainUsageAnalysis im
@Override
public @NonNull DomainUsage visitMappingLoop(@NonNull MappingLoop object) {
- DomainUsage sourceUsage = visit(object.getOwnedSource());
+ DomainUsage sourceUsage = visit(object.getOwnedExpression());
for (LoopVariable iterator : object.getOwnedIterators()) {
if (iterator != null) {
setUsage(iterator, sourceUsage);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java
index 1d9299880..29415f6f2 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/RootDomainUsageAnalysis.java
@@ -32,7 +32,6 @@ import org.eclipse.ocl.pivot.Detail;
import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.NullLiteralExp;
import org.eclipse.ocl.pivot.Operation;
-import org.eclipse.ocl.pivot.OperationCallExp;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.StandardLibrary;
import org.eclipse.ocl.pivot.Variable;
@@ -44,16 +43,13 @@ import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
import org.eclipse.ocl.pivot.utilities.LabelUtil;
import org.eclipse.ocl.pivot.utilities.NameUtil;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
-import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.QVTbaseFactory;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsageAnalysis;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
-import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
@@ -507,7 +503,7 @@ public class RootDomainUsageAnalysis extends AbstractDomainUsageAnalysis impleme
return new DomainUsageVariable(intersectionMask);
}
- @Override // FIXME BUG 487257 Revise this
+ /* @Override // FIXME BUG 487257 Revise this
protected @NonNull DomainUsage getAllInstancesUsage(@NonNull OperationCallExp asCallExp, @NonNull DomainUsage sourceUsage) {
if (asCallExp.getOwnedSource().getTypeValue() instanceof DataType) {
return getPrimitiveUsage();
@@ -531,7 +527,7 @@ public class RootDomainUsageAnalysis extends AbstractDomainUsageAnalysis impleme
else { // Att root so no domains, use input
return intersection(sourceUsage, getInputUsage());
}
- }
+ } */
public @NonNull DomainUsageAnalysis getAnalysis(@NonNull Operation operation) {
DomainUsageAnalysis analysis = operation2analysis.get(operation);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/CoreDomainAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/CoreDomainAttribution.java
deleted file mode 100644
index 550604b23..000000000
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/CoreDomainAttribution.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2016 Willink Transformations and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * E.D.Willink - initial API and implementation
- *******************************************************************************/
-package org.eclipse.qvtd.pivot.qvtimperative.attributes;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.ocl.pivot.internal.scoping.AbstractAttribution;
-import org.eclipse.ocl.pivot.internal.scoping.EnvironmentView;
-import org.eclipse.ocl.pivot.internal.scoping.ScopeView;
-import org.eclipse.ocl.pivot.utilities.ClassUtil;
-import org.eclipse.ocl.pivot.utilities.PivotUtil;
-import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
-
-public class CoreDomainAttribution extends AbstractAttribution
-{
- public static final CoreDomainAttribution INSTANCE = new CoreDomainAttribution();
-
- @Override
- public ScopeView computeLookup(@NonNull EObject target, @NonNull EnvironmentView environmentView, @NonNull ScopeView scopeView) {
- ImperativeDomain targetElement = (ImperativeDomain)target;
- TypedModel typedModel = targetElement.getTypedModel();
- if (typedModel != null) {
- for (org.eclipse.ocl.pivot.Package pPackage : ClassUtil.nullFree(typedModel.getUsedPackage())) {
- environmentView.addNamedElement(pPackage);
- PivotUtil.addAllClasses(environmentView, pPackage);
- }
- }
- for (EObject eContainer = targetElement.eContainer(); eContainer != null; eContainer = eContainer.eContainer()) {
- if (eContainer instanceof Transformation) {
- Transformation transformation = (Transformation) eContainer;
- environmentView.addNamedElements(transformation.getModelParameter());
- PivotUtil.addAllNamedElements(environmentView, transformation.getOwnedOperations());
- break;
- }
- }
- return null;
- }
-}
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 e026c84ec..772009b17 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
@@ -293,9 +293,9 @@ public class BasicQVTiExecutor extends AbstractExecutor implements QVTiExecutor
@Override
public @Nullable Object internalExecuteNewStatement(@NonNull NewStatement newStatement, @NonNull EvaluationVisitor undecoratedVisitor) {
- OCLExpression ownedInit = newStatement.getOwnedInit();
- if (ownedInit != null) {
- Object initValue = ownedInit.accept(undecoratedVisitor);
+ OCLExpression ownedExpression = newStatement.getOwnedExpression();
+ if (ownedExpression != null) {
+ Object initValue = ownedExpression.accept(undecoratedVisitor);
getEvaluationEnvironment().add(newStatement, initValue);
replace(newStatement, initValue);
TypedModel typedModel = newStatement.getReferredTypedModel();
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 3a7aea44a..5093c82e8 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
@@ -44,7 +44,6 @@ import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
@@ -55,6 +54,7 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
@@ -103,7 +103,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
public @Nullable Object visitAddStatement(@NonNull AddStatement connectionStatement) {
ConnectionVariable targetVariable = connectionStatement.getTargetVariable() ;
if (targetVariable != null) {
- OCLExpression valueExpression = connectionStatement.getOwnedInit();
+ OCLExpression valueExpression = connectionStatement.getOwnedExpression();
if (valueExpression != null) {
doConnectionAccumulation(targetVariable, valueExpression);
return true;
@@ -120,7 +120,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
@Override
public @Nullable Object visitCheckStatement(@NonNull CheckStatement predicate) {
// Each predicate has a conditionExpression that is an OCLExpression
- OCLExpression exp = predicate.getOwnedCondition();
+ OCLExpression exp = predicate.getOwnedExpression();
// The predicated is visited with a nested environment
Object expResult = exp.accept(undecoratedVisitor);
return expResult;
@@ -134,12 +134,12 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
@Override
public @Nullable Object visitDeclareStatement(@NonNull DeclareStatement asStatement) {
Object initValue;
- OCLExpression ownedInit = asStatement.getOwnedInit();
- if (ownedInit == null) {
+ OCLExpression ownedExpression = asStatement.getOwnedExpression();
+ if (ownedExpression == null) {
initValue = null;
}
else {
- initValue = ownedInit.accept(undecoratedVisitor);
+ initValue = ownedExpression.accept(undecoratedVisitor);
if (asStatement.isIsChecked()) {
Type guardType = asStatement.getType();
Type valueType = idResolver.getDynamicTypeOf(initValue);
@@ -174,11 +174,6 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
@Override
- public @Nullable Object visitImperativeDomain(@NonNull ImperativeDomain object) {
- return visiting(object);
- }
-
- @Override
public @Nullable Object visitImperativeModel(@NonNull ImperativeModel imperativeModel) {
for (org.eclipse.ocl.pivot.Package pkge : imperativeModel.getOwnedPackages()) {
pkge.accept(undecoratedVisitor);
@@ -262,7 +257,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
@Override
public @Nullable Object visitMappingLoop(@NonNull MappingLoop mappingLoop) {
- Object inValues = mappingLoop.getOwnedSource().accept(undecoratedVisitor);
+ Object inValues = mappingLoop.getOwnedExpression().accept(undecoratedVisitor);
if (inValues instanceof Iterable<?>) {
List<LoopVariable> iterators = mappingLoop.getOwnedIterators();
if (iterators.size() > 0) {
@@ -294,6 +289,11 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
return executor.internalExecuteNewStatement(newStatement, undecoratedVisitor) != null;
}
+ @Override
+ public @Nullable Object visitObservableStatement(@NonNull ObservableStatement object) {
+ return visiting(object);
+ }
+
/* @Override
public Object visitOppositePropertyCallExp(@NonNull OppositePropertyCallExp oppositePropertyCallExp) {
QVTiModelManager modelManager = (QVTiModelManager) context.getModelManager();
@@ -319,10 +319,10 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
@Override
public Object visitOutConnectionVariable(@NonNull OutConnectionVariable object) {
CollectionValue.Accumulator accumulator;
- OCLExpression ownedInit = object.getOwnedInit();
- if (ownedInit != null) {
- Object initValue = ownedInit.accept(undecoratedVisitor);
- accumulator = ValueUtil.createCollectionAccumulatorValue((CollectionTypeId) ownedInit.getTypeId());
+ OCLExpression ownedExpression = object.getOwnedExpression();
+ if (ownedExpression != null) {
+ Object initValue = ownedExpression.accept(undecoratedVisitor);
+ accumulator = ValueUtil.createCollectionAccumulatorValue((CollectionTypeId) ownedExpression.getTypeId());
if (initValue != null) {
for (Object value : (Iterable<?>)initValue) {
accumulator.add(value);
@@ -369,7 +369,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
if (slotObject instanceof EObject) {
Integer childKey = null;
try {
- Object boxedValue = setStatement.getOwnedInit().accept(undecoratedVisitor);
+ Object boxedValue = setStatement.getOwnedExpression().accept(undecoratedVisitor);
Property targetProperty = QVTimperativeUtil.getTargetProperty(setStatement);
Class<?> instanceClass = PivotUtil.getEcoreInstanceClass(targetProperty);
Object ecoreValue = idResolver.ecoreValueOf(instanceClass, boxedValue);
@@ -401,7 +401,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
@Override
public @Nullable Object visitStatement(@NonNull Statement object) {
- return visitNamedElement(object); // Statement is abstract
+ return visiting(object);
}
@Override
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java
index ec5446b43..cdfba425c 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java
@@ -28,7 +28,6 @@ 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.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
@@ -233,14 +232,6 @@ implements IQVTiEvaluationVisitor {
* Delegates to my decorated visitor.
*/
@Override
- public @Nullable Object visitImperativeDomain(@NonNull ImperativeDomain coreDomain) {
- return delegate.visitImperativeDomain(coreDomain);
- }
-
- /**
- * Delegates to my decorated visitor.
- */
- @Override
public @Nullable Object visitImperativeModel(@NonNull ImperativeModel imperativeModel) {
return delegate.visitImperativeModel(imperativeModel);
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java
index 9fbb0176f..87a03bb0d 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java
@@ -12,8 +12,10 @@
package org.eclipse.qvtd.pivot.qvtimperative.evaluation;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -25,6 +27,7 @@ import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.evaluation.EvaluationVisitor;
import org.eclipse.ocl.pivot.ids.IdResolver;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
+import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.ocl.pivot.utilities.ValueUtil;
import org.eclipse.ocl.pivot.values.InvalidValueException;
import org.eclipse.qvtd.pivot.qvtbase.Function;
@@ -33,6 +36,7 @@ import org.eclipse.qvtd.pivot.qvtbase.graphs.GraphStringBuilder;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
import org.eclipse.qvtd.runtime.evaluation.AbstractComputation;
@@ -232,7 +236,8 @@ public class QVTiIncrementalExecutor extends BasicQVTiExecutor
}
Mapping asMapping = QVTimperativeUtil.getContainingMapping(navigationCallExp);
Object ecoreValue;
- if ((asMapping != null) && transformationAnalysis.isHazardousRead(asMapping, navigationCallExp)) { // null within queries
+ // if ((asMapping != null) && transformationAnalysis.isHazardousRead(asMapping, navigationCallExp)) { // null within queries
+ if ((asMapping != null) && isHazardous2(navigationCallExp)) { // null within queries
// assert false; // Should use an AccessStatement
// assert sourceValue != null;
if (sourceValue == null) {
@@ -266,6 +271,17 @@ public class QVTiIncrementalExecutor extends BasicQVTiExecutor
return ecoreValue;
}
+ private boolean isHazardous2(@NonNull NavigationCallExp asNavigationCallExp) {
+ for (EObject eObject = asNavigationCallExp; eObject != null; eObject = eObject.eContainer()) {
+ if (eObject instanceof ObservableStatement) {
+ List<Property> observedProperties = ((ObservableStatement)eObject).getObservedProperties();
+ Property navigatedProperty = PivotUtil.getReferredProperty(asNavigationCallExp);
+ return observedProperties.contains(navigatedProperty);
+ }
+ }
+ return false;
+ }
+
@Override
public @Nullable Object internalExecuteNewStatement(@NonNull NewStatement asNewStatement, @NonNull EvaluationVisitor undecoratedVisitor) {
Object element = super.internalExecuteNewStatement(asNewStatement, undecoratedVisitor);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java
index f56b62f6e..45bab5377 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTransformationAnalysis.java
@@ -32,7 +32,6 @@ import org.eclipse.ocl.pivot.PrimitiveType;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.PropertyCallExp;
import org.eclipse.ocl.pivot.Type;
-import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.ids.IdManager;
import org.eclipse.ocl.pivot.ids.OperationId;
import org.eclipse.ocl.pivot.ids.TypeId;
@@ -40,15 +39,9 @@ import org.eclipse.ocl.pivot.internal.manager.MetamodelManagerInternal;
import org.eclipse.ocl.pivot.internal.utilities.EnvironmentFactoryInternal;
import org.eclipse.ocl.pivot.library.LibraryFeature;
import org.eclipse.ocl.pivot.library.oclany.OclElementOclContainerProperty;
-import org.eclipse.ocl.pivot.utilities.PivotUtil;
-import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.analysis.DomainUsage;
-import org.eclipse.qvtd.pivot.qvtimperative.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.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.analysis.QVTimperativeDomainUsageAnalysis;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
@@ -117,8 +110,6 @@ public class QVTiTransformationAnalysis
*/
private final @NonNull Set<@NonNull Mapping> hazardousMappings = new HashSet<>();
- private final @NonNull Set<@NonNull Property> hazardousProperties = new HashSet<>();
-
/**
* The SetStatements to each Property.
*/
@@ -200,20 +191,6 @@ public class QVTiTransformationAnalysis
}
private void analyzeProperties() {
- Set<@NonNull Mapping> hazardousMappings = getHazardousMappings();
- for (Map.Entry<@NonNull Mapping, @NonNull Set<@NonNull NavigationCallExp>> entry : getMapping2Property().entrySet()) {
- Mapping mapping = entry.getKey();
- if (hazardousMappings.contains(mapping)) {
- for (@NonNull NavigationCallExp hazardousPropertyCallExp : entry.getValue()) {
- Property hazardousProperty = PivotUtil.getReferredProperty(hazardousPropertyCallExp);
- hazardousProperties.add(hazardousProperty);
- Property oppositeProperty = hazardousProperty.getOpposite();
- if (oppositeProperty != null) {
- hazardousProperties.add(oppositeProperty);
- }
- }
- }
- }
for (@NonNull Set<@NonNull SetStatement> propertyAssignments : mapping2propertyAssignments.values()) {
for (@NonNull SetStatement propertyAssignment : propertyAssignments) {
Property property = propertyAssignment.getTargetProperty();
@@ -287,33 +264,14 @@ public class QVTiTransformationAnalysis
OperationId allInstancesOperationId = oclElementType.getTypeId().getOperationId(0, "allInstances", IdManager.getParametersId());
OperationId objectsOfKindOperationId = modelType.getTypeId().getOperationId(1, "objectsOfKind", IdManager.getParametersId(TypeId.T_1));
OperationId objectsOfTypeOperationId = modelType.getTypeId().getOperationId(1, "objectsOfType", IdManager.getParametersId(TypeId.T_1));
- List<@NonNull SetStatement> propertyAssignments = new ArrayList<>();
+ List<@NonNull SetStatement> setStatements = new ArrayList<>();
for (TreeIterator<EObject> tit = transformation.eAllContents(); tit.hasNext(); ) {
EObject eObject = tit.next();
if (eObject instanceof Mapping) {
Mapping mapping = (Mapping)eObject;
analyzeMappingPropertyAccesses(mapping);
analyzeMappingSetStatements(mapping);
- if (mapping.getCheckedProperties().size() > 0) {
- hazardousMappings.add(mapping);
- }
- else {
- for (Domain domain : mapping.getDomain()) {
- if (domain instanceof ImperativeDomain) {
- ImperativeDomain imperativeDomain = (ImperativeDomain)domain;
- if (imperativeDomain.getCheckedProperties().size() > 0) {
- hazardousMappings.add(mapping);
- break;
- }
- }
- }
- }
- }
- else if (eObject instanceof MappingCallBinding) {
- MappingCallBinding mappingCallBinding = (MappingCallBinding)eObject;
- if (mappingCallBinding.isIsPolled()) {
- Mapping mapping = mappingCallBinding.getMappingCall().getReferredMapping();
- assert mapping != null;
+ if (QVTimperativeUtil.isObserver(mapping)) {
hazardousMappings.add(mapping);
}
}
@@ -326,7 +284,7 @@ public class QVTiTransformationAnalysis
}
}
else if (eObject instanceof SetStatement) {
- propertyAssignments.add((SetStatement)eObject);
+ setStatements.add((SetStatement)eObject);
}
else if (eObject instanceof OperationCallExp) {
OperationCallExp operationCallExp = (OperationCallExp)eObject;
@@ -359,7 +317,7 @@ public class QVTiTransformationAnalysis
// Second pass
// - install cacheIndex allocated to MiddlePropertyCallExp in each MiddleSetStatement
//
- for (@NonNull SetStatement propertyAssignment : propertyAssignments) {
+ for (@NonNull SetStatement propertyAssignment : setStatements) {
Property navigableProperty = propertyAssignment.getTargetProperty();
if (navigableProperty != null) {
Integer cacheIndex = property2cacheIndex.get(navigableProperty);
@@ -458,90 +416,7 @@ public class QVTiTransformationAnalysis
return sourceProperty2cacheIndex;
}
- public boolean hasHazardousRead(@NonNull MappingCall mappingCall) {
- for (MappingCallBinding callBinding : mappingCall.getBinding()) {
- if (callBinding.isIsPolled()) {
- return true;
- }
- }
- return false;
- }
-
- public boolean hasHazardousWrite(@NonNull MappingCall mappingCall) {
- Mapping mapping = mappingCall.getReferredMapping();
- Set<@NonNull SetStatement> propertyAssignments = mapping2propertyAssignments.get(mapping);
- if (propertyAssignments == null) {
- return false;
- }
- for (@NonNull SetStatement propertyAssignment : propertyAssignments) {
- Property assignedProperty = propertyAssignment.getTargetProperty();
- if (hazardousProperties.contains(assignedProperty)) {
- return true;
- }
- if (hazardousProperties.contains(assignedProperty.getOpposite())) {
- return true;
- }
- }
- return false;
- }
-
- public boolean isAssigned(@NonNull Property targetProperty, @NonNull DomainUsage domainUsage) {
- Set<@NonNull SetStatement> propertyAssignments = property2propertyAssignments.get(targetProperty);
- if (propertyAssignments == null) {
- return false;
- }
- for (@NonNull SetStatement propertyAssignment : propertyAssignments) {
- VariableDeclaration targetVariable = propertyAssignment.getTargetVariable();
- DomainUsage slotUsage = domainAnalysis.basicGetUsage(targetVariable);
- if (domainUsage == slotUsage) {
- return true;
- }
- }
- return false;
- }
-
public boolean isHazardous(@NonNull Mapping mapping) {
return hazardousMappings.contains(mapping);
}
-
- public boolean isHazardousRead(@NonNull Mapping asMapping, @NonNull NavigationCallExp asNavigationCallExp) {
- Property asProperty = PivotUtil.getReferredProperty(asNavigationCallExp);
- OCLExpression asSource = asNavigationCallExp.getOwnedSource();
- DomainUsage domainUsage1 = domainAnalysis.basicGetUsage(asSource);
- if (domainUsage1 != null) {
- TypedModel typedModel = domainUsage1.getTypedModel(asSource);
- if (typedModel != null) {
- ImperativeDomain domain = QVTimperativeUtil.getDomain(asMapping, typedModel);
- if (domain != null) {
- if (domain.getCheckedProperties().contains(asProperty)) {
- return true;
- }
- }
- else {
- if (asMapping.getCheckedProperties().contains(asProperty)) {
- return true;
- }
- }
- }
- }
- Property asOppositeProperty = asProperty.getOpposite();
- DomainUsage domainUsage2 = domainAnalysis.basicGetUsage(asNavigationCallExp);
- if (domainUsage2 != null) {
- TypedModel typedModel = domainUsage2.getTypedModel(asProperty);
- if (typedModel != null) {
- ImperativeDomain domain = QVTimperativeUtil.getDomain(asMapping, typedModel);
- if (domain != null) {
- if (domain.getCheckedProperties().contains(asOppositeProperty)) {
- return true;
- }
- }
- else {
- if (asMapping.getCheckedProperties().contains(asOppositeProperty)) {
- return true;
- }
- }
- }
- }
- return false;
- }
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java
index e6fd135bc..f16d4aa7a 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java
@@ -15,7 +15,6 @@ import java.util.Map;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.ocl.pivot.internal.scoping.Attribution;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
-import org.eclipse.qvtd.pivot.qvtimperative.attributes.CoreDomainAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.GuardVariableAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.MappingAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.MappingCallBindingAttribution;
@@ -27,7 +26,6 @@ public class QVTimperativePivotScoping
public static void init() {
Map<EClassifier, Attribution> registry = Attribution.REGISTRY;
registry.put(QVTimperativePackage.Literals.GUARD_VARIABLE, GuardVariableAttribution.INSTANCE);
- registry.put(QVTimperativePackage.Literals.IMPERATIVE_DOMAIN, CoreDomainAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.MAPPING, MappingAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.MAPPING_CALL_BINDING, MappingCallBindingAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.MAPPING_LOOP, MappingLoopAttribution.INSTANCE);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java
index b0fdbc3eb..0b25afb27 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeAS2XMIidVisitor.java
@@ -18,7 +18,6 @@ import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.internal.utilities.AS2XMIid;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
@@ -53,11 +52,6 @@ public class QVTimperativeAS2XMIidVisitor extends AbstractQVTimperativeAS2XMIidV
}
@Override
- public @Nullable Boolean visitImperativeDomain(@NonNull ImperativeDomain asImperativeDomain) {
- return null;
- }
-
- @Override
public @Nullable Boolean visitMapping(@NonNull Mapping object) {
s.append(MAPPING_PREFIX);
appendParent(object);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeHelper.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeHelper.java
index ee3617cd5..669fde40b 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
@@ -39,20 +39,20 @@ public class QVTimperativeHelper extends QVTbaseHelper
public @NonNull AddStatement createAddStatement(@NonNull ConnectionVariable connectionVariable, @NonNull OCLExpression childrenExpression) {
AddStatement addStatement = QVTimperativeFactory.eINSTANCE.createAddStatement();
addStatement.setTargetVariable(connectionVariable);
- addStatement.setOwnedInit(childrenExpression);
+ addStatement.setOwnedExpression(childrenExpression);
return addStatement;
}
public @NonNull CheckStatement createCheckStatement(@NonNull OCLExpression asConditionExpression) {
CheckStatement asPredicate = QVTimperativeFactory.eINSTANCE.createCheckStatement();
- asPredicate.setOwnedCondition(asConditionExpression);
+ asPredicate.setOwnedExpression(asConditionExpression);
return asPredicate;
}
public @NonNull DeclareStatement createDeclareStatement(@NonNull String name, @NonNull Type asType, boolean isRequired, @NonNull OCLExpression initExpression) {
DeclareStatement asVariableStatement = QVTimperativeFactory.eINSTANCE.createDeclareStatement();
asVariableStatement.setIsChecked(!initExpression.getType().conformsTo(standardLibrary, asType));
- asVariableStatement.setOwnedInit(initExpression);
+ asVariableStatement.setOwnedExpression(initExpression);
asVariableStatement.setName(name);
asVariableStatement.setType(asType);
asVariableStatement.setIsRequired(isRequired);
@@ -89,7 +89,7 @@ public class QVTimperativeHelper extends QVTbaseHelper
asVariable.setName(name);
asVariable.setType(asType);
asVariable.setIsRequired(isRequired);
- asVariable.setOwnedInit(initExpression);
+ asVariable.setOwnedExpression(initExpression);
return asVariable;
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java
index 028be0703..f58245cec 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
@@ -22,7 +22,6 @@ import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
@@ -33,6 +32,7 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
@@ -49,7 +49,7 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
context.append("add ");
context.appendName(asAddStatement.getTargetVariable());
context.append(" += ");
- safeVisit(asAddStatement.getOwnedInit());
+ safeVisit(asAddStatement.getOwnedExpression());
context.append(";\n");
return null;
}
@@ -57,7 +57,7 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
@Override
public Object visitCheckStatement(@NonNull CheckStatement pPredicate) {
context.append("check ");
- safeVisit(pPredicate.getOwnedCondition());
+ safeVisit(pPredicate.getOwnedExpression());
context.append(";\n");
return null;
}
@@ -79,7 +79,7 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
context.append(" : ");
context.appendTypedMultiplicity(asVariable);
}
- OCLExpression asInit = asVariable.getOwnedInit();
+ OCLExpression asInit = asVariable.getOwnedExpression();
if (asInit != null) {
context.append(" := ");
safeVisit(asInit);
@@ -103,12 +103,6 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
@Override
- public Object visitImperativeDomain(@NonNull ImperativeDomain object) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
public Object visitImperativeModel(@NonNull ImperativeModel object) {
return visitModel(object);
}
@@ -187,7 +181,7 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
@Override
public Object visitMappingCallBinding(@NonNull MappingCallBinding pMappingCallBinding) {
context.appendName(pMappingCallBinding.getBoundVariable());
- context.append(pMappingCallBinding.isIsPolled() ? " ?= " : " := ");
+ context.append(" := ");
safeVisit(pMappingCallBinding.getValue());
context.append(";\n");
return null;
@@ -198,7 +192,7 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
context.append("for ");
context.appendElement(pMappingLoop.getOwnedIterators().get(0));
context.append(" in ");
- context.appendElement(pMappingLoop.getOwnedSource());
+ context.appendElement(pMappingLoop.getOwnedExpression());
context.append(" {");
context.push("", "");
for (MappingStatement pMappingStatement : pMappingLoop.getOwnedMappingStatements()) {
@@ -226,7 +220,7 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
// context.appendQualifiedType(type);
context.appendTypedMultiplicity(pNewStatement);
}
- OCLExpression initExpression = pNewStatement.getOwnedInit();
+ OCLExpression initExpression = pNewStatement.getOwnedExpression();
if (initExpression != null) {
context.append(" = ");
safeVisit(initExpression);
@@ -236,6 +230,11 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
@Override
+ public Object visitObservableStatement(@NonNull ObservableStatement object) {
+ return visiting(object);
+ }
+
+ @Override
public Object visitOutConnectionVariable(@NonNull OutConnectionVariable object) {
return visitVariableDeclaration(object);
}
@@ -256,7 +255,7 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
context.append(".");
context.appendName(QVTimperativeUtil.getTargetProperty(asSetStatement));
context.append(" := ");
- safeVisit(asSetStatement.getOwnedInit());
+ safeVisit(asSetStatement.getOwnedExpression());
context.append(";\n");
return null;
}
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 c09c5d8e4..4acfe2dd2 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
@@ -22,7 +22,6 @@ import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
@@ -33,6 +32,7 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
@@ -77,14 +77,14 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
append("add ");
appendName(asAddStatement.getTargetVariable());
append(" += ");
- safeVisit(asAddStatement.getOwnedInit());
+ safeVisit(asAddStatement.getOwnedExpression());
return null;
}
@Override
public @Nullable String visitCheckStatement(@NonNull CheckStatement object) {
append("check ");
- safeVisit(object.getOwnedCondition());
+ safeVisit(object.getOwnedExpression());
return null;
}
@@ -112,7 +112,7 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
append(" : ");
appendElementType(asVariable);
}
- OCLExpression asInit = asVariable.getOwnedInit();
+ OCLExpression asInit = asVariable.getOwnedExpression();
if (asInit != null) {
append(" := ");
safeVisit(asInit);
@@ -133,12 +133,6 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
- public String visitImperativeDomain(@NonNull ImperativeDomain object) {
- appendQualifiedName(object);
- return null;
- }
-
- @Override
public @Nullable String visitImperativeModel(@NonNull ImperativeModel object) {
return visitModel(object);
}
@@ -193,7 +187,7 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
append(", ");
}
appendName(binding.getBoundVariable());
- append(binding.isIsPolled() ? " ?= " : " := ");
+ append(" := ");
safeVisit(binding.getValue());
isFirst = false;
}
@@ -204,7 +198,7 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
@Override
public @Nullable String visitMappingCallBinding(@NonNull MappingCallBinding object) {
appendName(object.getBoundVariable());
- append(object.isIsPolled() ? " ?= " : " := ");
+ append(" := ");
safeVisit(object.getValue());
return null;
}
@@ -220,7 +214,7 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
isFirst = false;
}
append(" := ");
- safeVisit(object.getOwnedSource());
+ safeVisit(object.getOwnedExpression());
return null;
}
@@ -240,7 +234,7 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
append(" : ");
appendElementType(newStatement);
}
- OCLExpression initExpression = newStatement.getOwnedInit();
+ OCLExpression initExpression = newStatement.getOwnedExpression();
if (initExpression != null) {
append(" = ");
safeVisit(initExpression);
@@ -249,6 +243,11 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
+ public @Nullable String visitObservableStatement(@NonNull ObservableStatement object) {
+ return null;
+ }
+
+ @Override
public @Nullable String visitOutConnectionVariable(@NonNull OutConnectionVariable asVariable) {
append("out ");
appendName(asVariable);
@@ -270,7 +269,7 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
append(".");
appendName(QVTimperativeUtil.getTargetProperty(asSetStatement));
append(" := ");
- safeVisit(asSetStatement.getOwnedInit());
+ safeVisit(asSetStatement.getOwnedExpression());
return null;
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeUtil.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeUtil.java
index c4f7de279..dbdfef438 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
@@ -36,13 +36,10 @@ import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.ocl.pivot.utilities.TreeIterable;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.QVTbaseFactory;
-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.QVTbaseEnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseEnvironmentFactory.CreateStrategy;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
@@ -52,8 +49,10 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeFactory;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.Statement;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEnvironmentFactory;
public class QVTimperativeUtil extends QVTbaseUtil
@@ -99,34 +98,6 @@ 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;
- }
- else if (mappingStatementOrStatements instanceof MappingSequence){
- ((MappingSequence)mappingStatementOrStatements).getMappingStatements().add(mappingStatement);
- return mappingStatementOrStatements;
- }
- else {
- MappingSequence mappingSequence = QVTimperativeFactory.eINSTANCE.createMappingSequence();
- List<MappingStatement> mappingStatements = mappingSequence.getMappingStatements();
- mappingStatements.add(mappingStatementOrStatements);
- mappingStatements.add(mappingStatement);
- return mappingSequence;
- }
- } */
-
- public static @NonNull ImperativeDomain createImperativeDomain(@NonNull TypedModel typedModel) {
- ImperativeDomain coreDomain = QVTimperativeFactory.eINSTANCE.createImperativeDomain();
- coreDomain.setName(typedModel.getName());
- coreDomain.setTypedModel(typedModel);
- return coreDomain;
- }
-
public static @NonNull IterateExp createIterateExp(@Nullable OCLExpression asSource, @NonNull Iteration asIteration, @NonNull List<? extends Variable> asIterators, @NonNull OCLExpression asBody) {
IterateExp asCallExp = PivotFactory.eINSTANCE.createIterateExp();
asCallExp.setReferredIteration(asIteration);
@@ -161,7 +132,7 @@ public class QVTimperativeUtil extends QVTbaseUtil
public static @NonNull MappingLoop createMappingLoop(@NonNull OCLExpression source, @NonNull LoopVariable iterator, @NonNull MappingStatement mappingStatement) {
assert iterator.eContainer() == null;
MappingLoop ml = QVTimperativeFactory.eINSTANCE.createMappingLoop();
- ml.setOwnedSource(source);
+ ml.setOwnedExpression(source);
ml.getOwnedIterators().add(iterator);
ml.getOwnedMappingStatements().add(mappingStatement);
return ml;
@@ -221,7 +192,7 @@ public class QVTimperativeUtil extends QVTbaseUtil
asSetAssignment.setIsOpposite(false);
}
asSetAssignment.setTargetVariable(asVariable);
- asSetAssignment.setOwnedInit(asValueExpression);
+ asSetAssignment.setOwnedExpression(asValueExpression);
asSetAssignment.setIsNotify(isNotify);
return asSetAssignment;
}
@@ -238,25 +209,6 @@ public class QVTimperativeUtil extends QVTbaseUtil
return typedModel;
}
- public static @NonNull ImperativeDomain getArea(@NonNull Mapping mapping, @NonNull TypedModel typedModel) {
- for (Domain domain : mapping.getDomain()) {
- if (domain.getTypedModel() == typedModel) {
- return (ImperativeDomain)domain;
- }
- }
- throw new IllegalStateException();
- // return mapping;
- }
-
- /* public static @Nullable Area getContainingArea(@Nullable EObject eObject) {
- for ( ; eObject != null; eObject = eObject.eContainer()) {
- if (eObject instanceof Area) {
- return (Area) eObject;
- }
- }
- return null;
- } */
-
/* public static @NonNull Variable createVariable(@NonNull String name, @NonNull Type type) {
Variable bodyIt = PivotFactory.eINSTANCE.createVariable();
bodyIt.setName(name);
@@ -280,8 +232,13 @@ public class QVTimperativeUtil extends QVTbaseUtil
return null;
}
- public static @Nullable ImperativeDomain getDomain(@NonNull Mapping rule, @NonNull TypedModel typedModel) {
- return (ImperativeDomain)getDomain((Rule)rule, typedModel);
+ public static @Nullable Statement getContainingStatement(@Nullable EObject eObject) {
+ for ( ; eObject != null; eObject = eObject.eContainer()) {
+ if (eObject instanceof Statement) {
+ return (Statement) eObject;
+ }
+ }
+ return null;
}
public static @NonNull Property getTargetProperty(@NonNull SetStatement asSetStatement) {
@@ -289,13 +246,15 @@ public class QVTimperativeUtil extends QVTbaseUtil
return asSetStatement.isIsOpposite() ? ClassUtil.nonNullState(referredProperty.getOpposite()) : referredProperty;
}
- public static @Nullable TypedModel getTypedModel(@Nullable Domain domain) {
- if (domain instanceof ImperativeDomain) {
- return ((ImperativeDomain)domain).getTypedModel();
- }
- else {
- return null;
+ public static boolean isObserver(@NonNull Mapping asMapping) {
+ boolean isHazardous = false;
+ for (@NonNull Statement asStatement : ClassUtil.nullFree(asMapping.getOwnedStatements())) {
+ if ((asStatement instanceof ObservableStatement)
+ && (((ObservableStatement)asStatement).getObservedProperties().size() > 0)) {
+ return true;
+ }
}
+ return isHazardous;
}
public static boolean isPrimitiveVariable(@NonNull VariableDeclaration asVariable) {
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/CoreDomain.gif b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/CoreDomain.gif
deleted file mode 100644
index dda4a7021..000000000
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/icons/CoreDomain.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/labeling/QVTimperativeLabelProvider.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative.ui/src/org/eclipse/qvtd/xtext/qvtimperative/ui/labeling/QVTimperativeLabelProvider.java
index 469f58d52..f3482d3da 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
@@ -19,7 +19,6 @@ import org.eclipse.ocl.pivot.internal.prettyprint.PrettyPrinter;
import org.eclipse.ocl.pivot.utilities.NameUtil;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.qvtd.pivot.qvtbase.Predicate;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
@@ -28,7 +27,6 @@ import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.xtext.qvtbase.ui.labeling.QVTbaseLabelProvider;
-import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TopLevelCS;
import com.google.inject.Inject;
@@ -51,14 +49,6 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
// return QVTCOREBASE_UI_ICONS + "Direction.gif";
// }
- protected String image(DomainCS ele) {
- return QVTIMPERATIVE_UI_ICONS + "CoreDomain.gif";
- }
-
- protected String image(ImperativeDomain ele) {
- return QVTIMPERATIVE_UI_ICONS + "CoreDomain.gif";
- }
-
protected String image(Mapping ele) {
return QVTIMPERATIVE_UI_ICONS + "Mapping.gif";
}
@@ -87,22 +77,6 @@ public class QVTimperativeLabelProvider extends QVTbaseLabelProvider
return "QVTiModelFile.gif";
}
- protected String text(ImperativeDomain ele) {
- StringBuilder s = new StringBuilder();
- if (ele.isIsCheckable()) {
- s.append("«checkable» ");
- }
- if (ele.isIsEnforceable()) {
- s.append("«enforceable» ");
- }
- appendName(s, ele);
- return s.toString();
- }
-
- protected String text(DomainCS ele) {
- return NameUtil.getSafeName(ele);
- }
-
protected String text(MappingCall ele) {
return NameUtil.getSafeName(ele.getReferredMapping());
}
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 c2d33ecb1..22e5a96fe 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
@@ -54,8 +54,8 @@ public class QVTimperativeOutlineTreeProvider extends QVTbaseOutlineTreeProvider
}
protected void _createChildren(IOutlineNode parentNode, MappingLoop ele) {
- if (ele.getOwnedSource() != null) {
- createNode(parentNode, ele.getOwnedSource());
+ if (ele.getOwnedExpression() != null) {
+ createNode(parentNode, ele.getOwnedExpression());
}
for (LoopVariable asIterator : ele.getOwnedIterators()) {
createNode(parentNode, asIterator);
@@ -66,7 +66,7 @@ public class QVTimperativeOutlineTreeProvider extends QVTbaseOutlineTreeProvider
}
protected void _createChildren(IOutlineNode parentNode, SetStatement ele) {
- createNode(parentNode, ele.getOwnedInit());
+ createNode(parentNode, ele.getOwnedExpression());
}
protected void _createChildren(IOutlineNode parentNode, TopLevelCS ele) {
@@ -94,7 +94,7 @@ public class QVTimperativeOutlineTreeProvider extends QVTbaseOutlineTreeProvider
}
protected void _createChildren(IOutlineNode parentNode, DeclareStatement ele) {
- createNode(parentNode, ele.getOwnedInit());
+ createNode(parentNode, ele.getOwnedExpression());
}
protected void _createNode(IOutlineNode parentNode, TopLevelCS ele) {
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
index 116ffde04..208fb1c02 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
@@ -71,8 +71,8 @@ import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
+import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
@@ -83,8 +83,8 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.MappingStatement;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Statement;
import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
@@ -96,8 +96,8 @@ import org.eclipse.qvtd.xtext.qvtbasecs.QVTbaseCSPackage;
import org.eclipse.qvtd.xtext.qvtbasecs.QualifiedPackageCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.AddStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.CheckStatementCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.DeclareStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DirectionCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.GuardVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.InoutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS;
@@ -108,7 +108,6 @@ import org.eclipse.qvtd.xtext.qvtimperativecs.MappingStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.NewStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.OutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.ParamDeclarationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.DeclareStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage;
import org.eclipse.qvtd.xtext.qvtimperativecs.QueryCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.SetStatementCS;
@@ -236,10 +235,6 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
}
- protected @NonNull DomainCS createCoreDomain(@NonNull ImperativeDomain asCoreDomain) {
- return context.refreshElement(DomainCS.class, QVTimperativeCSPackage.Literals.DOMAIN_CS, asCoreDomain);
- }
-
protected void gatherTransformations(@NonNull List<Transformation> asTransformations, @NonNull List<Package> ownedPackages) {
for (org.eclipse.ocl.pivot.Package asPackage : ownedPackages) {
for (org.eclipse.ocl.pivot.Class asClass : asPackage.getOwnedClasses()) {
@@ -298,6 +293,16 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
}
+ protected void refreshObservedProperties(@NonNull ObservableStatement asStatement, /*@NonNull*/ List<PathNameCS> csPathNames, /*@NonNull*/ List<@NonNull Property> asProperties) {
+ List<PathNameCS> pathNames = new ArrayList<PathNameCS>();
+ for (@NonNull Property asProperty : asProperties) {
+ @NonNull PathNameCS csPathName = BaseCSFactory.eINSTANCE.createPathNameCS();
+ pathNames.add(csPathName);
+ context.refreshPathName(csPathName, asProperty, PivotUtil.getContainingNamespace(asStatement));
+ }
+ context.refreshList(csPathNames, pathNames);
+ }
+
protected void refreshOwnedInTransformation(@NonNull MappingCS csMapping, @NonNull Mapping asMapping) {
Transformation asTransformation = asMapping.getTransformation();
if (asTransformation != null) {
@@ -348,7 +353,8 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
ConnectionVariable asVariable = asAddStatement.getTargetVariable();
assert asVariable != null;
csStatement.setTargetVariable(asVariable);
- csStatement.setOwnedExpression(context.visitDeclaration(ExpCS.class, asAddStatement.getOwnedInit()));
+ csStatement.setOwnedExpression(context.visitDeclaration(ExpCS.class, asAddStatement.getOwnedExpression()));
+ refreshObservedProperties(asAddStatement, csStatement.getObservedProperties(), ClassUtil.nullFree(asAddStatement.getObservedProperties()));
return csStatement;
}
@@ -362,7 +368,8 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
assert asPredicate.eContainer() instanceof Mapping;
CheckStatementCS csPredicate = context.refreshElement(CheckStatementCS.class, QVTimperativeCSPackage.Literals.CHECK_STATEMENT_CS, asPredicate);
csPredicate.setPivot(asPredicate);
- csPredicate.setOwnedCondition(createExpCS(asPredicate.getOwnedCondition()));
+ csPredicate.setOwnedCondition(createExpCS(asPredicate.getOwnedExpression()));
+ refreshObservedProperties(asPredicate, csPredicate.getObservedProperties(), ClassUtil.nullFree(asPredicate.getObservedProperties()));
return csPredicate;
}
@@ -374,8 +381,9 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
@Override
public ElementCS visitDeclareStatement(@NonNull DeclareStatement asVariable) {
DeclareStatementCS csVariable = refreshTypedElement(DeclareStatementCS.class, QVTimperativeCSPackage.Literals.DECLARE_STATEMENT_CS, asVariable);
- csVariable.setOwnedInit(context.visitDeclaration(ExpCS.class, asVariable.getOwnedInit()));
+ csVariable.setOwnedExpression(context.visitDeclaration(ExpCS.class, asVariable.getOwnedExpression()));
csVariable.setIsChecked(asVariable.isIsChecked());
+ refreshObservedProperties(asVariable, csVariable.getObservedProperties(), ClassUtil.nullFree(asVariable.getObservedProperties()));
return csVariable;
}
@@ -414,19 +422,6 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
}
@Override
- public ElementCS visitImperativeDomain(@NonNull ImperativeDomain asCoreDomain) {
- DomainCS csDomain = createCoreDomain(asCoreDomain);
- csDomain.setPivot(asCoreDomain);
- csDomain.setIsCheck(asCoreDomain.isIsCheckable());
- csDomain.setDirection((ImperativeTypedModel) asCoreDomain.getTypedModel());
- csDomain.setIsEnforce(asCoreDomain.isIsEnforceable());
- Transformation asTransformation = QVTbaseUtil.getContainingTransformation(asCoreDomain);
- assert asTransformation != null;
- refreshUsedProperties(asTransformation, csDomain.getCheckedProperties(), ClassUtil.nullFree(asCoreDomain.getCheckedProperties()));
- return csDomain;
- }
-
- @Override
public ElementCS visitImperativeModel(@NonNull ImperativeModel asModel) {
assert asModel.eContainer() == null;
TopLevelCS csDocument = context.refreshElement(TopLevelCS.class, QVTimperativeCSPackage.Literals.TOP_LEVEL_CS, asModel);
@@ -555,7 +550,6 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
refreshOwnedInTransformation(csMapping, asMapping);
context.refreshList(csMapping.getOwnedGuardVariables(), context.visitDeclarations(GuardVariableCS.class, asMapping.getOwnedGuardVariables(), null));
context.refreshList(csMapping.getOwnedInoutVariables(), context.visitDeclarations(InoutVariableCS.class, asMapping.getInoutVariables(), null));
- context.refreshList(csMapping.getOwnedDomains(), context.visitDeclarations(DomainCS.class, asMapping.getDomain(), null));
context.refreshList(csMapping.getOwnedStatements(), context.visitDeclarations(StatementCS.class, asMapping.getOwnedStatements(), null));
return csMapping;
}
@@ -574,7 +568,6 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
public ElementCS visitMappingCallBinding(@NonNull MappingCallBinding asMappingCallBinding) {
MappingCallBindingCS csMappingCallBinding = context.refreshElement(MappingCallBindingCS.class, QVTimperativeCSPackage.Literals.MAPPING_CALL_BINDING_CS, asMappingCallBinding);
csMappingCallBinding.setPivot(asMappingCallBinding);
- csMappingCallBinding.setIsPolled(asMappingCallBinding.isIsPolled());
csMappingCallBinding.setReferredVariable(asMappingCallBinding.getBoundVariable());
csMappingCallBinding.setOwnedValue(createExpCS(asMappingCallBinding.getValue()));
return csMappingCallBinding;
@@ -585,8 +578,9 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
MappingLoopCS csMappingLoop = context.refreshElement(MappingLoopCS.class, QVTimperativeCSPackage.Literals.MAPPING_LOOP_CS, asMappingLoop);
csMappingLoop.setPivot(asMappingLoop);
csMappingLoop.setOwnedIterator(context.visitDeclaration(VariableCS.class, asMappingLoop.getOwnedIterators().get(0)));
- csMappingLoop.setOwnedInExpression(createExpCS(asMappingLoop.getOwnedSource()));
+ csMappingLoop.setOwnedInExpression(createExpCS(asMappingLoop.getOwnedExpression()));
context.refreshList(csMappingLoop.getOwnedMappingStatements(), context.visitDeclarations(MappingStatementCS.class, asMappingLoop.getOwnedMappingStatements(), null));
+ refreshObservedProperties(asMappingLoop, csMappingLoop.getObservedProperties(), ClassUtil.nullFree(asMappingLoop.getObservedProperties()));
return csMappingLoop;
}
@@ -602,11 +596,17 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
NewStatementCS csNewStatement = context.refreshNamedElement(NewStatementCS.class, QVTimperativeCSPackage.Literals.NEW_STATEMENT_CS, asNewStatement);
csNewStatement.setOwnedType(createTypeRefCS(asNewStatement.getType(), asUsedPackage));
csNewStatement.setReferredTypedModel(asTypedModel);
- csNewStatement.setOwnedInit(context.visitDeclaration(ExpCS.class, asNewStatement.getOwnedInit()));
+ csNewStatement.setOwnedExpression(context.visitDeclaration(ExpCS.class, asNewStatement.getOwnedExpression()));
+ refreshObservedProperties(asNewStatement, csNewStatement.getObservedProperties(), ClassUtil.nullFree(asNewStatement.getObservedProperties()));
return csNewStatement;
}
@Override
+ public ElementCS visitObservableStatement(@NonNull ObservableStatement object) {
+ return visiting(object);
+ }
+
+ @Override
public ElementCS visitOutConnectionVariable(@NonNull OutConnectionVariable asVariable) {
OutVariableCS csVariable = context.refreshNamedElement(OutVariableCS.class, QVTimperativeCSPackage.Literals.OUT_VARIABLE_CS, asVariable);
csVariable.setPivot(asVariable);
@@ -657,8 +657,9 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
SetStatementCS csStatement = context.refreshElement(SetStatementCS.class, QVTimperativeCSPackage.Literals.SET_STATEMENT_CS, asSetStatement);
csStatement.setReferredVariable(asSetStatement.getTargetVariable());
csStatement.setReferredProperty(QVTimperativeUtil.getTargetProperty(asSetStatement));
- csStatement.setOwnedInit(createExpCS(asSetStatement.getOwnedInit()));
+ csStatement.setOwnedExpression(createExpCS(asSetStatement.getOwnedExpression()));
csStatement.setIsNotify(asSetStatement.isIsNotify());
+ refreshObservedProperties(asSetStatement, csStatement.getObservedProperties(), ClassUtil.nullFree(asSetStatement.getObservedProperties()));
return csStatement;
}
@@ -699,11 +700,11 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
if (asPredicate instanceof VariablePredicate) {
VariablePredicate asVariablePredicate = (VariablePredicate)asPredicate;
if (asVariablePredicate.getTargetVariable() == asVariable) {
- OCLExpression ownedInit = asVariablePredicate.getConditionExpression();
+ OCLExpression ownedExpression = asVariablePredicate.getConditionExpression();
PredicateVariableCS csUnrealizedVariable = context.refreshNamedElement(PredicateVariableCS.class, QVTimperativeCSPackage.Literals.PREDICATE_VARIABLE_CS, asVariable);
csUnrealizedVariable.setPivot(asVariable);
csUnrealizedVariable.setOwnedType(createTypeRefCS(asVariable.getType(), getScope(asVariable)));
- csUnrealizedVariable.setOwnedInitExpression(context.visitDeclaration(ExpCS.class, ownedInit));
+ csUnrealizedVariable.setOwnedExpressionExpression(context.visitDeclaration(ExpCS.class, ownedExpression));
return csUnrealizedVariable;
}
}
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 910f37b15..2226176a0 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
@@ -43,7 +43,6 @@ import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeModel;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
@@ -62,7 +61,6 @@ import org.eclipse.qvtd.xtext.qvtimperativecs.AddStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.CheckStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DeclareStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DirectionCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.GuardVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.InoutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS;
@@ -96,29 +94,6 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
}
}
- protected static class DomainContentContinuation extends SingleContinuation<DomainCS>
- {
- private DomainContentContinuation(@NonNull CS2ASConversion context, @NonNull DomainCS csElement) {
- super(context, null, null, csElement);
- }
-
- @Override
- public BasicContinuation<?> execute() {
- ImperativeDomain pDomain = PivotUtil.getPivot(ImperativeDomain.class, csElement);
- if (pDomain != null) {
- TypedModel direction = csElement.getDirection();
- if (direction == null) {
- Transformation transformation = QVTbaseUtil.getContainingTransformation(pDomain);
- if (transformation != null) {
- direction = transformation.getModelParameter(null);
- }
- }
- pDomain.setTypedModel(direction);
- }
- return null;
- }
- }
-
public static class GuardVariableCompletion extends SingleContinuation<@NonNull GuardVariableCS>
{
public GuardVariableCompletion(@NonNull CS2ASConversion context, @NonNull GuardVariableCS csElement) {
@@ -244,15 +219,6 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
}
@Override
- public Continuation<?> visitDomainCS(@NonNull DomainCS csElement) {
- ImperativeDomain pivotElement = context.refreshModelElement(ImperativeDomain.class, QVTimperativePackage.Literals.IMPERATIVE_DOMAIN, csElement);
- pivotElement.setIsCheckable(csElement.isIsCheck());
- pivotElement.setIsEnforceable(csElement.isIsEnforce());
- context.refreshComments(pivotElement, csElement);
- return new DomainContentContinuation(context, csElement);
- }
-
- @Override
public Continuation<?> visitGuardVariableCS(@NonNull GuardVariableCS csElement) {
refreshNamedElement(GuardVariable.class, QVTimperativePackage.Literals.GUARD_VARIABLE, csElement);
return new GuardVariableCompletion(context, csElement);
@@ -269,7 +235,6 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
Mapping pivotElement = refreshNamedElement(Mapping.class, QVTimperativePackage.Literals.MAPPING, csElement);
context.refreshPivotList(GuardVariable.class, pivotElement.getOwnedGuardVariables(), csElement.getOwnedGuardVariables());
context.refreshPivotList(InConnectionVariable.class, pivotElement.getInoutVariables(), csElement.getOwnedInoutVariables());
- context.refreshPivotList(ImperativeDomain.class, pivotElement.getDomain(), csElement.getOwnedDomains());
context.refreshPivotList(Statement.class, pivotElement.getOwnedStatements(), csElement.getOwnedStatements());
return null;
}
@@ -286,7 +251,6 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
@Override
public Continuation<?> visitMappingCallBindingCS(@NonNull MappingCallBindingCS csElement) {
@NonNull MappingCallBinding pivotElement = context.refreshModelElement(MappingCallBinding.class, QVTimperativePackage.Literals.MAPPING_CALL_BINDING, csElement);
- pivotElement.setIsPolled(csElement.isIsPolled());
context.refreshComments(pivotElement, csElement);
return null;
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java
index 4a5450927..f606001a8 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
@@ -29,17 +29,17 @@ import org.eclipse.ocl.xtext.essentialoclcs.ExpCS;
import org.eclipse.qvtd.pivot.qvtbase.Function;
import org.eclipse.qvtd.pivot.qvtimperative.AddStatement;
import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
-import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.SetStatement;
import org.eclipse.qvtd.xtext.qvtimperativecs.AddStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.CheckStatementCS;
+import org.eclipse.qvtd.xtext.qvtimperativecs.DeclareStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DirectionCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.GuardVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallBindingCS;
@@ -47,7 +47,6 @@ import org.eclipse.qvtd.xtext.qvtimperativecs.MappingLoopCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.NewStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.OutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.ParamDeclarationCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.DeclareStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.QueryCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.SetStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.TopLevelCS;
@@ -106,7 +105,7 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
ExpCS csInitialiser = csElement.getOwnedExpression();
if (csInitialiser != null) {
OCLExpression initialiser = context.visitLeft2Right(OCLExpression.class, csInitialiser);
- asAddStatement.setOwnedInit(initialiser);
+ asAddStatement.setOwnedExpression(initialiser);
}
}
return null;
@@ -121,7 +120,7 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
if (csCondition != null) {
asCondition = context.visitLeft2Right(OCLExpression.class, csCondition);
}
- asPredicate.setOwnedCondition(asCondition);
+ asPredicate.setOwnedExpression(asCondition);
}
return null;
}
@@ -135,10 +134,10 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
public Continuation<?> visitDeclareStatementCS(@NonNull DeclareStatementCS csElement) {
DeclareStatement asVariable = PivotUtil.getPivot(DeclareStatement.class, csElement);
if (asVariable != null) {
- ExpCS expression = csElement.getOwnedInit();
+ ExpCS expression = csElement.getOwnedExpression();
if (expression != null) {
OCLExpression target = context.visitLeft2Right(OCLExpression.class, expression);
- asVariable.setOwnedInit(target);
+ asVariable.setOwnedExpression(target);
if ((csElement.getOwnedType() == null) && (target != null)) {
context.setType(asVariable, target.getType(), target.isIsRequired(), target.getTypeValue());
}
@@ -152,7 +151,7 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
ExpCS csTarget = csElement.getOwnedTarget();
assert csTarget != null;
OCLExpression target = context.visitLeft2Right(OCLExpression.class, csTarget);
- ExpCS csInitialiser = csElement.getOwnedInit();
+ ExpCS csInitialiser = csElement.getOwnedExpression();
assert csInitialiser != null;
CheckVariableStatement assignment = null;
if (target instanceof NavigationCallExp) {
@@ -169,7 +168,7 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
}
if (assignment != null) {
OCLExpression initialiser = context.visitLeft2Right(OCLExpression.class, csInitialiser);
- assignment.setOwnedInit(initialiser);
+ assignment.setOwnedExpression(initialiser);
// pAssignments.add(assignment);
}
return null;
@@ -181,11 +180,6 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
}
@Override
- public Continuation<?> visitDomainCS(@NonNull DomainCS csElement) {
- return null;
- }
-
- @Override
public Continuation<?> visitGuardVariableCS(@NonNull GuardVariableCS csElement) {
GuardVariable asGuardVariable = PivotUtil.getPivot(GuardVariable.class, csElement);
if (asGuardVariable != null) {
@@ -212,7 +206,7 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
if (expression != null) {
OCLExpression target = context.visitLeft2Right(OCLExpression.class, expression);
if (target != null) {
- pMappingLoop.setOwnedSource(target);
+ pMappingLoop.setOwnedExpression(target);
List<LoopVariable> iterators = pMappingLoop.getOwnedIterators();
if (iterators.size() > 0) {
LoopVariable iterator = iterators.get(0);
@@ -235,10 +229,10 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
NewStatement asNewStatement = PivotUtil.getPivot(NewStatement.class, csElement);
if (asNewStatement != null) {
asNewStatement.setReferredTypedModel(csElement.getReferredTypedModel());
- ExpCS expression = csElement.getOwnedInit();
+ ExpCS expression = csElement.getOwnedExpression();
if (expression != null) {
OCLExpression target = context.visitLeft2Right(OCLExpression.class, expression);
- asNewStatement.setOwnedInit(target);
+ asNewStatement.setOwnedExpression(target);
}
}
return null;
@@ -278,11 +272,11 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
boolean isImplicit = targetProperty.isIsImplicit();
setStatement.setTargetProperty(isImplicit ? targetProperty.getOpposite() : targetProperty);
setStatement.setIsOpposite(isImplicit);
- ExpCS csInitialiser = csElement.getOwnedInit();
+ ExpCS csInitialiser = csElement.getOwnedExpression();
OCLExpression target = csInitialiser != null ? context.visitLeft2Right(OCLExpression.class, csInitialiser) : null;
setStatement.setTargetProperty(targetProperty);
// propertyAssignment.setIsOpposite(target instanceof FeatureCallExp); // FIXME isOpposite
- setStatement.setOwnedInit(target);
+ setStatement.setOwnedExpression(target);
// pAssignments.add(assignment);
}
return null;
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java
index a61c09d2e..e4db4c055 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java
@@ -29,6 +29,7 @@ import org.eclipse.ocl.xtext.base.cs2as.PivotDependency;
import org.eclipse.ocl.xtext.base.cs2as.SingleContinuation;
import org.eclipse.ocl.xtext.basecs.ElementCS;
import org.eclipse.ocl.xtext.basecs.PathNameCS;
+import org.eclipse.ocl.xtext.basecs.PivotableElementCS;
import org.eclipse.ocl.xtext.basecs.TypedRefCS;
import org.eclipse.ocl.xtext.essentialoclcs.VariableCS;
import org.eclipse.qvtd.pivot.qvtbase.Function;
@@ -36,7 +37,6 @@ import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
-import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
import org.eclipse.qvtd.pivot.qvtimperative.InConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.LoopVariable;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
@@ -44,12 +44,13 @@ import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCallBinding;
import org.eclipse.qvtd.pivot.qvtimperative.MappingLoop;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.ObservableStatement;
import org.eclipse.qvtd.pivot.qvtimperative.OutConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
+import org.eclipse.qvtd.xtext.qvtimperativecs.AddStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.CheckStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DeclareStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.DirectionCS;
-import org.eclipse.qvtd.xtext.qvtimperativecs.DomainCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.GuardVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.InoutVariableCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS;
@@ -252,27 +253,36 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
}
}
- private void refreshUsedProperties(@NonNull DomainCS csDomain,
- /*@NonNull*/ List<Property> asProperties, /*@NonNull*/ List<PathNameCS> csProperties) {
+ private void refreshObservedProperties(@NonNull PivotableElementCS csElement, /*@NonNull*/ List<PathNameCS> csProperties) {
+ ObservableStatement asElement = PivotUtil.getPivot(ObservableStatement.class, csElement);
+ assert asElement != null;
List<Property> properties = new ArrayList<Property>();
for (PathNameCS csPathName : csProperties) {
if (csPathName != null) {
- Property asProperty = lookupProperty(csDomain, csPathName, null);
+ Property asProperty = lookupProperty(csElement, csPathName, null);
if (asProperty != null) {
properties.add(asProperty);
}
}
}
- context.refreshList(asProperties, properties);
+ context.refreshList(asElement.getObservedProperties(), properties);
+ }
+
+ @Override
+ public Continuation<?> visitAddStatementCS(@NonNull AddStatementCS csElement) {
+ refreshObservedProperties(csElement, csElement.getObservedProperties());
+ return null;
}
@Override
public Continuation<?> visitCheckStatementCS(@NonNull CheckStatementCS csElement) {
+ refreshObservedProperties(csElement, csElement.getObservedProperties());
return null;
}
@Override
public @Nullable Continuation<?> visitDeclareStatementCS(@NonNull DeclareStatementCS csElement) {
+ refreshObservedProperties(csElement, csElement.getObservedProperties());
return new DeclareStatementCompletion(context, csElement);
}
@@ -282,15 +292,6 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
}
@Override
- public @Nullable Continuation<?> visitDomainCS(@NonNull DomainCS csDomain) {
- ImperativeDomain asArea = PivotUtil.getPivot(ImperativeDomain.class, csDomain);
- if (asArea != null) {
- refreshUsedProperties(csDomain, asArea.getCheckedProperties(), csDomain.getCheckedProperties());
- }
- return null;
- }
-
- @Override
public @Nullable Continuation<?> visitGuardVariableCS(@NonNull GuardVariableCS csElement) {
return new GuardVariableCompletion(context, csElement);
}
@@ -329,11 +330,13 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
@Override
public Continuation<?> visitMappingLoopCS(@NonNull MappingLoopCS csElement) {
+ refreshObservedProperties(csElement, csElement.getObservedProperties());
return new MappingLoopIteratorCompletion(context, csElement);
}
@Override
public Continuation<?> visitNewStatementCS(@NonNull NewStatementCS csElement) {
+ refreshObservedProperties(csElement, csElement.getObservedProperties());
return new NewStatementCompletion(context, csElement);
}
@@ -354,6 +357,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
@Override
public Continuation<?> visitSetStatementCS(@NonNull SetStatementCS csElement) {
+ refreshObservedProperties(csElement, csElement.getObservedProperties());
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 08e93cb76..2cfdcf4bc 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
@@ -29,8 +29,6 @@ import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.QueryCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.ScopeNameCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.SetStatementCSElements;
-import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.SourceDomainCSElements;
-import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.TargetDomainCSElements;
import org.eclipse.qvtd.xtext.qvtimperative.services.QVTimperativeGrammarAccess.TransformationCSElements;
import org.eclipse.xtext.formatting.impl.FormattingConfig;
@@ -79,8 +77,10 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
{
AddStatementCSElements a = f.getAddStatementCSAccess();
- c.setLinewrap(1).before(a.getAddKeyword_0());
- c.setNoSpace().before(a.getSemicolonKeyword_4());
+ c.setLinewrap(1).before(a.getObserveKeyword_0_0());
+ c.setNoSpace().before(a.getCommaKeyword_0_2_0());
+ c.setLinewrap(1).before(a.getAddKeyword_1());
+ c.setNoSpace().before(a.getSemicolonKeyword_5());
}
{
CheckStatementCSElements a = f.getCheckStatementCSAccess();
@@ -90,14 +90,15 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
}
{
DeclareStatementCSElements a = f.getDeclareStatementCSAccess();
- c.setLinewrap(1).before(a.getIsCheckedAssignment_0());
- setNoSpaceLineWrap(c, a.getSemicolonKeyword_6());
+ c.setLinewrap(1).before(a.getObserveKeyword_0_0());
+ c.setNoSpace().before(a.getCommaKeyword_0_2_0());
+ c.setLinewrap(1).before(a.getIsCheckedAssignment_1());
+ setNoSpaceLineWrap(c, a.getSemicolonKeyword_7());
}
{
DirectionCSElements a = f.getDirectionCSAccess();
c.setLinewrap(1).before(a.getAlternatives_1());
c.setNoSpace().before(a.getCommaKeyword_5_0());
- c.setNoSpace().before(a.getCommaKeyword_6_2_0());
}
{
GuardVariableCSElements a = f.getGuardVariableCSAccess();
@@ -117,10 +118,10 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
{
MappingCSElements a = f.getMappingCSAccess();
c.setLinewrap(2).before(a.getMapKeyword_1());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_10());
- setBraces(c, a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_10());
+ c.setNoSpace().between(a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_9());
+ setBraces(c, a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_9());
// c.setLinewrap(2).between(a.getDomainsAssignment_5(), a.getDomainsAssignment_5());
- c.setLinewrap(1).before(a.getOwnedDomainsAssignment_5());
+ // c.setLinewrap(1).before(a.getOwnedDomainsAssignment_5());
}
{
MappingCallCSElements a = f.getMappingCallCSAccess();
@@ -136,13 +137,17 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
}
{
MappingLoopCSElements a = f.getMappingLoopCSAccess();
- setAppendedBraces(c, a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_6());
+ c.setLinewrap(1).before(a.getObserveKeyword_0_0());
+ c.setNoSpace().before(a.getCommaKeyword_0_2_0());
+ setAppendedBraces(c, a.getLeftCurlyBracketKeyword_5(), a.getRightCurlyBracketKeyword_7());
}
{
NewStatementCSElements a = f.getNewStatementCSAccess();
- c.setLinewrap(1).before(a.getNewKeyword_0());
- c.setNoSpace().around(a.getColonKeyword_1());
- c.setNoSpace().before(a.getSemicolonKeyword_7());
+ c.setLinewrap(1).before(a.getObserveKeyword_0_0());
+ c.setNoSpace().before(a.getCommaKeyword_0_2_0());
+ c.setLinewrap(1).before(a.getNewKeyword_1());
+ c.setNoSpace().around(a.getColonKeyword_2());
+ c.setNoSpace().before(a.getSemicolonKeyword_8());
}
{
OutVariableCSElements a = f.getOutVariableCSAccess();
@@ -175,29 +180,11 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
}
{
SetStatementCSElements a = f.getSetStatementCSAccess();
- c.setLinewrap(1).before(a.getIsNotifyAssignment_0());
- c.setNoSpace().around(a.getFullStopKeyword_3());
- c.setNoSpace().before(a.getSemicolonKeyword_7());
- }
- {
- SourceDomainCSElements a = f.getSourceDomainCSAccess();
- c.setNoLinewrap().before(a.getLeftCurlyBracketKeyword_2_0());
- c.setLinewrap().after(a.getLeftCurlyBracketKeyword_2_0());
- c.setNoSpace().before(a.getCommaKeyword_2_1_2_0());
- c.setLinewrap().after(a.getCommaKeyword_2_1_2_0());
- c.setLinewrap().after(a.getRightCurlyBracketKeyword_2_2());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_2());
- c.setIndentation(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_2());
- }
- {
- TargetDomainCSElements a = f.getTargetDomainCSAccess();
- c.setNoLinewrap().before(a.getLeftCurlyBracketKeyword_2_0());
- c.setLinewrap().after(a.getLeftCurlyBracketKeyword_2_0());
- c.setNoSpace().before(a.getCommaKeyword_2_1_2_0());
- c.setLinewrap().after(a.getCommaKeyword_2_1_2_0());
- c.setLinewrap().after(a.getRightCurlyBracketKeyword_2_2());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_2());
- c.setIndentation(a.getLeftCurlyBracketKeyword_2_0(), a.getRightCurlyBracketKeyword_2_2());
+ c.setLinewrap(1).before(a.getObserveKeyword_0_0());
+ c.setNoSpace().before(a.getCommaKeyword_0_2_0());
+ c.setLinewrap(1).before(a.getIsNotifyAssignment_1());
+ c.setNoSpace().around(a.getFullStopKeyword_4());
+ c.setNoSpace().before(a.getSemicolonKeyword_8());
}
// {
// TopLevelCSElements a = f.getTopLevelCSAccess();

Back to the top