Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2015-06-07 09:39:27 +0000
committerEd Willink2015-06-07 09:41:40 +0000
commitbf8ebaaad5666d93c8190214ae1624fc10ae44ea (patch)
tree66b88963cb72dc1ad83ca0f3ac060a696a0c720c
parentc0b9c9b00f6cb5b317ed9afd3968b2e971be32b9 (diff)
downloadorg.eclipse.qvtd-bf8ebaaad5666d93c8190214ae1624fc10ae44ea.tar.gz
org.eclipse.qvtd-bf8ebaaad5666d93c8190214ae1624fc10ae44ea.tar.xz
org.eclipse.qvtd-bf8ebaaad5666d93c8190214ae1624fc10ae44ea.zip
[469560] Use VMEnvironmentFactory, createNestedEvaluator consistently
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/AbstractQVTiVMEvaluationVisitor.java18
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/IQVTiVMEvaluationVisitor.java5
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMEvaluationVisitor.java34
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMNestedEvaluationEnvironment.java2
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationEnvironment.java10
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationVisitor.java2
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java15
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/IQVTiEvaluationVisitor.java4
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractEvaluationVisitor.java28
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java14
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitorDecorator.java12
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTracingEvaluationVisitor.java11
12 files changed, 119 insertions, 36 deletions
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/AbstractQVTiVMEvaluationVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/AbstractQVTiVMEvaluationVisitor.java
index 6e49d892a..1397a5ef0 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/AbstractQVTiVMEvaluationVisitor.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/AbstractQVTiVMEvaluationVisitor.java
@@ -21,6 +21,7 @@ import org.eclipse.ocl.examples.debug.vm.evaluator.IVMEvaluationEnvironment;
import org.eclipse.ocl.examples.debug.vm.utils.VMInterruptedExecutionException;
import org.eclipse.ocl.pivot.CompleteEnvironment;
import org.eclipse.ocl.pivot.Element;
+import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.StandardLibrary;
import org.eclipse.ocl.pivot.Type;
@@ -71,7 +72,7 @@ public abstract class AbstractQVTiVMEvaluationVisitor extends AbstractWrappingQV
}
public @NonNull IQVTiVMEvaluationEnvironment getVMEvaluationEnvironment() {
- return (IQVTiVMEvaluationEnvironment) delegate.getEvaluationEnvironment();
+ return delegate.getVMEvaluationEnvironment();
}
public @NonNull String getPluginId() {
@@ -164,8 +165,9 @@ public abstract class AbstractQVTiVMEvaluationVisitor extends AbstractWrappingQV
if (VMVirtualMachine.PRE_VISIT.isActive()) {
VMVirtualMachine.PRE_VISIT.println("[" + Thread.currentThread().getName() + "] " + element.eClass().getName() + ": " + element.toString());
}
- Element previousIP = setCurrentEnvInstructionPointer(null/*element*/);
+// Element previousIP = setCurrentEnvInstructionPointer(null/*element*/);
IVMEvaluationEnvironment evalEnv = getVMEvaluationEnvironment();
+ Element previousIP = evalEnv.getCurrentIP();
preVisit(evalEnv, element);
return previousIP;
}
@@ -176,7 +178,9 @@ public abstract class AbstractQVTiVMEvaluationVisitor extends AbstractWrappingQV
// TODO Auto-generated method stub
// }
-
+
+ /** @deprecated no lon ger used */
+ @Deprecated
protected Element setCurrentEnvInstructionPointer(Element element) {
IVMEvaluationEnvironment evalEnv = getVMEvaluationEnvironment();
if (element != null) {
@@ -199,6 +203,8 @@ public abstract class AbstractQVTiVMEvaluationVisitor extends AbstractWrappingQV
return result;
}
+ /** @deprecated provide nestedElement argument */
+ @Deprecated
@Override
public @NonNull IQVTiVMEvaluationVisitor createNestedEvaluator() { // FIXME Pass 'operation'
// return delegate.createNestedEvaluator();
@@ -206,6 +212,12 @@ public abstract class AbstractQVTiVMEvaluationVisitor extends AbstractWrappingQV
}
@Override
+ public @NonNull IQVTiVMEvaluationVisitor createNestedEvaluator(@NonNull NamedElement nestedElement) {
+// return delegate.createNestedEvaluator();
+ return new QVTiVMNestedEvaluationVisitor(this, delegate.createNestedEvaluator(nestedElement));
+ }
+
+ @Override
public @Nullable Object evaluate(@NonNull OCLExpression body) {
return delegate.evaluate(body);
}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/IQVTiVMEvaluationVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/IQVTiVMEvaluationVisitor.java
index c75260c1d..f45da90f0 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/IQVTiVMEvaluationVisitor.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/IQVTiVMEvaluationVisitor.java
@@ -14,13 +14,18 @@ package org.eclipse.qvtd.debug.evaluator;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.debug.vm.evaluator.IVMEvaluationVisitor;
+import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.util.Visitable;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.IQVTiEvaluationVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
public interface IQVTiVMEvaluationVisitor extends IVMEvaluationVisitor, IQVTiEvaluationVisitor, QVTimperativeVisitor<Object>
{
+ /** @deprecated provide nestedElement argument */
+ @Deprecated
@NonNull IQVTiVMEvaluationVisitor createNestedEvaluator();
+ @NonNull IQVTiVMEvaluationVisitor createNestedEvaluator(@NonNull NamedElement nestedElement);
void dispose();
+ @NonNull IQVTiVMEvaluationEnvironment getVMEvaluationEnvironment();
Object safeVisit(@Nullable Visitable v);
}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMEvaluationVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMEvaluationVisitor.java
index 48dad22ba..07bfb22d2 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMEvaluationVisitor.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMEvaluationVisitor.java
@@ -12,6 +12,7 @@
package org.eclipse.qvtd.debug.evaluator;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.examples.debug.vm.evaluator.IVMEnvironmentFactory;
import org.eclipse.ocl.examples.debug.vm.evaluator.IVMEvaluationVisitor;
import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.evaluation.EvaluationEnvironment;
@@ -22,8 +23,9 @@ import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitor;
/**
* QVTiVMEvaluationVisitorImpl is the class for ...
*/
-public class QVTiVMEvaluationVisitor extends QVTiEvaluationVisitor implements IQVTiVMEvaluationVisitor {
-
+public class QVTiVMEvaluationVisitor extends QVTiEvaluationVisitor implements IQVTiVMEvaluationVisitor
+{
+ protected final @NonNull IVMEnvironmentFactory vmEnvironmentFactory;
/**
* Instantiates a new OCL evaluation visitor impl.
@@ -35,8 +37,11 @@ public class QVTiVMEvaluationVisitor extends QVTiEvaluationVisitor implements IQ
*/
public QVTiVMEvaluationVisitor(@NonNull IQVTiVMEvaluationEnvironment evalEnv) {
super(evalEnv);
+ vmEnvironmentFactory = evalEnv.getVMEnvironmentFactory();
}
+ /** @deprecated provide nestedElement argument */
+ @Deprecated
@Override
public @NonNull IQVTiVMEvaluationVisitor createNestedEvaluator() {
IQVTiVMEvaluationEnvironment vmEvaluationEnvironment = (IQVTiVMEvaluationEnvironment)evaluationEnvironment;
@@ -45,6 +50,14 @@ public class QVTiVMEvaluationVisitor extends QVTiEvaluationVisitor implements IQ
return ne;
}
+ @Override
+ public @NonNull IQVTiVMEvaluationVisitor createNestedEvaluator(@NonNull NamedElement nestedElement) {
+ IQVTiVMEvaluationEnvironment vmEvaluationEnvironment = (IQVTiVMEvaluationEnvironment)evaluationEnvironment;
+ IQVTiVMEvaluationEnvironment nestedEvalEnv = getVMEnvironmentFactory().createVMEvaluationEnvironment(vmEvaluationEnvironment, nestedElement);
+ QVTiVMEvaluationVisitor ne = new QVTiVMEvaluationVisitor(nestedEvalEnv);
+ return ne;
+ }
+
@Override
@NonNull
public EvaluationVisitor createNestedUndecoratedEvaluator(@NonNull NamedElement operation) {
@@ -60,20 +73,20 @@ public class QVTiVMEvaluationVisitor extends QVTiEvaluationVisitor implements IQ
@Override
public @NonNull IVMEvaluationVisitor getClonedEvaluator() {
- IQVTiVMEvaluationEnvironment oldEvaluationEnvironment = getEvaluationEnvironment();
+ IQVTiVMEvaluationEnvironment oldEvaluationEnvironment = getVMEvaluationEnvironment();
IQVTiVMEvaluationEnvironment clonedEvaluationEnvironment = oldEvaluationEnvironment.createClonedEvaluationEnvironment();
return new QVTiVMEvaluationVisitor(clonedEvaluationEnvironment);
}
// @Override
public @NonNull QVTiVMEnvironmentFactory getVMEnvironmentFactory() {
- return (QVTiVMEnvironmentFactory) environmentFactory;
+ return (QVTiVMEnvironmentFactory) vmEnvironmentFactory;
}
- @Override
- public @NonNull IQVTiVMEvaluationEnvironment getEvaluationEnvironment() {
- return (IQVTiVMEvaluationEnvironment) super.getEvaluationEnvironment();
- }
+// @Override
+// public @NonNull IQVTiVMEvaluationEnvironment getEvaluationEnvironment() {
+// return (IQVTiVMEvaluationEnvironment) super.getEvaluationEnvironment();
+// }
/* (non-Javadoc)
* @see org.eclipse.ocl.pivot.evaluation.AbstractEvaluationVisitor#getModelManager()
@@ -87,4 +100,9 @@ public class QVTiVMEvaluationVisitor extends QVTiEvaluationVisitor implements IQ
public @NonNull String getPluginId() {
return QVTiDebugPlugin.PLUGIN_ID;
}
+
+ @Override
+ public @NonNull IQVTiVMEvaluationEnvironment getVMEvaluationEnvironment() {
+ return (IQVTiVMEvaluationEnvironment) super.getEvaluationEnvironment();
+ }
}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMNestedEvaluationEnvironment.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMNestedEvaluationEnvironment.java
index b7bb20d7e..4897f55f3 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMNestedEvaluationEnvironment.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMNestedEvaluationEnvironment.java
@@ -105,6 +105,8 @@ public class QVTiVMNestedEvaluationEnvironment extends QVTiNestedEvaluationEnvir
return (QVTiVMModelManager) super.getModelManager();
}
+ /** @deprecated no longer useful once Bug 469463 fixed */
+ @Deprecated
public @NonNull Map<String, Resource> getModelParameterVariables() {
return getVMRootEvaluationEnvironment().getModelParameterVariables();
}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationEnvironment.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationEnvironment.java
index 94709e7c8..0e2e1add0 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationEnvironment.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationEnvironment.java
@@ -36,7 +36,6 @@ import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.qvtd.debug.core.QVTiDebugCore;
import org.eclipse.qvtd.debug.vm.QVTiVariableFinder;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiModelManager;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiRootEvaluationEnvironment;
@@ -62,7 +61,7 @@ public class QVTiVMRootEvaluationEnvironment extends QVTiRootEvaluationEnvironme
this.id = id;
pcVariable = ClassUtil.nonNullEMF(PivotFactory.eINSTANCE.createVariable());
pcVariable.setName("$pc");
- String typeName = ClassUtil.nonNullEMF(PivotPackage.Literals.OCL_EXPRESSION.getName());
+ String typeName = ClassUtil.nonNullEMF(PivotPackage.Literals.NAMED_ELEMENT.getName());
pcVariable.setType(environmentFactory.getMetamodelManager().getASClass(typeName));
}
@@ -126,8 +125,11 @@ public class QVTiVMRootEvaluationEnvironment extends QVTiRootEvaluationEnvironme
return (QVTiVMModelManager) super.getModelManager();
}
+ /** @deprecated no longer useful */
+ @Deprecated
public @NonNull Map<String, Resource> getModelParameterVariables() {
- Transformation currentModule = getTransformation();
+ return new HashMap<String, Resource>();
+/* Transformation currentModule = getTransformation();
// if (!(currentModule instanceof Transformation)) {
// return Collections.emptyMap();
// }
@@ -149,7 +151,7 @@ public class QVTiVMRootEvaluationEnvironment extends QVTiRootEvaluationEnvironme
// result.put("_intermediate", intermModel);
// }
- return result;
+ return result; */
}
@Override
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationVisitor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationVisitor.java
index 69fd55505..5d4dc277d 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationVisitor.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMRootEvaluationVisitor.java
@@ -376,7 +376,7 @@ public class QVTiVMRootEvaluationVisitor extends AbstractQVTiVMEvaluationVisitor
element = firstElement;
}
}
- setCurrentEnvInstructionPointer(element);
+ evalEnv.setCurrentIP(element);
evalEnv.replace(evalEnv.getPCVariable(), element);
evalEnv.remove(invalidVariable);
UnitLocation unitLocation = stepper.createUnitLocation(evalEnv, element);
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java
index 039daf3c0..bded65dee 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/vm/QVTiVMVirtualMachine.java
@@ -35,6 +35,8 @@ import org.eclipse.ocl.pivot.Type;
import org.eclipse.qvtd.debug.core.QVTiDebugCore;
import org.eclipse.qvtd.debug.core.QVTiEvaluationContext;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
+import org.eclipse.qvtd.pivot.qvtbase.Pattern;
+import org.eclipse.qvtd.pivot.qvtcorebase.GuardPattern;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
@@ -53,7 +55,9 @@ public class QVTiVMVirtualMachine extends VMVirtualMachine
}
else if (eObject instanceof Type) {
if (appendElementSignature(s, eObject.eContainer())) {
- s.append("::");
+ if (s.length() > 0) {
+ s.append("::");
+ }
}
s.append(((Type)eObject).getName());
return true;
@@ -72,6 +76,13 @@ public class QVTiVMVirtualMachine extends VMVirtualMachine
s.append(((Domain)eObject).getName());
return true;
}
+ else if (eObject instanceof Pattern) {
+ if (appendElementSignature(s, eObject.eContainer())) {
+ s.append(" ");
+ }
+ s.append(eObject instanceof GuardPattern ? "«guard»" : "«bottom»");
+ return true;
+ }
else if (eObject instanceof MappingCall) {
if (appendElementSignature(s, eObject.eContainer())) {
s.append("::");
@@ -148,7 +159,7 @@ public class QVTiVMVirtualMachine extends VMVirtualMachine
appendElementSignature(s, element);
String operSignature = s.toString(); //MessageFormat.format("<{0}>", moduleName); //$NON-NLS-1$
- List<VMVariableData> vars = VariableFinder.getVariables(evalEnv);
+ List<VMVariableData> vars = VariableFinder.newInstance(evalEnv, false).getVariables();
@SuppressWarnings("null")@NonNull String locationString = location.getURI().toString();
@SuppressWarnings("null")@NonNull VMVariableData[] varsArray = vars.toArray(new VMVariableData[vars.size()]);
VMStackFrameData vmStackFrame = new VMStackFrameData(evalEnv.getID(), locationString, moduleName,
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/IQVTiEvaluationVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/IQVTiEvaluationVisitor.java
index 9e536d106..ed0ba029e 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/IQVTiEvaluationVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/IQVTiEvaluationVisitor.java
@@ -12,14 +12,18 @@ package org.eclipse.qvtd.pivot.qvtimperative.evaluation;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.evaluation.EvaluationVisitor;
import org.eclipse.ocl.pivot.util.Visitable;
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
public interface IQVTiEvaluationVisitor extends QVTimperativeVisitor<Object>, EvaluationVisitor
{
+ /** @deprecated provide nestedElement argument */
+ @Deprecated
@Override
@NonNull IQVTiEvaluationVisitor createNestedEvaluator();
+ @NonNull IQVTiEvaluationVisitor createNestedEvaluator(@NonNull NamedElement nestedElement);
@Override
void dispose();
Object safeVisit(@Nullable Visitable v);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractEvaluationVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractEvaluationVisitor.java
index 69e45c6b5..ed945ec4e 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractEvaluationVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiAbstractEvaluationVisitor.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.Import;
+import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.OppositePropertyCallExp;
import org.eclipse.ocl.pivot.Property;
@@ -79,11 +80,12 @@ public abstract class QVTiAbstractEvaluationVisitor extends OCLEvaluationVisitor
this.transformationAnalysis = getModelManager().getTransformationAnalysis();
}
- /* (non-Javadoc)
- * @see org.eclipse.ocl.pivot.evaluation.EvaluationVisitorImpl#createNestedEvaluator()
- */
+ /** @deprecated provide nestedElement argument */
+ @Deprecated
@Override
public abstract @NonNull IQVTiEvaluationVisitor createNestedEvaluator();
+ @Override
+ public abstract @NonNull IQVTiEvaluationVisitor createNestedEvaluator(@NonNull NamedElement nestedElement);
protected void doMappingStatements(@NonNull List<MappingStatement> mappingStatements) {
}
@@ -95,7 +97,7 @@ public abstract class QVTiAbstractEvaluationVisitor extends OCLEvaluationVisitor
Property targetProperty = propertyAssignment.getTargetProperty();
Class<?> instanceClass = PivotUtil.getEcoreInstanceClass(targetProperty);
Object ecoreValue = environmentFactory.getIdResolver().ecoreValueOf(instanceClass, boxedValue);
- targetProperty.initValue((EObject) slotExpValue, ecoreValue);
+ targetProperty.initValue(slotExpValue, ecoreValue);
if (cacheIndex != null) {
getModelManager().setUnnavigableOpposite(cacheIndex, slotExpValue, ecoreValue);
}
@@ -352,14 +354,16 @@ public abstract class QVTiAbstractEvaluationVisitor extends OCLEvaluationVisitor
@Override
public @Nullable Object visitMappingSequence(@NonNull MappingSequence mappingSequence) {
for (MappingStatement mappingStatement : mappingSequence.getMappingStatements()) {
- IQVTiEvaluationVisitor nv = ((IQVTiEvaluationVisitor) undecoratedVisitor).createNestedEvaluator();
- // The Undecorated visitor createNestedEvaluator should return the undecorated, so no need
- // to call the getUndecoratedVisitor.
- try {
- mappingStatement.accept(nv);
- }
- finally {
- nv.dispose();
+ if (mappingStatement != null) {
+ IQVTiEvaluationVisitor nv = ((IQVTiEvaluationVisitor) undecoratedVisitor).createNestedEvaluator(mappingStatement);
+ // The Undecorated visitor createNestedEvaluator should return the undecorated, so no need
+ // to call the getUndecoratedVisitor.
+ try {
+ mappingStatement.accept(nv);
+ }
+ finally {
+ nv.dispose();
+ }
}
}
return true;
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 8f51fae52..daf0c3599 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
@@ -12,6 +12,7 @@ package org.eclipse.qvtd.pivot.qvtimperative.evaluation;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.utilities.NameUtil;
@@ -51,6 +52,8 @@ public class QVTiEvaluationVisitor extends QVTiAbstractEvaluationVisitor {
super(evalEnv);
}
+ /** @deprecated provide nestedElement argument */
+ @Deprecated
@Override
public @NonNull IQVTiEvaluationVisitor createNestedEvaluator() {
QVTiEnvironmentFactory environmentFactory = getEnvironmentFactory();
@@ -60,6 +63,15 @@ public class QVTiEvaluationVisitor extends QVTiAbstractEvaluationVisitor {
return nestedEvaluationVisitor;
}
+ @Override
+ public @NonNull IQVTiEvaluationVisitor createNestedEvaluator(@NonNull NamedElement namedElement) {
+ QVTiEnvironmentFactory environmentFactory = getEnvironmentFactory();
+ IQVTiEvaluationEnvironment nestedEvalEnv = (IQVTiEvaluationEnvironment) environmentFactory.createEvaluationEnvironment(evaluationEnvironment, namedElement);
+ QVTiEvaluationVisitor nestedEvaluationVisitor = new QVTiEvaluationVisitor(nestedEvalEnv);
+ nestedEvaluationVisitor.setMonitor(getMonitor());
+ return nestedEvaluationVisitor;
+ }
+
/* (non-Javadoc)
* @see uk.ac.york.qvtd.pivot.qvtcorebase.evaluation.QVTcoreBaseEvaluationVisitorImpl#visitBottomPattern(org.eclipse.qvtd.pivot.qvtcorebase.BottomPattern)
*/
@@ -208,7 +220,7 @@ public class QVTiEvaluationVisitor extends QVTiAbstractEvaluationVisitor {
if (rule == null) {
throw new IllegalStateException("Transformation " + transformation.getName() + " has no root mapping");
}
- IQVTiEvaluationVisitor nv = ((IQVTiEvaluationVisitor) undecoratedVisitor).createNestedEvaluator();
+ IQVTiEvaluationVisitor nv = ((IQVTiEvaluationVisitor) undecoratedVisitor).createNestedEvaluator(rule);
rule.accept(nv);
return true;
}
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 f4ecc76ab..eb98feafa 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
@@ -15,6 +15,7 @@ import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.CompleteEnvironment;
import org.eclipse.ocl.pivot.Import;
+import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.StandardLibrary;
import org.eclipse.ocl.pivot.evaluation.EvaluationLogger;
@@ -59,12 +60,19 @@ public abstract class QVTiEvaluationVisitorDecorator extends AbstractEvaluationV
super(decorated);
}
+ /** @deprecated provide nestedElement argument */
+ @Deprecated
+ @Override
+ public @NonNull IQVTiEvaluationVisitor createNestedEvaluator() {
+ return delegate.createNestedEvaluator();
+ }
+
/**
* Delegates to my decorated visitor.
*/
@Override
- public @NonNull IQVTiEvaluationVisitor createNestedEvaluator() {
- return delegate.createNestedEvaluator();
+ public @NonNull IQVTiEvaluationVisitor createNestedEvaluator(@NonNull NamedElement nestedElement) {
+ return delegate.createNestedEvaluator(nestedElement);
}
@Override
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTracingEvaluationVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTracingEvaluationVisitor.java
index 9a04ba6b2..3909d2643 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTracingEvaluationVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiTracingEvaluationVisitor.java
@@ -13,6 +13,7 @@ package org.eclipse.qvtd.pivot.qvtimperative.evaluation;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
@@ -66,14 +67,18 @@ public class QVTiTracingEvaluationVisitor extends QVTiAbstractTracingEvaluationV
this.indentLevel = indentLevel;
}
- /* (non-Javadoc)
- * @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#createNestedEvaluator()
- */
+ /** @deprecated provide nestedElement argument */
+ @Deprecated
@Override
public @NonNull IQVTiEvaluationVisitor createNestedEvaluator() {
return new QVTiTracingEvaluationVisitor(super.createNestedEvaluator(), indentLevel);
}
+ @Override
+ public @NonNull IQVTiEvaluationVisitor createNestedEvaluator(@NonNull NamedElement nestedElement) {
+
+ return new QVTiTracingEvaluationVisitor(super.createNestedEvaluator(nestedElement), indentLevel);
+ }
/* (non-Javadoc)
* @see org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitorDecorator#visitBottomPattern(org.eclipse.qvtd.pivot.qvtcorebase.BottomPattern)

Back to the top