org.eclipse.ocl.examples.codegen.analyzer
Class CodeGenAnalyzer
java.lang.Object
org.eclipse.ocl.examples.codegen.analyzer.CodeGenAnalyzer
public class CodeGenAnalyzer
- extends java.lang.Object
A CodeGenAnalyzer performs the analysis of a Pivot AST in preparation for code generation.
Pass 1: Pivot2CGAnalysisVisitor
Each Pivot Element is converted to a CGElement
This conversion creates objects such as CGLibraryOperationCallEXp that are more atuned to CG
and provides a tree that can be rewritten by optimizations.
Pass 2: CGPreAnalysisVisitor
Traversal of the CG containment tree performs
constant folding
Pass N-1: CG2JavaPreVisitor
Traversal of the CG containment tree prepares for Java CG by
gathering imports
Pass N: CG2JavaVisitor
Traversal of the CG containment tree emits code
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
codeGenerator
@NonNull
protected final CodeGenerator codeGenerator
nameManager
@NonNull
protected final NameManager nameManager
cgFalse
@NonNull
protected final CGBoolean cgFalse
cgTrue
@NonNull
protected final CGBoolean cgTrue
cgNull
@NonNull
protected final CGNull cgNull
CodeGenAnalyzer
public CodeGenAnalyzer(@NonNull
CodeGenerator codeGenerator)
analyze
public void analyze(@NonNull
CGElement cgRoot)
createCGConstantExp
@NonNull
public CGConstantExp createCGConstantExp(@NonNull
OCLExpression element,
@NonNull
CGConstant constant)
createCGBoolean
@NonNull
protected CGBoolean createCGBoolean(boolean booleanValue)
createCGNull
@NonNull
protected CGNull createCGNull()
getCodeGenerator
@NonNull
public CodeGenerator getCodeGenerator()
getBoolean
@NonNull
public CGBoolean getBoolean(boolean aBoolean)
getElementId
@NonNull
public CGElementId getElementId(@NonNull
ElementId elementId)
getExecutorOperation
@NonNull
public CGExecutorOperation getExecutorOperation(@NonNull
Operation pivotOperation)
getExecutorOperation
@NonNull
public CGExecutorOperation getExecutorOperation(@NonNull
OperationId operationId)
getExecutorConstructorPart
@NonNull
public CGExecutorConstructorPart getExecutorConstructorPart(@NonNull
Property pivotProperty)
getExecutorConstructorPart
@NonNull
public CGExecutorConstructorPart getExecutorConstructorPart(@NonNull
PropertyId propertyId)
getExecutorProperty
@NonNull
public CGExecutorProperty getExecutorProperty(@NonNull
Property pivotProperty)
getExecutorProperty
@NonNull
public CGExecutorProperty getExecutorProperty(@NonNull
PropertyId propertyId)
getExpression
@NonNull
public CGValuedElement getExpression(@Nullable
CGValuedElement cgExpression)
getInfinity
@NonNull
public CGInfinity getInfinity()
getInteger
@NonNull
public CGInteger getInteger(@NonNull
java.lang.Number aNumber)
getInvalid
@NonNull
public CGInvalid getInvalid()
getInvalid
@NonNull
public CGInvalid getInvalid(java.lang.String messageTemplate,
java.lang.Object... bindings)
getNull
@NonNull
public CGNull getNull()
getReal
@NonNull
public CGReal getReal(@NonNull
java.lang.Number aNumber)
getString
@NonNull
public CGString getString(@NonNull
java.lang.String aString)
getNameManager
@NonNull
public NameManager getNameManager()
getTypeId
@NonNull
public CGTypeId getTypeId(@NonNull
TypeId typeId)
setConstant
public void setConstant(@NonNull
CGValuedElement oldElement,
@Nullable
CGValuedElement aConstant)
setExplicitNames
public void setExplicitNames(@NonNull
CGValuedElement cgValue,
@Nullable
java.lang.Object anObject)
setNames
public void setNames(@NonNull
CGValuedElement cgValue,
@NonNull
java.lang.Object anObject)