Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-10-15 11:05:32 +0000
committerEd Willink2016-10-30 11:38:43 +0000
commitb279f137130ca1fd38903590461b7d23b09fa2d1 (patch)
tree4f1ab519222f4a5673599145d5a68e8e30d66b60 /plugins
parentb0865d3e44ddb56b52af75cbfd74ab42f3337865 (diff)
downloadorg.eclipse.qvtd-b279f137130ca1fd38903590461b7d23b09fa2d1.tar.gz
org.eclipse.qvtd-b279f137130ca1fd38903590461b7d23b09fa2d1.tar.xz
org.eclipse.qvtd-b279f137130ca1fd38903590461b7d23b09fa2d1.zip
[500962] Generating incremental execution structures
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java2
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java331
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCodeGenerator.java2
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiGlobalContext.java2
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/utilities/QVTiCGUtil.java5
-rw-r--r--plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMExecutor.java6
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/BasicQVTiExecutor.java1
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiEvaluationVisitor.java1
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiExecutor.java2
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiIncrementalExecutor.java17
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractInvocation.java13
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Connection.java2
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Interval.java4
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Invocation.java6
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationConstructor.java28
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationManager.java1
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractConnectionInternal.java45
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractIntervalInternal.java90
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationConstructor.java168
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationInternal.java17
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java32
-rw-r--r--plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/LazyObjectManager.java2
22 files changed, 462 insertions, 315 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 7cd7e1503..f5982afe0 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
@@ -566,7 +566,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
}
CGVariable cgVariable = getVariable(asVariable);
OCLExpression asInitValue = asAddStatement.getOwnedExpression();
- assert (cgVariable instanceof CGConnectionVariable) || (cgVariable instanceof CGAccumulator);
+ assert cgVariable instanceof CGConnectionVariable;
CGValuedElement initValue = doVisit(CGValuedElement.class, asInitValue);
CGConnectionAssignment cgConnectionAssignment = QVTiCGModelFactory.eINSTANCE.createCGConnectionAssignment();
cgConnectionAssignment.setConnectionVariable(cgVariable);
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 890ef4202..c6fa21dd9 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
@@ -56,9 +56,9 @@ import org.eclipse.ocl.pivot.NavigationCallExp;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.Parameter;
import org.eclipse.ocl.pivot.Property;
-import org.eclipse.ocl.pivot.SetType;
import org.eclipse.ocl.pivot.ShadowPart;
import org.eclipse.ocl.pivot.VariableDeclaration;
+import org.eclipse.ocl.pivot.VariableExp;
import org.eclipse.ocl.pivot.ids.ClassId;
import org.eclipse.ocl.pivot.ids.CollectionTypeId;
import org.eclipse.ocl.pivot.ids.ElementId;
@@ -71,6 +71,7 @@ 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.TreeIterable;
import org.eclipse.ocl.pivot.utilities.ValueUtil;
import org.eclipse.qvtd.codegen.qvti.analyzer.QVTiAS2CGVisitor;
import org.eclipse.qvtd.codegen.qvti.analyzer.QVTiAnalyzer;
@@ -97,9 +98,12 @@ 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.qvtimperative.AppendParameterBinding;
+import org.eclipse.qvtd.pivot.qvtimperative.BufferStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTransformation;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
+import org.eclipse.qvtd.pivot.qvtimperative.LoopParameterBinding;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.MappingCall;
import org.eclipse.qvtd.pivot.qvtimperative.MappingParameterBinding;
@@ -110,7 +114,7 @@ import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
import org.eclipse.qvtd.runtime.evaluation.AbstractInvocation;
import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer;
import org.eclipse.qvtd.runtime.evaluation.AbstractValueOccurrence;
-import org.eclipse.qvtd.runtime.evaluation.Invocation;
+import org.eclipse.qvtd.runtime.evaluation.Connection;
import org.eclipse.qvtd.runtime.evaluation.InvocationConstructor;
import org.eclipse.qvtd.runtime.evaluation.InvocationManager;
import org.eclipse.qvtd.runtime.evaluation.ObjectManager;
@@ -443,6 +447,41 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append("}\n");
}
+ protected boolean doEcoreCreate(@NonNull CGValuedElement cgElement, @NonNull EClassifier eClassifier) {
+ boolean doSetNonNull = false;
+ EPackage ePackage = eClassifier.getEPackage();
+ String createMethodName = "create" + eClassifier.getName();
+ String javaClass;
+ if (ePackage != null) {
+ Class<?> factoryClass = genModelHelper.getEcoreFactoryClass(ePackage);
+ if (factoryClass != null) {
+ javaClass = factoryClass.getName();
+ Method factoryMethod = context.getLeastDerivedMethod(factoryClass, createMethodName);
+ if (factoryMethod != null) {
+ if (context.getIsNonNull(factoryMethod) == Boolean.TRUE) {
+ doSetNonNull = true;
+ };
+ }
+ }
+ else {
+ javaClass = genModelHelper.getQualifiedFactoryInterfaceName(ePackage);
+ }
+ }
+ else {
+ javaClass = null;
+ }
+ //
+ js.appendDeclaration(cgElement);
+ js.append(" = ");
+ js.appendClassReference(javaClass);
+ // js.appendReferenceTo(localContext.getExecutorType(cgRealizedVariable.getPivotTypeId()));
+ js.append(".eINSTANCE.");
+ js.append(createMethodName);
+ js.append("();\n");
+ //
+ return doSetNonNull;
+ }
+
protected boolean doFunctionBody(@NonNull CGFunction cgFunction) {
CGValuedElement body = getExpression(cgFunction.getBody());
ElementId elementId = cgFunction.getTypeId().getElementId();
@@ -784,7 +823,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append(".self == thoseValues[0]");
int index = 1;
for (@NonNull CGParameter cgParameter : ClassUtil.nullFree(cgFunction.getParameters())) {
- js.append("\n && ");
+ js.append("\n\t&& ");
js.append("idResolver.oclEquals("); // FIXME oclEquals / ==
js.appendThis(functionName);
js.append(".");
@@ -811,7 +850,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
int index = 0;
for (@NonNull CGShadowPart cgShadowPart : ClassUtil.nullFree(cgShadowExp.getParts())) {
if (index > 0) {
- js.append("\n && ");
+ js.append("\n\t&& ");
}
js.append("idResolver.oclEquals("); // FIXME oclEquals / ==
js.append(instanceName);
@@ -896,7 +935,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
int index = 0;
for (@NonNull CGParameter cgFreeVariable : cgFreeVariables) {
if (index > 0) {
- js.append("\n && ");
+ js.append("\n\t&& ");
}
js.append("idResolver.oclEquals(");
js.append(cgFreeVariable.getValueName());
@@ -943,10 +982,8 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
protected void doMappingConnectionVariable(@NonNull CGGuardVariable cgFreeVariable) {
if (cgFreeVariable instanceof CGConnectionVariable) {
js.append("final ");
- js.appendClassReference(null, cgFreeVariable);
- js.append(".");
- js.appendIsRequired(true);
- js.append(" Accumulator "); // FIXME Embed properly as a nested typeid
+ js.appendClassReference(true, Connection.class);
+ js.append(" ");
js.append(getValueName(cgFreeVariable));
}
else{
@@ -962,21 +999,20 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append("public ");
js.append(getMappingName(cgMapping));
js.append("(");
- if (isIncremental) {
- js.appendClassReference(true, isIncremental ? InvocationConstructor.Incremental.class : InvocationConstructor.class);
- js.append(" constructor, ");
- }
+ js.appendClassReference(true, isIncremental ? InvocationConstructor.Incremental.class : InvocationConstructor.class);
+ js.append(" ");
+ js.append(QVTiGlobalContext.CONSTRUCTOR_NAME);
+ js.append(", ");
js.appendIsRequired(true);
js.append(" Object ");
js.appendIsRequired(true);
js.append(" [] boundValues) {\n");
js.pushIndentation(null);
- if (isIncremental) {
- js.append("super(invocationManager.getRootInterval(), constructor);\n");
- }
- else {
- js.append("super(invocationManager.getRootInterval());\n");
- }
+ // if (isIncremental) {
+ js.append("super(");
+ js.append(QVTiGlobalContext.CONSTRUCTOR_NAME);
+ js.append(");\n");
+ //
int i = 0;
for (@NonNull CGGuardVariable cgFreeVariable : cgFreeVariables) {
String valueName = getValueName(cgFreeVariable);
@@ -985,8 +1021,10 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
// js.appendClassCast(cgFreeVariable);
if (cgFreeVariable instanceof CGConnectionVariable) {
js.append("(");
- js.appendClassReference(null, cgFreeVariable);
- js.append(".Accumulator)"); // FIXME Embed properly as a nested typeid
+ // js.appendClassReference(null, cgFreeVariable);
+ // js.append(".Accumulator)"); // FIXME Embed properly as a nested typeid
+ js.appendClassReference(null, Connection.class);
+ js.append(")"); // FIXME Embed properly as a nested typeid
}
else{
js.appendClassCast(cgFreeVariable);
@@ -1006,8 +1044,10 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.appendClassReference(true, constructorClass);
js.append(" " + getMappingCtorName(cgMapping) + " = new ");
js.appendClassReference(constructorClass);
- js.append("(invocationManager.getRootInterval(), ");
+ js.append("(invocationManager, ");
js.appendString(QVTiCGUtil.getName(cgMapping));
+ js.append(", ");
+ js.appendBooleanString(((Mapping)cgMapping.getAst()).isIsStrict());
js.append(")\n");
js.append("{\n");
js.pushIndentation(null);
@@ -1023,9 +1063,9 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append(" [] values) {\n");
js.pushIndentation(null);
js.append("return new " + getMappingName(cgMapping) + "(");
- if (isIncremental) {
- js.append("this, ");
- }
+ // if (isIncremental) {
+ js.append("this, ");
+ // }
js.append("values);\n");
js.popIndentation();
js.append("}\n");
@@ -1134,9 +1174,8 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append("public boolean run() {\n");
js.pushIndentation(null);
if (isIncremental) {
- js.appendClassReference(Invocation.class);
- js.append(" rootInvocation = " + getMappingCtorName(cgRootMapping) + ".getInstance(new @NonNull Object[0]);\n");
- js.append("return rootInvocation.execute() && invocationManager.flush();\n");
+ js.append(getMappingCtorName(cgRootMapping) + ".invoke();\n");
+ js.append("return invocationManager.flush();\n");
}
else {
js.append("return ");
@@ -1164,6 +1203,20 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
return allImports;
}
+ private @Nullable Iterable<@NonNull CGMappingCallBinding> getAppendBindings(@NonNull List<CGMappingCallBinding> cgMappingCallBindings) {
+ List<@NonNull CGMappingCallBinding> bindings = null;
+ for (CGMappingCallBinding cgMappingCallBinding : cgMappingCallBindings) {
+ Element ast = cgMappingCallBinding.getAst();
+ if (ast instanceof AppendParameterBinding) {
+ if (bindings == null) {
+ bindings = new ArrayList<>();
+ }
+ bindings.add(cgMappingCallBinding);
+ }
+ }
+ return bindings;
+ }
+
private EObject getContainer(EObject eObject) {
EObject eContainer = eObject.eContainer();
if (eContainer != null) {
@@ -1177,6 +1230,20 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
return null;
}
+ private @Nullable Iterable<@NonNull CGMappingCallBinding> getConsumeBindings(@NonNull List<CGMappingCallBinding> cgMappingCallBindings) {
+ List<@NonNull CGMappingCallBinding> bindings = null;
+ for (CGMappingCallBinding cgMappingCallBinding : cgMappingCallBindings) {
+ Element ast = cgMappingCallBinding.getAst();
+ if (!(ast instanceof AppendParameterBinding)) {
+ if (bindings == null) {
+ bindings = new ArrayList<>();
+ }
+ bindings.add(cgMappingCallBinding);
+ }
+ }
+ return bindings;
+ }
+
@Override
protected @Nullable EStructuralFeature getESObject(@NonNull Property asProperty) {
EObject esObject = asProperty.getESObject();
@@ -1209,6 +1276,20 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
return (QVTiGlobalContext) globalContext;
}
+ private @Nullable Iterable<@NonNull CGMappingCallBinding> getIterateBindings(@NonNull List<CGMappingCallBinding> cgMappingCallBindings) {
+ List<@NonNull CGMappingCallBinding> bindings = null;
+ for (CGMappingCallBinding cgMappingCallBinding : cgMappingCallBindings) {
+ Element ast = cgMappingCallBinding.getAst();
+ if (ast instanceof LoopParameterBinding) {
+ if (bindings == null) {
+ bindings = new ArrayList<>();
+ }
+ bindings.add(cgMappingCallBinding);
+ }
+ }
+ return bindings;
+ }
+
protected String getMappingCtorName(@NonNull CGMapping cgMapping) {
return JavaStream.convertToJavaIdentifier("CTOR_" + cgMapping.getName());
}
@@ -1234,6 +1315,10 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
return "";
}
+ private boolean isConnection(CGValuedElement source) {
+ return (source.getAst() instanceof VariableExp) && (((VariableExp)source.getAst()).getReferredVariable() instanceof BufferStatement);
+ }
+
private boolean isHazardous2(@NonNull NavigationCallExp asNavigationCallExp) {
for (EObject eObject = asNavigationCallExp; eObject != null; eObject = getContainer(eObject)) {
if (eObject instanceof ObservableStatement) {
@@ -1310,7 +1395,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
BoxedDescriptor abstractBoxedDescriptor = concreteBoxedDescriptor;
if (!(initValue.getASTypeId() instanceof CollectionTypeId)) {
js.appendReferenceTo(cgConnectionAssignment.getConnectionVariable());
- js.append(".add(");
+ js.append(".append(");
js.appendValueName(initValue);
js.append(");\n");
}
@@ -1459,41 +1544,6 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
return true;
}
- protected boolean doEcoreCreate(@NonNull CGValuedElement cgElement, @NonNull EClassifier eClassifier) {
- boolean doSetNonNull = false;
- EPackage ePackage = eClassifier.getEPackage();
- String createMethodName = "create" + eClassifier.getName();
- String javaClass;
- if (ePackage != null) {
- Class<?> factoryClass = genModelHelper.getEcoreFactoryClass(ePackage);
- if (factoryClass != null) {
- javaClass = factoryClass.getName();
- Method factoryMethod = context.getLeastDerivedMethod(factoryClass, createMethodName);
- if (factoryMethod != null) {
- if (context.getIsNonNull(factoryMethod) == Boolean.TRUE) {
- doSetNonNull = true;
- };
- }
- }
- else {
- javaClass = genModelHelper.getQualifiedFactoryInterfaceName(ePackage);
- }
- }
- else {
- javaClass = null;
- }
- //
- js.appendDeclaration(cgElement);
- js.append(" = ");
- js.appendClassReference(javaClass);
- // js.appendReferenceTo(localContext.getExecutorType(cgRealizedVariable.getPivotTypeId()));
- js.append(".eINSTANCE.");
- js.append(createMethodName);
- js.append("();\n");
- //
- return doSetNonNull;
- }
-
@Override
public @NonNull Boolean visitCGFunction(@NonNull CGFunction cgFunction) {
JavaLocalContext<@NonNull ?> localContext2 = globalContext.getLocalContext(cgFunction);
@@ -1685,7 +1735,6 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
List<@NonNull CGGuardVariable> cgFreeVariables = ClassUtil.nullFree(cgMapping.getFreeVariables());
//
js.appendCommentWithOCL(null, cgMapping.getAst());
- @NonNull
String mappingName = getMappingName(cgMapping);
if (useClass(cgMapping) /*&& (cgFreeVariables.size() > 0)*/) {
js.append("protected class ");
@@ -1693,12 +1742,16 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append(" extends ");
js.appendClassReference(isIncremental ? AbstractInvocation.Incremental.class : AbstractInvocation.class);
js.pushClassBody(mappingName);
+ boolean needsNewLine = false;
for (@NonNull CGGuardVariable cgFreeVariable : cgFreeVariables) {
js.append("protected ");
doMappingConnectionVariable(cgFreeVariable);
js.append(";\n");
+ needsNewLine = true;
+ }
+ if (needsNewLine) {
+ js.append("\n");
}
- js.append("\n");
doMappingConstructor(cgMapping);
js.append("\n");
js.append("@Override\n");
@@ -1774,32 +1827,85 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
//
// Emit the mapping call.
//
- if (useClass(cgReferredMapping)) {
- // if (pMappingCall.isIsInfinite()) {
- // js.append("invokeOnce(" + getMappingCtorName(cgReferredMapping) + ", ");
- // }
- // else {
- js.append("invoke(" + getMappingCtorName(cgReferredMapping) + ", ");
- // }
+ Iterable<@NonNull CGMappingCallBinding> iterateBindings = getIterateBindings(cgMappingCallBindings);
+ if (isIncremental && (iterateBindings == null)) {
+ js.append(getMappingCtorName(cgReferredMapping));
+ js.append(".connect(");
+ Iterable<@NonNull CGMappingCallBinding> consumeBindings = getConsumeBindings(cgMappingCallBindings);
+ Iterable<@NonNull CGMappingCallBinding> appendBindings = getAppendBindings(cgMappingCallBindings);
+ if (consumeBindings == null) {
+ js.append("null");
+ }
+ else {
+ js.append("new ");
+ js.appendClassReference(true, Connection.class);
+ js.append("[]{");
+ boolean isFirst = true;
+ for (@NonNull CGMappingCallBinding cgMappingCallBinding : consumeBindings) {
+ if (!isFirst) {
+ js.append(", ");
+ }
+ TypeDescriptor checkedType = needsTypeCheck(cgMappingCallBinding);
+ if (checkedType != null) {
+ js.append("(");
+ js.appendClassReference(checkedType);
+ js.append(")");
+ }
+ js.appendValueName(cgMappingCallBinding.getValue());
+ isFirst = false;
+ }
+ js.append("}");
+ }
+ js.append(", ");
+ if (appendBindings == null) {
+ js.append("null");
+ }
+ else {
+ js.append("new ");
+ js.appendClassReference(true, Connection.class);
+ js.append("[]{");
+ boolean isFirst = true;
+ for (@NonNull CGMappingCallBinding cgMappingCallBinding : appendBindings) {
+ if (!isFirst) {
+ js.append(", ");
+ }
+ TypeDescriptor checkedType = needsTypeCheck(cgMappingCallBinding);
+ if (checkedType != null) {
+ js.append("(");
+ js.appendClassReference(checkedType);
+ js.append(")");
+ }
+ js.appendValueName(cgMappingCallBinding.getValue());
+ isFirst = false;
+ }
+ js.append("}");
+ }
+ js.append(");\n");
}
else {
- js.append(getMappingName(cgReferredMapping) + "(");
- }
- boolean isFirst = true;
- for (@SuppressWarnings("null")@NonNull CGMappingCallBinding cgMappingCallBinding : cgMappingCallBindings) {
- if (!isFirst) {
- js.append(", ");
+ if (useClass(cgReferredMapping)) {
+ js.append(getMappingCtorName(cgReferredMapping));
+ js.append(".invoke(");
}
- TypeDescriptor checkedType = needsTypeCheck(cgMappingCallBinding);
- if (checkedType != null) {
- js.append("(");
- js.appendClassReference(checkedType);
- js.append(")");
+ else {
+ js.append(getMappingName(cgReferredMapping) + "(");
}
- js.appendValueName(cgMappingCallBinding.getValue());
- isFirst = false;
+ boolean isFirst = true;
+ for (@SuppressWarnings("null")@NonNull CGMappingCallBinding cgMappingCallBinding : cgMappingCallBindings) {
+ if (!isFirst) {
+ js.append(", ");
+ }
+ TypeDescriptor checkedType = needsTypeCheck(cgMappingCallBinding);
+ if (checkedType != null) {
+ js.append("(");
+ js.appendClassReference(checkedType);
+ js.append(")");
+ }
+ js.appendValueName(cgMappingCallBinding.getValue());
+ isFirst = false;
+ }
+ js.append(");\n");
}
- js.append(");\n");
//
// End the type check.
//
@@ -1831,12 +1937,17 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
for (@NonNull CGAccumulator cgAccumulator : cgAccumulators) {
Element ast = cgAccumulator.getAst();
js.append("final ");
- js.appendClassReference(null, cgAccumulator);
- js.append(".");
- js.appendIsRequired(true);
- js.append(" Accumulator ");
+ js.appendClassReference(true, Connection.class);
+ js.append(" ");
js.appendValueName(cgAccumulator);
- js.append(" = ");
+ js.append(" = createConnection(");
+ js.appendString(QVTiCGUtil.getName(cgAccumulator));
+ js.append(", ");
+ js.appendValueName(cgAccumulator.getTypeId());
+ js.append(", ");
+ js.appendBooleanString((ast instanceof BufferStatement) && ((BufferStatement)ast).isIsStrict());
+ js.append(");\n");
+ /*
if ((ast instanceof ConnectionVariable) && (((ConnectionVariable)ast).getType() instanceof SetType)) {
js.append("createUnenforcedSetAccumulatorValue(");
}
@@ -1848,7 +1959,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append(".createCollectionAccumulatorValue(");
}
js.appendValueName(cgAccumulator.getTypeId());
- js.append(");\n");
+ js.append(");\n"); */
//
CGValuedElement cgInit = cgAccumulator.getInit();
if ((cgInit != null) && (!(cgInit instanceof CGCollectionExp) || !Iterables.isEmpty(((CGCollectionExp)cgInit).getParts()))) {
@@ -1875,14 +1986,11 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append(") {\n");
js.pushIndentation(null);
js.appendReferenceTo(cgAccumulator);
- js.append(".add(");
+ js.append(".append(");
js.append(iteratorName);
js.append(");\n");
js.popIndentation();
js.append("}\n");
- // js.appendClassReference(cgAccumulator);
- // _m_join_m_PackageCS_m_0_0 = (SetValue.Accumulator)ValueUtil.createCollectionAccumulatorValue(SET_CLSSid_OclElement);
- // cgAccumulator.accept(this);
}
}
}
@@ -1923,6 +2031,7 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
public @NonNull Boolean visitCGMappingLoop(@NonNull CGMappingLoop cgMappingLoop) {
CGValuedElement source = getExpression(cgMappingLoop.getSource());
CGIterator iterator = cgMappingLoop.getIterators().get(0);
+ CGValuedElement body = cgMappingLoop.getBody();
if (!js.appendLocalStatements(source)) {
return false;
}
@@ -1931,7 +2040,13 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append(" ");
js.appendValueName(iterator);
js.append(" : ");
- if (source.isBoxed()) {
+ if (isConnection(source)) {
+ js.appendValueName(source);
+ js.append(".typedIterable(");
+ js.appendClassReference(null, iterator);
+ js.append(".class)");
+ }
+ else if (source.isBoxed()) {
js.appendClassReference(ValueUtil.class);
js.append(".typedIterable(");
js.appendClassReference(null, iterator);
@@ -1950,13 +2065,31 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
js.append(" != null) {\n");
js.pushIndentation(null);
}
- cgMappingLoop.getBody().accept(this);
+ body.accept(this);
if (!iterator.isNonNull()) {
js.popIndentation();
js.append("}\n");
}
js.popIndentation();
js.append("}\n");
+ boolean needsFlush = false;
+ for (EObject eObject : new TreeIterable(body, false)) {
+ if (eObject instanceof CGMappingCall) {
+ CGMappingCall cgMappingCall = (CGMappingCall)eObject;
+ MappingCall asMappingCall = (MappingCall) cgMappingCall.getAst();
+ Mapping pReferredMapping = asMappingCall.getReferredMapping();
+ if (pReferredMapping != null) {
+ CGMapping cgReferredMapping = analyzer.getMapping(pReferredMapping);
+ if ((cgReferredMapping != null) && useClass(cgReferredMapping)) {
+ needsFlush = true;
+ break;
+ }
+ }
+ }
+ }
+ if (needsFlush) {
+ js.append("invocationManager.flush();\n");
+ }
return true;
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCodeGenerator.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCodeGenerator.java
index 6d7c29879..c8b73784b 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCodeGenerator.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCodeGenerator.java
@@ -204,7 +204,7 @@ public class QVTiCodeGenerator extends JavaCodeGenerator
public @NonNull String generateClassFile() {
String javaSourceCode2 = javaSourceCode;
if (javaSourceCode2 == null) {
- javaSourceCode = javaSourceCode2 = CGUtil.compressJDTannotations(createClassFileContent());
+ javaSourceCode = javaSourceCode2 = CGUtil.trimLines(CGUtil.compressJDTannotations(createClassFileContent()));
}
return javaSourceCode2;
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiGlobalContext.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiGlobalContext.java
index 0d9d9880a..7f2b8af2a 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiGlobalContext.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiGlobalContext.java
@@ -25,6 +25,7 @@ import org.eclipse.ocl.pivot.Property;
*/
public class QVTiGlobalContext extends JavaGlobalContext<@NonNull QVTiCodeGenerator>
{
+ public static final @NonNull String CONSTRUCTOR_NAME = "constructor";
public static final @NonNull String MODELS_NAME = "models";
/**
@@ -36,6 +37,7 @@ public class QVTiGlobalContext extends JavaGlobalContext<@NonNull QVTiCodeGenera
super(codeGenerator);
nameManager.reserveName(JavaConstants.EXECUTOR_NAME, null);
nameManager.reserveName(JavaConstants.EVALUATION_CACHE_NAME, null);
+ nameManager.reserveName(CONSTRUCTOR_NAME, null);
nameManager.reserveName(MODELS_NAME, null);
}
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/utilities/QVTiCGUtil.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/utilities/QVTiCGUtil.java
index 565c02fb2..21a2210d4 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/utilities/QVTiCGUtil.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/utilities/QVTiCGUtil.java
@@ -13,6 +13,7 @@ package org.eclipse.qvtd.codegen.utilities;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.ocl.examples.codegen.cgmodel.CGAccumulator;
import org.eclipse.ocl.examples.codegen.cgmodel.CGElement;
import org.eclipse.ocl.examples.codegen.utilities.CGUtil;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
@@ -32,4 +33,8 @@ public class QVTiCGUtil extends CGUtil
public static @NonNull String getName(@NonNull CGMapping cgMapping) {
return ClassUtil.nonNullState(cgMapping.getName());
}
+
+ public static @NonNull String getName(@NonNull CGAccumulator cgAccumulator) {
+ return ClassUtil.nonNullState(cgAccumulator.getName());
+ }
}
diff --git a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMExecutor.java b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMExecutor.java
index da3e1f615..8c894a571 100644
--- a/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMExecutor.java
+++ b/plugins/org.eclipse.qvtd.debug/src/org/eclipse/qvtd/debug/evaluator/QVTiVMExecutor.java
@@ -22,19 +22,19 @@ import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.evaluation.EvaluationEnvironment;
import org.eclipse.qvtd.debug.QVTiDebugPlugin;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
-import org.eclipse.qvtd.pivot.qvtimperative.evaluation.BasicQVTiExecutor;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEnvironmentFactory;
import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiEvaluationVisitor;
+import org.eclipse.qvtd.pivot.qvtimperative.evaluation.QVTiIncrementalExecutor;
import org.eclipse.qvtd.pivot.qvtimperative.utilities.QVTimperativeUtil;
-public class QVTiVMExecutor extends BasicQVTiExecutor implements VMExecutor
+public class QVTiVMExecutor extends QVTiIncrementalExecutor implements VMExecutor
{
protected final @NonNull IVMContext vmContext;
private boolean suspendOnStartup = false;
private long envId = 0;
public QVTiVMExecutor(@NonNull IVMContext vmContext, @NonNull URI transformationURI) throws IOException {
- super((QVTiEnvironmentFactory)vmContext.getEnvironmentFactory(), QVTimperativeUtil.loadTransformation((QVTiEnvironmentFactory)vmContext.getEnvironmentFactory(), transformationURI, vmContext.keepDebug()));
+ super((QVTiEnvironmentFactory)vmContext.getEnvironmentFactory(), QVTimperativeUtil.loadTransformation((QVTiEnvironmentFactory)vmContext.getEnvironmentFactory(), transformationURI, vmContext.keepDebug()), Mode.LAZY);
this.vmContext = vmContext;
}
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 012a66543..f393ed0f3 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
@@ -358,6 +358,7 @@ public abstract class BasicQVTiExecutor extends AbstractExecutor implements QVTi
pushEvaluationEnvironment(rule, (TypedElement)callExp);
try {
rule.accept(undecoratedVisitor);
+ getInvocationManager().flush();
}
finally {
popEvaluationEnvironment();
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 c29ae7be5..6135003de 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
@@ -397,6 +397,7 @@ public class QVTiEvaluationVisitor extends BasicEvaluationVisitor implements IQV
}
}
}
+ executor.getInvocationManager().flush();
}
}
return true;
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiExecutor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiExecutor.java
index d94a2bb9f..c16d2746c 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiExecutor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/evaluation/QVTiExecutor.java
@@ -22,6 +22,7 @@ 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.SetStatement;
+import org.eclipse.qvtd.runtime.evaluation.InvocationManager;
public interface QVTiExecutor extends ExecutorInternal
{
@@ -29,6 +30,7 @@ public interface QVTiExecutor extends ExecutorInternal
Boolean execute();
@Override
@NonNull QVTiEvaluationEnvironment getEvaluationEnvironment();
+ @NonNull InvocationManager getInvocationManager();
@Nullable Resource getModel(@NonNull String name);
@Override
@NonNull QVTiModelManager getModelManager();
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 8b115b01b..7b02ad095 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
@@ -102,6 +102,11 @@ public class QVTiIncrementalExecutor extends BasicQVTiExecutor
}
@Override
+ public @NonNull InvocationManager getInvocationManager() {
+ return invocationManager;
+ }
+
+ @Override
protected @Nullable Object internalExecuteFunctionCallExp(@NonNull OperationCallExp operationCallExp,
@NonNull Function asFunction, @Nullable Object @NonNull [] boxedSourceAndArgumentValues) {
Map<@NonNull Operation, Computation.@NonNull Constructor> operation2computationConstructor2 = operation2computationConstructor;
@@ -165,11 +170,11 @@ public class QVTiIncrementalExecutor extends BasicQVTiExecutor
}
InvocationConstructor invocationConstructor = mapping2invocationConstructor2.get(asMapping);
if (invocationConstructor == null) {
- invocationConstructor = new AbstractInvocationConstructor.Incremental(invocationManager.getRootInterval(), QVTimperativeUtil.getName(asMapping))
+ invocationConstructor = new AbstractInvocationConstructor.Incremental(invocationManager, QVTimperativeUtil.getName(asMapping), asMapping.isIsStrict())
{
@Override
public @NonNull Invocation newInstance(@NonNull Object @NonNull [] theseValues) {
- Invocation.Incremental invocation = new AbstractInvocation.Incremental(invocationManager.getRootInterval(), this)
+ Invocation.Incremental invocation = new AbstractInvocation.Incremental(this)
{
protected Object returnStatus;
@@ -209,13 +214,7 @@ public class QVTiIncrementalExecutor extends BasicQVTiExecutor
};
mapping2invocationConstructor2.put(asMapping, invocationConstructor);
}
- Invocation invocation = invocationConstructor.getFirstInvocation(boundValues);
- if (invocation != null) {
- if (debugInvocations) {
- AbstractTransformer.INVOCATIONS.println("invoke " + invocation);
- }
- invocation.invokeInternal(true);
- }
+ invocationConstructor.invoke(boundValues);
return null;
}
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractInvocation.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractInvocation.java
index b1b7d64b2..4b3dd1e4d 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractInvocation.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/AbstractInvocation.java
@@ -16,6 +16,7 @@ import java.util.List;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.ids.CollectionTypeId;
import org.eclipse.qvtd.runtime.internal.evaluation.AbstractInvocationInternal;
/**
@@ -35,8 +36,8 @@ public abstract class AbstractInvocation extends AbstractInvocationInternal
private Set<SlotState.@NonNull Incremental> readSlots = null;
private Set<SlotState.@NonNull Incremental> writeSlots = null;
- protected Incremental(@NonNull Interval interval, InvocationConstructor.@NonNull Incremental constructor) {
- super(interval);
+ protected Incremental(InvocationConstructor.@NonNull Incremental constructor) {
+ super(constructor);
this.constructor = constructor;
this.sequence = constructor.nextSequence();
}
@@ -67,6 +68,10 @@ public abstract class AbstractInvocation extends AbstractInvocationInternal
writeSlot.addSourceInternal(this);
}
+ protected @NonNull Connection createConnection(@NonNull String name, @NonNull CollectionTypeId typeId, boolean isStrict) {
+ return constructor.getInterval().createConnection(name, typeId, isStrict);
+ }
+
@Override
public @NonNull Iterable<@NonNull Object> getCreatedObjects() {
return createdObjects != null ? createdObjects : EMPTY_OBJECT_LIST;
@@ -93,8 +98,8 @@ public abstract class AbstractInvocation extends AbstractInvocationInternal
}
}
- protected AbstractInvocation(@NonNull Interval interval) {
- super(interval);
+ protected AbstractInvocation(@NonNull InvocationConstructor constructor) {
+ super(constructor.getInterval());
}
@Override
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Connection.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Connection.java
index 201ea85c6..34b0193a1 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Connection.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Connection.java
@@ -80,4 +80,6 @@ public interface Connection extends ExecutionVisitable, Nameable
* so that their appends are also revoked.
*/
void revoke(@NonNull Object connectionKey);
+
+ <@NonNull T> @NonNull Iterable<T> typedIterable(Class<T> elementClass);
} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Interval.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Interval.java
index b1e7feb16..ce1ffb415 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Interval.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Interval.java
@@ -22,7 +22,7 @@ import org.eclipse.ocl.pivot.utilities.Nameable;
*/
public interface Interval extends ExecutionVisitable, Nameable
{
- @NonNull Connection createConnection(@NonNull String name, @NonNull CollectionTypeId typeId, boolean isEnforced);
+ @NonNull Connection createConnection(@NonNull String name, @NonNull CollectionTypeId typeId, boolean isStrict);
boolean flush();
@@ -35,8 +35,6 @@ public interface Interval extends ExecutionVisitable, Nameable
@Override
@NonNull String getName();
- void invoke(@NonNull Invocation invocation, boolean doFlush);
-
boolean isFlushed();
void queue(@NonNull Connection connection);
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Invocation.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Invocation.java
index a0768dcd8..0ad5857a1 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Invocation.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/Invocation.java
@@ -27,20 +27,18 @@ public interface Invocation extends ExecutionVisitable, Nameable
*/
boolean execute() throws InvocationFailedException;
+ @NonNull Interval getInterval();
+
/**
* Insert this Invocation following predecessor, which may be in the blocked or waiting invocations linked list.
*/
void insertAfter(@NonNull Invocation predecessor);
- void invokeInternal(boolean doFlush);
-
/**
* Return true if an occurrence with thoseValues would be a re-occurrence.
*/
boolean isEqual(@NonNull IdResolver idResolver, @NonNull Object @NonNull [] thoseValues);
- void queue();
-
/**
* Remove this Invocation from the blocked or waiting invocations linked list.
*/
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationConstructor.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationConstructor.java
index 1643fea97..03d9334b4 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationConstructor.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationConstructor.java
@@ -11,7 +11,6 @@
package org.eclipse.qvtd.runtime.evaluation;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.utilities.Nameable;
/**
@@ -26,21 +25,8 @@ public interface InvocationConstructor extends ExecutionVisitable, Nameable
int nextSequence();
}
- void addAppendedConnection(@NonNull Connection connection);
-
void addConsumedConection(@NonNull Connection connection);
- /**
- * Return the first invocation of this constructor with argValues, using newInstance(argValues) to
- * create a new invocation instance if necessary. Returns null if an instance already created.
- */
- @Nullable Invocation getFirstInvocation(@NonNull Object @NonNull [] argValues);
-
- /**
- * Create the invocation identified by this constructor and values.
- */
- @NonNull Invocation getInstance(@NonNull Object @NonNull [] values);
-
@NonNull Interval getInterval();
@NonNull Iterable<@NonNull Invocation> getInvocations();
@@ -48,5 +34,19 @@ public interface InvocationConstructor extends ExecutionVisitable, Nameable
@Override
@NonNull String getName();
+ /**
+ * Invoke the Mapping with the given set of boundValues exactly once.
+ *
+ * If isStrict and a previous invocation exists, no re-invocation occurs.
+ *
+ * If not isStrict or no previous invocation exists, the invocations occurs.
+ *
+ * The InvocationConstructor creator guarantees that isStrict is only true if
+ * duplicate invocations cannot occur.
+ */
+ @NonNull Invocation invoke(@NonNull Object @NonNull ... boundValues);
+
+ boolean isStrict();
+
void propagate();
} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationManager.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationManager.java
index 7fc08384a..bfcc3497f 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationManager.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/evaluation/InvocationManager.java
@@ -24,7 +24,6 @@ public interface InvocationManager extends ExecutionVisitable
{
void addInvoker(@NonNull InvocationConstructor constructor);
@NonNull Interval createInterval();
- // @NonNull InvocationConstructor createInvoker(@NonNull InvocationConstructor constructor, int consumedConnections, @NonNull Interval interval, @NonNull Connection @NonNull ... connections);
boolean flush();
@NonNull Executor getExecutor();
@NonNull Iterable<@NonNull Interval> getIntervals();
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractConnectionInternal.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractConnectionInternal.java
index 9af54fd6b..763115fcc 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractConnectionInternal.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractConnectionInternal.java
@@ -11,7 +11,9 @@
package org.eclipse.qvtd.runtime.internal.evaluation;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import java.util.NoSuchElementException;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -35,6 +37,38 @@ import org.eclipse.qvtd.runtime.evaluation.InvocationConstructor;
*/
public abstract class AbstractConnectionInternal implements Connection
{
+ protected final class ValueIterator<T> implements Iterator<T> {
+
+ private final int size = listOfValueAndConsumingInvocations.size();
+
+ private int cursor = next(0);
+
+ @Override
+ public boolean hasNext() {
+ return cursor < size;
+ }
+
+ @Override
+ public @NonNull T next() {
+ List<@NonNull Object> valueAndConsumingInvocations = listOfValueAndConsumingInvocations.get(cursor);
+ if (valueAndConsumingInvocations == null) {
+ throw new NoSuchElementException();
+ }
+ cursor = next(cursor+1);
+ return (T) valueAndConsumingInvocations.get(VALUE_INDEX);
+ }
+
+ private int next(int i) {
+ while (i < size) {
+ if (listOfValueAndConsumingInvocations.get(i) != null) {
+ return i;
+ }
+ i++;
+ }
+ return size;
+ }
+ }
+
protected static final int VALUE_INDEX = 0;
protected static final int INDEX_INDEX = 1;
protected static final int COUNT_INDEX = 2;
@@ -215,4 +249,15 @@ public abstract class AbstractConnectionInternal implements Connection
s.append("]");
return s.toString();
}
+
+ @Override
+ public <@NonNull T> @NonNull Iterable<T> typedIterable(Class<T> elementClass) {
+ return new Iterable<T>()
+ {
+ @Override
+ public Iterator<@NonNull T> iterator() {
+ return new ValueIterator<T>();
+ }
+ };
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractIntervalInternal.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractIntervalInternal.java
index ab3ca7713..2df355dbf 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractIntervalInternal.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractIntervalInternal.java
@@ -60,7 +60,7 @@ public abstract class AbstractIntervalInternal implements Interval
private @Nullable AbstractInvocationInternal blockedInvocations = null;
/**
- * Head of doubly linked list of unblocked invocations waiting for a re-execution attempt.
+ * Head of doubly linked list of unblocked invocations waiting for an execution attempt.
*/
private @Nullable AbstractInvocationInternal waitingInvocations = null;
@@ -78,6 +78,10 @@ public abstract class AbstractIntervalInternal implements Interval
private synchronized void block(@NonNull Invocation invocation, @NonNull SlotState slotState) {
AbstractInvocationInternal castInvocation = (AbstractInvocationInternal) invocation;
assert castInvocation.debug_blockedBy == null;
+ assert castInvocation.next == castInvocation;
+ assert castInvocation.prev == castInvocation;
+ assert blockedInvocations != castInvocation;
+ assert waitingInvocations != castInvocation;
castInvocation.debug_blockedBy = slotState;
AbstractInvocationInternal blockedInvocations2 = blockedInvocations;
if (blockedInvocations2 == null) {
@@ -93,9 +97,9 @@ public abstract class AbstractIntervalInternal implements Interval
}
@Override
- public @NonNull Connection createConnection(@NonNull String name, @NonNull CollectionTypeId typeId, boolean isEnforced) {
+ public @NonNull Connection createConnection(@NonNull String name, @NonNull CollectionTypeId typeId, boolean isStrict) {
Connection connection;
- if (isEnforced) {
+ if (isStrict) {
connection = new EnforcedConnection(this, name, typeId);
}
else {
@@ -138,9 +142,17 @@ public abstract class AbstractIntervalInternal implements Interval
}
if (invocation != null) {
if (debugInvocations) {
- AbstractTransformer.INVOCATIONS.println("re-invoke " + invocation);
+ AbstractTransformer.INVOCATIONS.println("invoke " + invocation);
+ }
+ try {
+ invocation.execute();
+ if (debugInvocations) {
+ AbstractTransformer.INVOCATIONS.println("done " + invocation);
+ }
+ }
+ catch (InvocationFailedException e) {
+ block(invocation, e.slotState);
}
- invoke(invocation, false);
}
}
AbstractInvocationInternal blockedInvocation = blockedInvocations;
@@ -178,41 +190,6 @@ public abstract class AbstractIntervalInternal implements Interval
}
@Override
- public void invoke(@NonNull Invocation invocation, boolean doFlush) {
- try {
- invocation.execute();
- if (debugInvocations) {
- AbstractTransformer.INVOCATIONS.println("done " + invocation);
- }
- if (doFlush) {
- while (waitingInvocations != null) {
- AbstractInvocationInternal invocation2 = null;
- synchronized (this) {
- AbstractInvocationInternal waitingInvocations2 = waitingInvocations;
- if (waitingInvocations2 != null) {
- invocation2 = waitingInvocations2;
- waitingInvocations = waitingInvocations2.next;
- if (waitingInvocations == invocation2) {
- waitingInvocations = null;
- }
- invocation2.remove();
- }
- }
- if (invocation2 != null) {
- if (debugInvocations) {
- AbstractTransformer.INVOCATIONS.println("re-invoke " + invocation2);
- }
- invoke(invocation2, false);
- }
- }
- }
- }
- catch (InvocationFailedException e) {
- block(invocation, e.slotState);
- }
- }
-
- @Override
public boolean isFlushed() {
if (tailConnection != null) {
return false;
@@ -250,6 +227,7 @@ public abstract class AbstractIntervalInternal implements Interval
@Override
public synchronized void queue(@NonNull Invocation invocation) {
+ assert invocation.getInterval() == this;
if (debugInvocations) {
AbstractTransformer.INVOCATIONS.println("queue " + invocation);
}
@@ -263,7 +241,7 @@ public abstract class AbstractIntervalInternal implements Interval
else {
castInvocation.insertAfter(waitingInvocations2.prev);
}
- // queue();
+ queue();
}
@Override
@@ -283,27 +261,27 @@ public abstract class AbstractIntervalInternal implements Interval
s.append(i);
s.append(" connections, ");
int j = 0;
- for (AbstractInvocationInternal anInvocation = blockedInvocations; anInvocation != null; anInvocation = anInvocation.next) {
+ AbstractInvocationInternal blockedInvocation = blockedInvocations;
+ if (blockedInvocation != null) {
j++;
- if (j > 100) {
- j = 999999;
- break;
- }
- if (anInvocation == blockedInvocations) {
- break;
+ while ((blockedInvocation = blockedInvocation.next) != blockedInvocations) {
+ if (++j > 100) {
+ j = 999999;
+ break;
+ }
}
}
s.append(j);
s.append(" blocked, ");
int k = 0;
- for (AbstractInvocationInternal anInvocation = waitingInvocations; anInvocation != null; anInvocation = anInvocation.next) {
+ AbstractInvocationInternal waitingInvocation = waitingInvocations;
+ if (waitingInvocation != null) {
k++;
- if (k > 100) {
- k = 999999;
- break;
- }
- if (anInvocation == waitingInvocations) {
- break;
+ while ((waitingInvocation = waitingInvocation.next) != waitingInvocations) {
+ if (++k > 100) {
+ k = 999999;
+ break;
+ }
}
}
s.append(k);
@@ -333,6 +311,6 @@ public abstract class AbstractIntervalInternal implements Interval
else {
castInvocation.insertAfter(waitingInvocations2.prev);
}
- // queue();
+ queue();
}
}
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationConstructor.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationConstructor.java
index 84a8f4112..232763e02 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationConstructor.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationConstructor.java
@@ -32,8 +32,8 @@ public abstract class AbstractInvocationConstructor implements InvocationConstru
{
protected int sequence = 0;
- public Incremental(@NonNull Interval interval, @NonNull String name) {
- super(interval, name);
+ public Incremental(@NonNull InvocationManager invocationManager, @NonNull String name, boolean isStrict) {
+ super(invocationManager, name, isStrict);
}
public void connect(@NonNull Connection @Nullable [] consumedConnections, @NonNull Connection @Nullable [] appendedConnections) {
@@ -60,6 +60,7 @@ public abstract class AbstractInvocationConstructor implements InvocationConstru
protected final @NonNull Interval interval;
protected final IdResolver.@NonNull IdResolverExtension idResolver;
protected final @NonNull String name;
+ protected final boolean isStrict;
/**
* Map from invocation hashCode to one or more invocations with that hashCode. Single map entries use the
@@ -69,39 +70,30 @@ public abstract class AbstractInvocationConstructor implements InvocationConstru
*/
private final @NonNull Map<@NonNull Integer, @NonNull Object> hashCode2invocations = new HashMap<>();
- private final @NonNull List<@NonNull Invocation> debugInvocations = new ArrayList<>();
+ /**
+ * Flattened copy of hashCode2invocations.values(). Not maintained until actually requested.
+ */
+ private /*@LazyNonNull*/ List<@NonNull Invocation> allInvocations = null;
private final @NonNull List<@NonNull Connection> consumedConnections = new ArrayList<>();
private final @NonNull List<@NonNull Connection> appendedConnections = new ArrayList<>();
private int /*@LazyNonNull*/ [] oldConsumedIndexes = null;
- protected AbstractInvocationConstructor(@NonNull Interval interval, @NonNull String name) {
- this.interval = interval;
- InvocationManager invocationManager = interval.getInvocationManager();
- // TransformationExecutor executor = ClassUtil.nonNullState(invocationManager.getTransformer()).getExecutor();
+ protected AbstractInvocationConstructor(@NonNull InvocationManager invocationManager, @NonNull String name, boolean isStrict) {
+ this.interval = invocationManager.createInterval();
Executor executor = invocationManager.getExecutor();
this.idResolver = (IdResolver.IdResolverExtension)executor.getIdResolver(); // FIXME null Transformer
this.name = name;
+ this.isStrict = isStrict;
invocationManager.addInvoker(this);
}
- /* protected AbstractInvokerN(@NonNull Interval interval, @NonNull InvocationConstructor constructor, @NonNull Connection @NonNull [] consumedConnections, @NonNull Connection @NonNull [] appendedConnections) {
- super(interval, constructor, appendedConnections);
- this.consumedConnections = consumedConnections;
- int consumedConnectionsSize = consumedConnections.length;
- oldConsumedIndexes = new int[consumedConnectionsSize];
- for (int i = 0; i < consumedConnectionsSize; i++) {
- oldConsumedIndexes[i] = 0;
- }
- } */
-
@Override
public <R> R accept(@NonNull ExecutionVisitor<R> visitor) {
return visitor.visitInvocationConstructor(this);
}
- @Override
- public void addAppendedConnection(@NonNull Connection connection) {
+ protected void addAppendedConnection(@NonNull Connection connection) {
assert oldConsumedIndexes == null;
assert !appendedConnections.contains(connection);
appendedConnections.add(connection);
@@ -114,84 +106,98 @@ public abstract class AbstractInvocationConstructor implements InvocationConstru
}
@Override
- public @Nullable Invocation getFirstInvocation(@NonNull Object @NonNull [] argValues) {
- int hashCode = 0;
- for (@Nullable Object argValue : argValues) {
- hashCode = 3 * hashCode + idResolver.oclHashCode(argValue);
- }
- synchronized (hashCode2invocations) {
- Object zeroOrMoreInvocations = hashCode2invocations.get(hashCode);
- Invocation oneInvocation = null;
- List<@NonNull Invocation> twoOrMoreInvocations = null;
- if (zeroOrMoreInvocations instanceof Invocation) {
- oneInvocation = (Invocation)zeroOrMoreInvocations;
- if (oneInvocation.isEqual(idResolver, argValues)) {
- return null;
+ public @NonNull Interval getInterval() {
+ return interval;
+ }
+
+ @Override
+ public @NonNull Iterable<@NonNull Invocation> getInvocations() {
+ List<@NonNull Invocation> allInvocations2 = allInvocations;
+ if (allInvocations2 == null) {
+ allInvocations2 = allInvocations = new ArrayList<>();
+ for (Object zeroOrMoreInvocations : hashCode2invocations.values()) {
+ if (zeroOrMoreInvocations instanceof Invocation) {
+ allInvocations2.add((Invocation)zeroOrMoreInvocations);
}
- }
- else if (zeroOrMoreInvocations instanceof List<?>) {
- @SuppressWarnings("unchecked")@NonNull List<@NonNull Invocation> zeroOrMoreInvocations2 = (List<@NonNull Invocation>)zeroOrMoreInvocations;
- twoOrMoreInvocations = zeroOrMoreInvocations2;
- for (@NonNull Invocation anInvocation : zeroOrMoreInvocations2) {
- if (anInvocation.isEqual(idResolver, argValues)) {
- return null;
- }
+ else if (zeroOrMoreInvocations instanceof List<?>) {
+ @SuppressWarnings("unchecked")@NonNull List<@NonNull Invocation> zeroOrMoreInvocations2 = (List<@NonNull Invocation>)zeroOrMoreInvocations;
+ allInvocations2.addAll(zeroOrMoreInvocations2);
}
}
- Invocation theInvocation = newInstance(argValues);
- debugInvocations.add(theInvocation);
- if (zeroOrMoreInvocations == null) {
- hashCode2invocations.put(hashCode, theInvocation);
- }
- else if (twoOrMoreInvocations == null) {
- twoOrMoreInvocations = new ArrayList<@NonNull Invocation>(4);
- assert oneInvocation != null;
- twoOrMoreInvocations.add(oneInvocation);
- twoOrMoreInvocations.add(theInvocation);
- hashCode2invocations.put(hashCode, twoOrMoreInvocations);
- }
- else {
- twoOrMoreInvocations.add(theInvocation);
- }
- return theInvocation;
}
+ return allInvocations2;
}
@Override
- public @NonNull Invocation getInstance(@NonNull Object @NonNull [] values) {
- // FIXME Move invokeOnce to constructor
- Invocation theInvocation = newInstance(values);
- // theInvocation.queue();
- debugInvocations.add(theInvocation);
- return theInvocation;
- }
-
- @Override
- public @NonNull Interval getInterval() {
- return interval;
+ public @NonNull String getName() {
+ return name;
}
-
+ /**
+ * Invoke a mapping with the given constructor with a given set of argValues once. This shortform of invokeOnce
+ * should only be used when it is known that recursive invocation is impossible.
+ */
@Override
- public @NonNull Iterable<@NonNull Invocation> getInvocations() {
- /* List<@NonNull Invocation> allInvocations = new ArrayList<>(); // FIXME provide a lazy iterable
- for (Object zeroOrMoreInvocations : hashCode2invocations.values()) {
- if (zeroOrMoreInvocations instanceof Invocation) {
- allInvocations.add((Invocation)zeroOrMoreInvocations);
+ public @NonNull Invocation invoke(@NonNull Object @NonNull ... argValues) {
+ Invocation theInvocation;
+ if (isStrict) {
+ int hashCode = 0;
+ for (@Nullable Object argValue : argValues) {
+ hashCode = 3 * hashCode + idResolver.oclHashCode(argValue);
}
- else if (zeroOrMoreInvocations instanceof List<?>) {
- @SuppressWarnings("unchecked")@NonNull List<@NonNull Invocation> zeroOrMoreInvocations2 = (List<@NonNull Invocation>)zeroOrMoreInvocations;
- allInvocations.addAll(zeroOrMoreInvocations2);
+ synchronized (hashCode2invocations) {
+ Object zeroOrMoreInvocations = hashCode2invocations.get(hashCode);
+ Invocation oneInvocation = null;
+ List<@NonNull Invocation> twoOrMoreInvocations = null;
+ if (zeroOrMoreInvocations instanceof Invocation) {
+ oneInvocation = (Invocation)zeroOrMoreInvocations;
+ if (oneInvocation.isEqual(idResolver, argValues)) {
+ return oneInvocation;
+ }
+ }
+ else if (zeroOrMoreInvocations instanceof List<?>) {
+ @SuppressWarnings("unchecked")@NonNull List<@NonNull Invocation> zeroOrMoreInvocations2 = (List<@NonNull Invocation>)zeroOrMoreInvocations;
+ twoOrMoreInvocations = zeroOrMoreInvocations2;
+ for (@NonNull Invocation anInvocation : zeroOrMoreInvocations2) {
+ if (anInvocation.isEqual(idResolver, argValues)) {
+ return anInvocation;
+ }
+ }
+ }
+ theInvocation = newInstance(argValues);
+ if (zeroOrMoreInvocations == null) {
+ hashCode2invocations.put(hashCode, theInvocation);
+ }
+ else if (twoOrMoreInvocations == null) {
+ twoOrMoreInvocations = new ArrayList<@NonNull Invocation>(4);
+ assert oneInvocation != null;
+ twoOrMoreInvocations.add(oneInvocation);
+ twoOrMoreInvocations.add(theInvocation);
+ hashCode2invocations.put(hashCode, twoOrMoreInvocations);
+ }
+ else {
+ twoOrMoreInvocations.add(theInvocation);
+ }
}
- } */
- return debugInvocations;
+ }
+ else {
+ theInvocation = newInstance(argValues);
+ }
+ if (allInvocations != null) {
+ allInvocations.add(theInvocation);
+ }
+ interval.queue(theInvocation);
+ return theInvocation;
}
@Override
- public @NonNull String getName() {
- return name;
+ public boolean isStrict() {
+ return isStrict;
}
+ /**
+ * Create the mapping instance. In due course, its execute() method is invoked.
+ */
protected abstract @NonNull Invocation newInstance(@NonNull Object @NonNull [] values);
@Override
@@ -239,7 +245,7 @@ public abstract class AbstractInvocationConstructor implements InvocationConstru
}
}
else {
- Invocation mappingInstance = getInstance(boundValues);
+ Invocation mappingInstance = invoke(boundValues);
for (int i = 0; i < consumedConnectionsSize; i++) {
Connection consumedConnection = consumedConnections.get(i);
consumedConnection.consume(consumeIndexes[i], mappingInstance);
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationInternal.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationInternal.java
index 342198ada..6ac99e2ad 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationInternal.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractInvocationInternal.java
@@ -22,13 +22,18 @@ import org.eclipse.qvtd.runtime.evaluation.SlotState;
public abstract class AbstractInvocationInternal implements Invocation
{
protected final @NonNull Interval interval;
+
@NonNull AbstractInvocationInternal prev = this;
@NonNull AbstractInvocationInternal next = this;
public @Nullable SlotState debug_blockedBy = null;
protected AbstractInvocationInternal(@NonNull Interval interval) {
this.interval = interval;
- // too soon interval.queue(this);
+ }
+
+ @Override
+ public @NonNull Interval getInterval() {
+ return interval;
}
@Override
@@ -42,16 +47,6 @@ public abstract class AbstractInvocationInternal implements Invocation
}
@Override
- public void invokeInternal(boolean doFlush) {
- interval.invoke(this, doFlush);
- }
-
- @Override
- public void queue() {
- interval.queue(this);
- }
-
- @Override
public void remove() {
prev.next = next;
next.prev = prev;
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java
index e644dfb98..ba8d99690 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/AbstractTransformerInternal.java
@@ -46,9 +46,8 @@ import org.eclipse.ocl.pivot.values.InvalidValueException;
import org.eclipse.ocl.pivot.values.SetValue;
import org.eclipse.qvtd.runtime.evaluation.AbstractTransformer;
import org.eclipse.qvtd.runtime.evaluation.AbstractTypedModelInstance;
+import org.eclipse.qvtd.runtime.evaluation.Connection;
import org.eclipse.qvtd.runtime.evaluation.ExecutionVisitable;
-import org.eclipse.qvtd.runtime.evaluation.Invocation;
-import org.eclipse.qvtd.runtime.evaluation.InvocationConstructor;
import org.eclipse.qvtd.runtime.evaluation.InvocationFailedException;
import org.eclipse.qvtd.runtime.evaluation.InvocationManager;
import org.eclipse.qvtd.runtime.evaluation.ObjectManager;
@@ -529,6 +528,10 @@ public abstract class AbstractTransformerInternal extends AbstractModelManager i
models[modelIndex].addRootObjects(eRootObjects);
}
+ protected @NonNull Connection createConnection(@NonNull String name, @NonNull CollectionTypeId typeId, boolean isStrict) {
+ return invocationManager.getRootInterval().createConnection(name, typeId, isStrict);
+ }
+
/**
* Create the evaluationCache. Creates a EvaluationCache by default.
*/
@@ -737,29 +740,4 @@ public abstract class AbstractTransformerInternal extends AbstractModelManager i
constructor.addAppendedConnection(appendedConnection);
}
} */
-
- /**
- * Invoke a mapping with the given constructor with a given set of boundValues once. This shortform of invokeOnce
- * should only be used when it is known that recursive invocation is impossible.
- */
- public <@Nullable T extends Invocation> void invoke(@NonNull InvocationConstructor constructor, @NonNull Object @NonNull ... boundValues) {
- @NonNull Invocation invocation = constructor.getInstance(boundValues);
- if (debugInvocations) {
- AbstractTransformer.INVOCATIONS.println("invoke " + invocation);
- }
- invocation.invokeInternal(true);
- }
-
- /**
- * Invoke a mapping with the given constructor with a given set of boundValues once. Repeated invocation attempts are ignored.
- */
- public void invokeOnce(@NonNull InvocationConstructor constructor, @NonNull Object @NonNull ... boundValues) {
- @Nullable Invocation invocation = constructor.getFirstInvocation(boundValues);
- if (invocation != null) {
- if (debugInvocations) {
- AbstractTransformer.INVOCATIONS.println("invokeOnce " + invocation);
- }
- invocation.invokeInternal(true);
- }
- }
}
diff --git a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/LazyObjectManager.java b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/LazyObjectManager.java
index 84beab98d..8183d0136 100644
--- a/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/LazyObjectManager.java
+++ b/plugins/org.eclipse.qvtd.runtime/src/org/eclipse/qvtd/runtime/internal/evaluation/LazyObjectManager.java
@@ -215,7 +215,7 @@ public class LazyObjectManager extends AbstractObjectManager
s.append("::");
s.append(debug_eFeature.getName());
s.append(" for ");
- s.append(debug_eObject);
+ s.append(LabelUtil.getLabel(debug_eObject));
s.append("]");
return s.toString();
}

Back to the top