[502235] Refresh autogen for use of cached operations
diff --git a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/java/AutoCG2JavaVisitor.java b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/java/AutoCG2JavaVisitor.java
index f434351..977f43e 100644
--- a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/java/AutoCG2JavaVisitor.java
+++ b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/java/AutoCG2JavaVisitor.java
@@ -41,6 +41,9 @@
@Override
final protected boolean doClassMethods(@NonNull CGClass cgClass, boolean needsBlankLine) {
+ if (needsBlankLine) {
+ js.append("\n");
+ }
doConstructor(cgClass);
doMoreClassMethods(cgClass);
return super.doClassMethods(cgClass, needsBlankLine);
diff --git a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/java/AutoGlobalContext.java b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/java/AutoGlobalContext.java
index 7726ab6..2f05d70 100644
--- a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/java/AutoGlobalContext.java
+++ b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/java/AutoGlobalContext.java
@@ -13,12 +13,15 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.ocl.examples.codegen.cgmodel.CGElement;
import org.eclipse.ocl.examples.codegen.cgmodel.CGValuedElement;
+import org.eclipse.ocl.examples.codegen.java.JavaConstants;
import org.eclipse.ocl.examples.codegen.java.JavaGlobalContext;
public class AutoGlobalContext<@NonNull CG extends AutoCodeGenerator> extends JavaGlobalContext<CG> {
public AutoGlobalContext(CG codeGenerator, org.eclipse.ocl.pivot.@NonNull Package asPackage) {
super(codeGenerator);
+ // nameManager.reserveName(JavaConstants.EXECUTOR_NAME, null);
+ nameManager.reserveName(JavaConstants.EVALUATION_CACHE_NAME, null);
}
@Override
diff --git a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterCG2JavaVisitor.java b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterCG2JavaVisitor.java
index e70e5ea..32c0bd7 100644
--- a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterCG2JavaVisitor.java
+++ b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterCG2JavaVisitor.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* E.D.Willink - Initial API and implementation
* Adolfo Sanchez-Barbudo Herrera (University of York) - Lookup Environment/Visitor
@@ -24,6 +24,8 @@
import org.eclipse.ocl.examples.codegen.cgmodel.CGValuedElement;
import org.eclipse.ocl.examples.codegen.java.JavaConstants;
import org.eclipse.ocl.pivot.evaluation.Executor;
+import org.eclipse.ocl.pivot.internal.evaluation.EvaluationCache;
+import org.eclipse.ocl.pivot.internal.evaluation.ExecutorInternal.ExecutorInternalExtension;
/**
* LookupCG2JavaVisitor refines the regular generation of Java code from an optimized Auto CG transformation tree
@@ -37,6 +39,20 @@
}
@Override
+ protected boolean doClassFields(@NonNull CGClass cgClass, boolean needsBlankLine) {
+ if (needsBlankLine) {
+ js.append("\n");
+ }
+ js.append("protected final ");
+ js.appendIsRequired(true);
+ js.append(" ");
+ js.appendClassReference(EvaluationCache.class);
+ js.append(" "+JavaConstants.EVALUATION_CACHE_NAME);
+ js.append(";\n");
+ return super.doClassFields(cgClass, false);
+ }
+
+ @Override
protected void doConstructor(@NonNull CGClass cgClass) {
js.append("public " + cgClass.getName() + "(");
js.appendIsRequired(true);
@@ -51,23 +67,26 @@
js.appendClassReference(null, getFilteredType(cgClass));
js.append(".class");
js.append(");\n");
-
+
addFilterPropsInit(cgClass);
js.append("this." + JavaConstants.EXECUTOR_NAME + " = " +JavaConstants.EXECUTOR_NAME + ";\n");
js.append("this." + JavaConstants.ID_RESOLVER_NAME + " = " + JavaConstants.EXECUTOR_NAME + ".getIdResolver();\n");
-
+ js.append("this." + JavaConstants.EVALUATION_CACHE_NAME + " = ((");
+ js.appendClassReference(ExecutorInternalExtension.class);
+ js.append(")" + JavaConstants.EXECUTOR_NAME + ").getEvaluationCache();\n");
+
js.popIndentation();
js.append("}\n");
}
-
-
+
+
private void addFilterParameters(CGClass cgClass) {
for (CGProperty filteringVar : context.getFilteringVars(cgClass)) {
js.append(",");
js.appendDeclaration(filteringVar);
}
}
-
+
private void addFilterPropsInit(CGClass cgClass) {
for (CGProperty filteringVar : context.getFilteringVars(cgClass)) {
String varName = filteringVar.getValueName();
@@ -78,15 +97,15 @@
js.append(";\n");
}
}
-
+
private CGValuedElement getFilteredType(CGClass cgClass) {
-
+
//We get the first CGoperation, and the parameter will refer to the filteredType
CGOperation cgFilteringOp = cgClass.getOperations().get(0);
CGParameter param = cgFilteringOp.getParameters().get(0);
return param.getTypedValue();
}
-
-
+
+
}
diff --git a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterClassContext.java b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterClassContext.java
index 538b76d..91f82e2 100644
--- a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterClassContext.java
+++ b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterClassContext.java
@@ -25,5 +25,8 @@
public LookupFilterClassContext(@NonNull LookupFilterGenerator codeGenerator, org.eclipse.ocl.pivot.@NonNull Package asPackage) {
super(codeGenerator, asPackage);
+ nameManager.reserveName(APPLIES_FILTER_OP_PREFIX, null);
+ nameManager.reserveName(ELEMENT_NAME, null);
+ nameManager.reserveName(MATCHES_OP_NAME, null);
}
}
\ No newline at end of file
diff --git a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterGenerator.java b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterGenerator.java
index 1667737..d2d460e 100644
--- a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterGenerator.java
+++ b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupFilterGenerator.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* E.D.Willink - Initial API and implementation
* Adolfo Sanchez-Barbudo Herrera (University of York) - Lookup Environment/Visitor
@@ -61,50 +61,50 @@
* LookupCodeGenerator supports generation of the content of a JavaClassFile for the Lookup visitor.
*/
public class LookupFilterGenerator extends AutoCodeGenerator
-{
+{
protected final @NonNull LookupFilterClassContext classContext;
protected final @NonNull AS2CGVisitor as2cgVisitor;
- protected final @NonNull String lookupPackageName;
+ protected final @NonNull String lookupPackageName;
protected final @Nullable String superLookupPackageName;
protected final @NonNull String baseLookupPackage;
-
+
//
// New AS elements
//
-
+
protected final @NonNull List<org.eclipse.ocl.pivot.Package> asPackages;
-
+
//
// Important CG elements
//
private @Nullable CGProperty cgEvaluatorVariable = null;
private @Nullable CGProperty cgIdResolverVariable = null;
-
-
+
+
private @NonNull Set<Property> filteringProps = new HashSet<Property>();
- private @NonNull Map<CGClass, List<@NonNull CGProperty>> cgClass2cgFilteringProps = new HashMap<CGClass, @NonNull List<@NonNull CGProperty>>();
+ private @NonNull Map<CGClass, List<@NonNull CGProperty>> cgClass2cgFilteringProps = new HashMap<CGClass, @NonNull List<@NonNull CGProperty>>();
protected LookupFilterGenerator(@NonNull EnvironmentFactoryInternal environmentFactory, org.eclipse.ocl.pivot.@NonNull Package asPackage,
org.eclipse.ocl.pivot.@Nullable Package asSuperPackage, org.eclipse.ocl.pivot.@NonNull Package asBasePackage, @NonNull GenPackage genPackage,
@Nullable GenPackage superGenPackage, @Nullable GenPackage baseGenPackage,
- @NonNull String lookupPackageName, @Nullable String superLookupPackageName,
+ @NonNull String lookupPackageName, @Nullable String superLookupPackageName,
@Nullable String baseLookupPackage) {
super(environmentFactory, asPackage, asSuperPackage, genPackage, superGenPackage, baseGenPackage);
this.lookupPackageName = lookupPackageName;
this.superLookupPackageName = superLookupPackageName;
this.baseLookupPackage = baseLookupPackage != null ? baseLookupPackage :
- superLookupPackageName != null ? superLookupPackageName :
- lookupPackageName;
+ superLookupPackageName != null ? superLookupPackageName :
+ lookupPackageName;
this.classContext = new LookupFilterClassContext(this, asPackage);
this.as2cgVisitor = createAS2CGVisitor();
this.asPackages = createASPackages();
}
private @NonNull List<org.eclipse.ocl.pivot.Package> createASPackages() {
-
+
List<org.eclipse.ocl.pivot.Package> result = new ArrayList<org.eclipse.ocl.pivot.Package>();
List<Operation> filteringOps = gatherFilteringOps(asPackage);
-
+
for (Operation filteringOp : filteringOps) {
String filteredClassName = filteringOp.getOwningClass().getName();
org.eclipse.ocl.pivot.Package asPackage = createASPackage(getSourcePackageName());
@@ -123,24 +123,24 @@
}
return result;
}
-
-
+
+
/**
- * Convert 'Element'::_appliesFilter_'Element'(filterArg : FilterArgType) : Boolean
+ * Convert 'Element'::_appliesFilter_'Element'(filterArg : FilterArgType) : Boolean
* to 'Element'LookupFilter::_matches(element : 'Element') : Boolean
- *
- * with
+ *
+ * with
* - self accessed as element.
* - filterArg accessed as this.filterArg (NB there might be many filterArgs).
- * @throws ParserException
+ * @throws ParserException
*/
private Operation createASMatchesOperation(@NonNull Operation filteringOp, org.eclipse.ocl.pivot.@NonNull Class asClass, @NonNull Variable thisVariable){
-
- Map<Element,Element> redefinitions = new HashMap<Element,Element>();
+
+ Map<Element,Element> redefinitions = new HashMap<Element,Element>();
ExpressionInOCL oldExpressionInOCL = getExpressionInOCL(filteringOp);
ExpressionInOCL newExpressionInOCL = PivotFactory.eINSTANCE.createExpressionInOCL();
-
+
Type filteringOpType = filteringOp.getType();
assert filteringOpType != null;
Operation asOperation = PivotUtil.createOperation("_" + LookupFilterClassContext.MATCHES_OP_NAME, filteringOpType, null, null);
@@ -149,12 +149,12 @@
LetExp letRoot = null;
LetExp letLeaf = null;
for (Variable paramVar : oldExpressionInOCL.getOwnedParameters()) {
- String paramName = paramVar.getName();
+ String paramName = nameManager.reserveName(paramVar.getName(), paramVar);
Type paramType = paramVar.getType();
assert (paramName != null) && (paramType != null);
Property asProperty = createNativeProperty(paramName, paramType, true, true);
asClass.getOwnedProperties().add(asProperty);
-
+
// Redefinition requires a Variable access rather than a Property
VariableExp asThisVarExp = createThisVariableExp(thisVariable);
PropertyCallExp asPropertyAccess = PivotUtil.createPropertyCallExp(asThisVarExp, asProperty);
@@ -171,14 +171,14 @@
}
letLeaf = letExp;
}
-
+
// Filtering op context is translated as asOperation parameter
org.eclipse.ocl.pivot.Class asType = ClassUtil.nonNullState(filteringOp.getOwningClass());
- Variable asParamVar = PivotUtil.createVariable(LookupFilterClassContext.ELEMENT_NAME, asType,
+ Variable asParamVar = PivotUtil.createVariable(LookupFilterClassContext.ELEMENT_NAME, asType,
true, null);
newExpressionInOCL.getOwnedParameters().add(asParamVar);
redefinitions.put(oldExpressionInOCL.getOwnedContext(), asParamVar);
-
+
OCLExpression asExpression = RereferencingCopier.copy(ClassUtil.nonNullState(oldExpressionInOCL.getOwnedBody()), redefinitions);
if ((letRoot != null) && (letLeaf != null)) {
for (LetExp letExp = letRoot; letExp != null; letExp = (LetExp) letExp.getOwnedIn()) {
@@ -198,23 +198,23 @@
PivotUtil.initOperation(asOperation, newExpressionInOCL);
return asOperation;
}
-
+
private List<Operation> gatherFilteringOps(
org.eclipse.ocl.pivot.@NonNull Package asPackage) {
-
+
return asPackage.getOwnedClasses().stream()
- .map(c -> c.getOwnedOperations())
- .flatMap(o -> o.stream())
- .filter(o -> o.getName().startsWith(LookupFilterClassContext.APPLIES_FILTER_OP_PREFIX)) // interested op
- //.map(o -> o.getName().substring(o.getName().indexOf(LookupFilterClassContext.APPLIES_FILTER_OP_PREFIX))) // type name is after appliesFilter prefix
- .collect(Collectors.toList());
-
+ .map(c -> c.getOwnedOperations())
+ .flatMap(o -> o.stream())
+ .filter(o -> o.getName().startsWith(LookupFilterClassContext.APPLIES_FILTER_OP_PREFIX)) // interested op
+ //.map(o -> o.getName().substring(o.getName().indexOf(LookupFilterClassContext.APPLIES_FILTER_OP_PREFIX))) // type name is after appliesFilter prefix
+ .collect(Collectors.toList());
+
}
-
+
protected void convertPackages(@NonNull CGModel cgModel, @NonNull List<org.eclipse.ocl.pivot.Package> asPackages) {
-
-
+
+
for (org.eclipse.ocl.pivot.Package asPackage : asPackages) {
CGPackage cgPackage = CGModelFactory.eINSTANCE.createCGPackage();
cgModel.getPackages().add(cgPackage);
@@ -222,16 +222,16 @@
cgPackage.setName(asPackage.getName());
convertClasses(cgPackage, asPackage.getOwnedClasses());
}
-
+
}
-
+
protected void convertClasses(@NonNull CGPackage cgPackage, @NonNull List<org.eclipse.ocl.pivot.Class> asClasses) {
-
+
for (org.eclipse.ocl.pivot.Class asClass : asClasses) {
CGClass cgClass = CGModelFactory.eINSTANCE.createCGClass();
cgPackage.getClasses().add(cgClass);
cgClass.setAst(asClass);
- cgClass.setName(asClass.getName());
+ cgClass.setName(asClass.getName());
convertProperties(cgClass, asClass.getOwnedProperties());
convertOperations(cgClass, asClass.getOwnedOperations());
convertSuperTypes(cgClass);
@@ -260,16 +260,16 @@
List<CGProperty> cgProps = cgClass2cgFilteringProps.get(cgClass);
if (cgProps == null) {
cgProps = new ArrayList<CGProperty>();
- cgClass2cgFilteringProps.put(cgClass, cgProps);
+ cgClass2cgFilteringProps.put(cgClass, cgProps);
}
cgProps.add(cgProperty);
}
}
}
-
+
/**
* Convert the construction context to supertypes/interfaces of cgClass.
- *
+ *
* Note: convertOperation should have been called first, so that we can access the target Operation
* from which we can obtain the templater parameter substitution for the AbstractFilter super type
*/
@@ -285,7 +285,7 @@
cgSuperClass.getTemplateParameters().add(getExternalClass(filteredType));
cgClass.getSuperTypes().add(cgSuperClass);
}
-
+
@Override
protected @NonNull LookupFilterCG2JavaVisitor createCG2JavaVisitor(@NonNull CGPackage cgPackage, @Nullable List<CGValuedElement> sortedGlobals) {
return new LookupFilterCG2JavaVisitor(this, cgPackage, sortedGlobals);
@@ -297,8 +297,8 @@
}
/**
- * Synthesize an AS package by simple AS2AS conversions and convert the AS package to a CG package for onward code generation.
- * @throws ParserException
+ * Synthesize an AS package by simple AS2AS conversions and convert the AS package to a CG package for onward code generation.
+ * @throws ParserException
*/
@Override
protected @NonNull List<CGPackage> createCGPackages() throws ParserException {
@@ -312,12 +312,12 @@
protected @NonNull VariableExp createThisVariableExp(@NonNull Variable thisVariable) {
return PivotUtil.createVariableExp(thisVariable);
}
-
-
+
+
protected @NonNull NullLiteralExp createNullLiteralExp() {
return metamodelManager.createNullLiteralExp();
}
-
+
public @NonNull CGValuedElement getEvaluatorVariable() {
// When generating lookup visitors for derived languages, the common lookup visitor is no
// not generated. Therefore we have to add this hack to provide CG for executor property
@@ -328,7 +328,7 @@
}
return ClassUtil.nonNullState(cgEvaluatorVariable);
}
-
+
@Override
public @NonNull LookupFilterClassContext getGlobalContext() {
@@ -356,11 +356,11 @@
protected @NonNull String getSourcePackageName() {
return lookupPackageName + ".util";
}
-
+
protected @Nullable String getSuperSourcePackageName() {
return superLookupPackageName + ".util";
}
-
+
protected @NonNull String getBaseSourcePackageName() {
return baseLookupPackage + ".util";
}
diff --git a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupVisitorsClassContext.java b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupVisitorsClassContext.java
index 965c679..08b630f 100644
--- a/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupVisitorsClassContext.java
+++ b/examples/org.eclipse.ocl.examples.autogen/src/org/eclipse/ocl/examples/autogen/lookup/LookupVisitorsClassContext.java
@@ -34,6 +34,17 @@
public LookupVisitorsClassContext(@NonNull LookupVisitorsCodeGenerator codeGenerator, org.eclipse.ocl.pivot.@NonNull Package asPackage) {
super(codeGenerator, asPackage);
+ nameManager.reserveName(CHILD_NAME, null);
+ // nameManager.reserveName(CONTEXT_NAME, null);
+ nameManager.reserveName(ELEMENT_NAME, null);
+ nameManager.reserveName(UNQUALIFIED_ENV_NAME, null);
+ nameManager.reserveName(EXPORTED_ENV_NAME, null);
+ nameManager.reserveName(HAS_FINAL_RESULT_NAME, null);
+ nameManager.reserveName(INMPORTER_NAME, null);
+ nameManager.reserveName(NESTED_ENV_NAME, null);
+ nameManager.reserveName(PARENT_NAME, null);
+ nameManager.reserveName(PARENT_ENV_NAME, null);
+ nameManager.reserveName(QUALIFIED_ENV_NAME, null);
}
}
\ No newline at end of file
diff --git a/examples/org.eclipse.ocl.examples.build/src/org/eclipse/ocl/examples/build/xtend/GenerateAutoLookupInfrastructureXtend.xtend b/examples/org.eclipse.ocl.examples.build/src/org/eclipse/ocl/examples/build/xtend/GenerateAutoLookupInfrastructureXtend.xtend
index def69a8..1ce2297 100644
--- a/examples/org.eclipse.ocl.examples.build/src/org/eclipse/ocl/examples/build/xtend/GenerateAutoLookupInfrastructureXtend.xtend
+++ b/examples/org.eclipse.ocl.examples.build/src/org/eclipse/ocl/examples/build/xtend/GenerateAutoLookupInfrastructureXtend.xtend
@@ -438,6 +438,9 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.internal.evaluation.EvaluationCache;
+ «IF !isDerived»
+ import org.eclipse.ocl.pivot.internal.evaluation.ExecutorInternal.ExecutorInternalExtension;
+ «ENDIF»
import «baseLookupPackageName».LookupEnvironment;
import «visitablePackageName».«visitableClassName»;
@@ -453,7 +456,7 @@
protected «visitorName»(@NonNull LookupEnvironment context) {
super(context);
- «IF !isDerived»this.evaluationCache = context.getEvaluationCache();«ENDIF»
+ «IF !isDerived»this.evaluationCache = ((ExecutorInternalExtension)context.getExecutor()).getEvaluationCache();«ENDIF»
«IF isDerived»this.delegate = createSuperLangVisitor();«ENDIF»
}
diff --git a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaVisitor.java b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaVisitor.java
index da2ab10..a56e3f7 100644
--- a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaVisitor.java
+++ b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/CG2JavaVisitor.java
@@ -499,6 +499,7 @@
}
protected void doCachedOperationBasicEvaluate(@NonNull CGOperation cgOperation) {
+ String nativeOperationClassName = getNativeOperationClassName(cgOperation);
List<@NonNull CGParameter> cgParameters = ClassUtil.nullFree(cgOperation.getParameters());
CGValuedElement body = getExpression(cgOperation.getBody());
js.append("@Override\n");
@@ -527,7 +528,7 @@
js.append(" ");
js.appendIsRequired(true);
js.append(" [] ");
- js.append("sourceAndArgumentValues");
+ js.append(JavaConstants.SOURCE_AND_ARGUMENT_VALUES_NAME);
js.append(") {\n");
js.pushIndentation(null);
int i = 0;
@@ -541,7 +542,9 @@
js.appendDeclaration(cgParameter);
js.append(" = (");
js.appendTypeDeclaration(cgParameter);
- js.append(")sourceAndArgumentValues[" + i++ + "];\n");
+ js.append(")");
+ js.append(JavaConstants.SOURCE_AND_ARGUMENT_VALUES_NAME);
+ js.append("[" + i++ + "];\n");
}
appendReturn(body);
js.popIndentation();
diff --git a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/JavaConstants.java b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/JavaConstants.java
index a175280..c4596b8 100644
--- a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/JavaConstants.java
+++ b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/JavaConstants.java
@@ -43,6 +43,7 @@
public static final @NonNull String ID_RESOLVER_NAME = "idResolver";
public static final @NonNull String INSTANCE_NAME = "INSTANCE";
public static final @NonNull String SELF_NAME = "self";
+ public static final @NonNull String SOURCE_AND_ARGUMENT_VALUES_NAME = "sourceAndArgumentValues";
public static final @NonNull String STANDARD_LIBRARY_NAME = "standardLibrary";
public static final @NonNull String TYPE_ID_NAME = "typeId";
diff --git a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/JavaGlobalContext.java b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/JavaGlobalContext.java
index 3b27de9..7c28d19 100644
--- a/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/JavaGlobalContext.java
+++ b/examples/org.eclipse.ocl.examples.codegen/src/org/eclipse/ocl/examples/codegen/java/JavaGlobalContext.java
@@ -43,6 +43,7 @@
protected final @NonNull String evaluateName;
protected final @NonNull String instanceName;
protected final @NonNull String selfName;
+ protected final @NonNull String sourceAndArgumentValuesName;
public JavaGlobalContext(@NonNull CG codeGenerator) {
super(codeGenerator);
@@ -51,6 +52,7 @@
this.evaluateName = nameManager.reserveName(JavaConstants.EVALUATE_NAME, null);
this.instanceName = nameManager.reserveName(JavaConstants.INSTANCE_NAME, null);
this.selfName = nameManager.reserveName(PivotConstants.SELF_NAME, null);
+ this.sourceAndArgumentValuesName = nameManager.reserveName(JavaConstants.SOURCE_AND_ARGUMENT_VALUES_NAME, null);
}
protected void addGlobal(@NonNull CGValuedElement cgGlobal) {
@@ -134,6 +136,10 @@
return selfName;
}
+ public @NonNull String getSourceAndArgumentValuesName() {
+ return sourceAndArgumentValuesName;
+ }
+
public @NonNull String getValueName(@NonNull CGValuedElement cgValuedElement) {
JavaLocalContext<@NonNull ? extends CG> localContext = getLocalContext(cgValuedElement);
if ((localContext != null) && !cgValuedElement.isGlobal()) {