public class LookupCodeGenerator extends AutoCodeGenerator
Modifier and Type | Field and Description |
---|---|
protected AS2CGVisitor |
as2cgVisitor |
protected Property |
asChildProperty |
protected Variable |
asContextVariable |
protected Operation |
asElementEnvOperation |
protected Operation |
asElementParentEnvOperation |
protected Operation |
asEnvironmentAddElementsOfElementOperation |
protected Operation |
asEnvironmentAddElementsOfElementsOperation |
protected Operation |
asEnvironmentHasFinalResultOperation |
protected Operation |
asEnvironmentNestedEnvOperation |
protected Class |
asEnvironmentType |
protected Property |
asEvaluatorProperty |
protected Property |
asIdResolverProperty |
protected Variable |
asThisVariable |
protected Class |
asVisitorClass |
protected Operation |
asVisitorEnvForChildOperation |
protected Operation |
asVisitorEnvOperation |
protected Operation |
asVisitorParentEnvOperation |
protected LookupClassContext |
classContext |
protected java.lang.String |
className |
protected java.lang.String |
packageName |
asPackage, asSuperPackage, baseProjectPrefix, baseVisitorPackage, cgAnalyzer, externalPackages, genModel, genPackage, projectName, projectPrefix, superManualVisitorPackage, superProjectPrefix, superVisitorClass, visitableClass, visitorClass, visitorPackage
javaPrimitiveClasses, javaPrimitiveNames, knownClasses
environmentFactory, genModelHelper, metamodelManager, nameManager, ORG_ECLIPSE_JDT_ANNOTATION_NON_NULL, ORG_ECLIPSE_JDT_ANNOTATION_NULLABLE
Modifier | Constructor and Description |
---|---|
protected |
LookupCodeGenerator(EnvironmentFactoryInternal environmentFactory,
Package asPackage,
Package asSuperPackage,
Package asBasePackage,
org.eclipse.emf.codegen.ecore.genmodel.GenPackage genPackage,
java.lang.String projectPrefix,
java.lang.String projectName,
java.lang.String visitorPackage,
java.lang.String visitorClass,
java.lang.String visitableClass,
java.lang.String superProjectPrefix,
java.lang.String superManualVisitorPackage,
java.lang.String superVisitorClass,
java.lang.String baseVisitorPrefix,
java.lang.String baseVisitorPackage) |
Modifier and Type | Method and Description |
---|---|
protected void |
convertOperations(CGClass cgClass,
java.util.Collection<Operation> asOperations)
Convert the asOperations to cgOperations of cgClass.
|
protected void |
convertProperties(CGClass cgClass,
java.util.List<Property> asProperties)
Convert the asProperties to cgProperties of cgClass.
|
protected void |
convertSuperTypes(CGClass cgClass)
Convert the construction context to supertypes/interfaces of cgClass.
|
protected Class |
createASVisitorClass(java.lang.String packageName,
java.lang.String className) |
CG2JavaPreVisitor |
createCG2JavaPreVisitor() |
protected LookupCG2JavaVisitor |
createCG2JavaVisitor(CGPackage cgPackage,
java.util.List<CGValuedElement> sortedGlobals) |
protected CGPackage |
createCGPackage()
Synthesize an AS package by simple AS2AS conversions and convert the AS package to a CG package for onward code generation.
|
protected Property |
createNativeProperty(java.lang.String name,
java.lang.Class<?> javaClass,
boolean isReadOnly) |
protected Property |
createNativeProperty(java.lang.String name,
Type asElementType,
boolean isReadOnly) |
protected NullLiteralExp |
createNullLiteralExp() |
protected VariableExp |
createThisVariableExp() |
protected Operation |
createVisitOperationDeclaration(java.util.Map<Element,Element> reDefinitions,
Operation envOperation,
Property asChildProperty)
Convert 'Element'::_env(child : Element) : Environment
to AutoPivotLookupVisitor::visit'Element'(parent : 'Element') : Environment
with child accessed as this.child.
|
protected java.util.Map<Operation,Operation> |
createVisitOperationDeclarations(java.util.Map<Element,Element> reDefinitions) |
static void |
generate(org.eclipse.emf.codegen.ecore.genmodel.GenPackage genPackage,
java.lang.String projectPrefix,
java.lang.String projectName,
java.lang.String lookupFilePath,
java.lang.String visitorPackage,
java.lang.String visitorClass,
java.lang.String visitableClass,
java.lang.String superProjectPrefix,
java.lang.String superProjectName,
java.lang.String superVisitorClass,
java.lang.String baseProjectPrefix,
java.lang.String baseVisitorPackage) |
protected java.lang.String |
getAutoVisitorClassName(java.lang.String prefix) |
CGValuedElement |
getChildVariable() |
java.lang.Class<?> |
getEnvironmentClass() |
CGValuedElement |
getEvaluatorVariable() |
LookupClassContext |
getGlobalContext() |
CGValuedElement |
getIdResolverVariable() |
protected java.lang.String |
getManualVisitorClassName(java.lang.String prefix) |
protected java.lang.String |
getManualVisitorPackageName(java.lang.String visitorsPackageName) |
java.lang.String |
getSourceFileName() |
protected java.lang.String |
getVisitorPackageName(java.lang.String visitorsPackageName) |
java.lang.Class<?> |
getVisitorResultClass() |
protected void |
rewriteAddElementsOfOperationCall(OperationCallExp asOperationCallExp)
Convert env.addElementsOf(arg) to this.envForChildren(arg, null)
|
protected void |
rewriteEnvOperationCall(OperationCallExp asOperationCallExp)
Convert source.env(child) to this.env(source, child)
|
protected void |
rewriteNestedEnvOperationCall(OperationCallExp asOperationCallExp)
Convert "source.nestedEnv().r.e.s.i.d.u.e" to
"let innerEnv = this.context.r.e.s.i.d.u.e in if innerEnv.hasFinalResult() then innerEnv else source endif"
where r.e.s.i.d.u.e does not include any nestedEnv() call.
|
protected void |
rewriteOperationCalls(java.util.Collection<? extends org.eclipse.emf.ecore.EObject> allContents)
Replace selected OperationCallExps by alternative implementations.
|
protected void |
rewriteParentEnvOperationCall(OperationCallExp asOperationCallExp)
Convert source.parentEnv() to this.parentEnv(source)
|
protected void |
rewriteVisitOperationBodies(java.util.Map<Element,Element> reDefinitions,
java.util.Map<Operation,Operation> envOperation2asOperation)
Copy all the visitXXX operation bodies from the _env bodies replacing references to redefined parameters.
|
protected boolean |
sameOrRedefiningOperation(Operation redefiningOperation,
Operation baseOperation) |
createAnalysisVisitor, createAS2CGVisitor, createBoxingAnalyzer, createDependencyVisitor, createFieldingAnalyzer, createOptions, createReferencesVisitor, generateClassFile, getAnalyzer, getCGResourceFactory, getExternalClass, getExternalClass, getExternalClass, getGenPackage, getOptions, getQualifiedName, getVisitableClass, getVisitablePivotClass, saveSourceFile
createCommonSubexpressionEliminator, createGenModelHelper, createId2BoxedDescriptorVisitor, createId2EClassVisitor, createNameManager, getBoxedDescriptor, getConstantsClass, getGlobalPlace, getId2BoxedDescriptorVisitor, getId2EClassVisitor, getIsNonNull, getIterationHelper, getLeastDerivedMethod, getTypeDescriptor, getUnboxedDescriptor, initPrimitive, isNonNull, isNonNull, maybePrimitive, optimize, prepareGlobals
addProblem, getDefaultIndent, getEnvironmentFactory, getGenModelHelper, getNameManager, isFinal
@NonNull protected final java.lang.String packageName
@NonNull protected final java.lang.String className
@NonNull protected final LookupClassContext classContext
@NonNull protected final AS2CGVisitor as2cgVisitor
@NonNull protected final Operation asEnvironmentHasFinalResultOperation
@NonNull protected final Operation asEnvironmentAddElementsOfElementOperation
@NonNull protected final Operation asEnvironmentAddElementsOfElementsOperation
protected LookupCodeGenerator(@NonNull EnvironmentFactoryInternal environmentFactory, @NonNull Package asPackage, @Nullable Package asSuperPackage, @NonNull Package asBasePackage, @NonNull org.eclipse.emf.codegen.ecore.genmodel.GenPackage genPackage, @NonNull java.lang.String projectPrefix, @NonNull java.lang.String projectName, @NonNull java.lang.String visitorPackage, @NonNull java.lang.String visitorClass, @NonNull java.lang.String visitableClass, @Nullable java.lang.String superProjectPrefix, @Nullable java.lang.String superManualVisitorPackage, @Nullable java.lang.String superVisitorClass, @Nullable java.lang.String baseVisitorPrefix, @Nullable java.lang.String baseVisitorPackage)
public static void generate(@NonNull org.eclipse.emf.codegen.ecore.genmodel.GenPackage genPackage, @NonNull java.lang.String projectPrefix, @NonNull java.lang.String projectName, @NonNull java.lang.String lookupFilePath, @NonNull java.lang.String visitorPackage, @NonNull java.lang.String visitorClass, @NonNull java.lang.String visitableClass, @Nullable java.lang.String superProjectPrefix, @Nullable java.lang.String superProjectName, @Nullable java.lang.String superVisitorClass, @Nullable java.lang.String baseProjectPrefix, @Nullable java.lang.String baseVisitorPackage)
protected void convertOperations(@NonNull CGClass cgClass, @NonNull java.util.Collection<Operation> asOperations)
protected void convertProperties(@NonNull CGClass cgClass, @NonNull java.util.List<Property> asProperties)
protected void convertSuperTypes(@NonNull CGClass cgClass)
@NonNull protected Class createASVisitorClass(@NonNull java.lang.String packageName, @NonNull java.lang.String className)
@NonNull protected LookupCG2JavaVisitor createCG2JavaVisitor(@NonNull CGPackage cgPackage, @Nullable java.util.List<CGValuedElement> sortedGlobals)
createCG2JavaVisitor
in class AutoCodeGenerator
@NonNull public CG2JavaPreVisitor createCG2JavaPreVisitor()
createCG2JavaPreVisitor
in class AutoCodeGenerator
@NonNull protected CGPackage createCGPackage() throws ParserException
createCGPackage
in class AutoCodeGenerator
ParserException
@NonNull protected Property createNativeProperty(@NonNull java.lang.String name, @NonNull Type asElementType, boolean isReadOnly)
@NonNull protected Property createNativeProperty(@NonNull java.lang.String name, @NonNull java.lang.Class<?> javaClass, boolean isReadOnly)
@NonNull protected VariableExp createThisVariableExp()
@NonNull protected NullLiteralExp createNullLiteralExp()
@NonNull protected java.util.Map<Operation,Operation> createVisitOperationDeclarations(@NonNull java.util.Map<Element,Element> reDefinitions) throws ParserException
ParserException
@NonNull protected Operation createVisitOperationDeclaration(@NonNull java.util.Map<Element,Element> reDefinitions, @NonNull Operation envOperation, @NonNull Property asChildProperty) throws ParserException
ParserException
@NonNull protected java.lang.String getAutoVisitorClassName(@NonNull java.lang.String prefix)
getAutoVisitorClassName
in class AutoCodeGenerator
@NonNull public CGValuedElement getChildVariable()
@NonNull public CGValuedElement getEvaluatorVariable()
@NonNull public LookupClassContext getGlobalContext()
getGlobalContext
in interface CodeGenerator
getGlobalContext
in class JavaCodeGenerator
@NonNull public CGValuedElement getIdResolverVariable()
@NonNull protected java.lang.String getManualVisitorClassName(@NonNull java.lang.String prefix)
getManualVisitorClassName
in class AutoCodeGenerator
@NonNull public java.lang.String getSourceFileName()
getSourceFileName
in class AutoCodeGenerator
@NonNull public java.lang.Class<?> getVisitorResultClass()
getVisitorResultClass
in class AutoCodeGenerator
@NonNull public java.lang.Class<?> getEnvironmentClass()
@NonNull protected java.lang.String getVisitorPackageName(@NonNull java.lang.String visitorsPackageName)
getVisitorPackageName
in class AutoCodeGenerator
@NonNull protected java.lang.String getManualVisitorPackageName(@NonNull java.lang.String visitorsPackageName)
protected void rewriteOperationCalls(@NonNull java.util.Collection<? extends org.eclipse.emf.ecore.EObject> allContents)
protected boolean sameOrRedefiningOperation(@NonNull Operation redefiningOperation, @NonNull Operation baseOperation)
protected void rewriteEnvOperationCall(@NonNull OperationCallExp asOperationCallExp)
protected void rewriteNestedEnvOperationCall(@NonNull OperationCallExp asOperationCallExp)
protected void rewriteParentEnvOperationCall(@NonNull OperationCallExp asOperationCallExp)
protected void rewriteAddElementsOfOperationCall(@NonNull OperationCallExp asOperationCallExp)
protected void rewriteVisitOperationBodies(@NonNull java.util.Map<Element,Element> reDefinitions, @NonNull java.util.Map<Operation,Operation> envOperation2asOperation) throws ParserException
ParserException