org.eclipse.ocl.examples.codegen.java
Class CG2JavaPreVisitor

java.lang.Object
  extended by org.eclipse.ocl.examples.codegen.cgmodel.util.AbstractCGModelVisitor<R,C>
      extended by org.eclipse.ocl.examples.codegen.cgmodel.util.AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>
          extended by org.eclipse.ocl.examples.codegen.java.CG2JavaPreVisitor
All Implemented Interfaces:
CGModelVisitor<java.lang.Object>
Direct Known Subclasses:
AutoCG2JavaPreVisitor

public class CG2JavaPreVisitor
extends AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

A CG2JavaPreVisitor prepares for Java code generation by performing a tree traversal to gather all imports and global constants.


Field Summary
protected  CodeGenAnalyzer analyzer
           
protected  JavaCodeGenerator codeGenerator
           
protected  GenModelHelper genModelHelper
           
protected  JavaLocalContext localContext
           
 
Fields inherited from class org.eclipse.ocl.examples.codegen.cgmodel.util.AbstractCGModelVisitor
context
 
Constructor Summary
CG2JavaPreVisitor(JavaGlobalContext javaContext)
           
 
Method Summary
protected  void addOwnedTypeId(CGValuedElement cgElement, ElementId typeId)
           
protected  void doTypedElement(CGTypedElement cgTypedElement)
           
protected  void doValuedElement(CGValuedElement cgValuedElement)
           
 JavaCodeGenerator getCodeGenerator()
           
protected  CGValuedElement installEvaluatorVariable(CGValuedElement cgValuedElement)
           
protected  CGValuedElement installIdResolverVariable(CGValuedElement cgValuedElement)
           
protected  CGText installStandardLibraryVariable(CGValuedElement cgValuedElement)
           
 java.lang.Object visitCGBoxExp(CGBoxExp cgBoxExp)
           
 java.lang.Object visitCGBuiltInIterationCallExp(CGBuiltInIterationCallExp cgBuiltInIterationCallExp)
           
 java.lang.Object visitCGCollectionExp(CGCollectionExp cgCollectionExp)
           
 java.lang.Object visitCGCollectionPart(CGCollectionPart cgCollectionPart)
           
 java.lang.Object visitCGConstantExp(CGConstantExp cgConstantExp)
           
 java.lang.Object visitCGConstraint(CGConstraint cgConstraint)
           
 java.lang.Object visitCGConstructorExp(CGConstructorExp cgConstructorExp)
           
 java.lang.Object visitCGConstructorPart(CGConstructorPart cgConstructorPart)
           
 java.lang.Object visitCGElement(CGElement cgElement)
           
 java.lang.Object visitCGExecutorCompositionProperty(CGExecutorCompositionProperty cgExecutorProperty)
           
 java.lang.Object visitCGExecutorNavigationProperty(CGExecutorNavigationProperty cgExecutorProperty)
           
 java.lang.Object visitCGExecutorOperation(CGExecutorOperation cgExecutorOperation)
           
 java.lang.Object visitCGExecutorOperationCallExp(CGExecutorOperationCallExp cgExecutorOperationCallExp)
           
 java.lang.Object visitCGExecutorOppositeProperty(CGExecutorOppositeProperty cgExecutorProperty)
           
 java.lang.Object visitCGExecutorOppositePropertyCallExp(CGExecutorOppositePropertyCallExp cgExecutorPropertyCallExp)
           
 java.lang.Object visitCGExecutorProperty(CGExecutorProperty cgExecutorProperty)
           
 java.lang.Object visitCGExecutorPropertyCallExp(CGExecutorPropertyCallExp cgExecutorPropertyCallExp)
           
 java.lang.Object visitCGExecutorType(CGExecutorType cgExecutorType)
           
 java.lang.Object visitCGIterationCallExp(CGIterationCallExp cgIterationCallExp)
           
 java.lang.Object visitCGLetExp(CGLetExp cgLetExp)
           
 java.lang.Object visitCGLibraryIterateCallExp(CGLibraryIterateCallExp cgLibraryIterateCallExp)
           
 java.lang.Object visitCGLibraryIterationCallExp(CGLibraryIterationCallExp cgLibraryIterationCallExp)
           
 java.lang.Object visitCGLibraryOperationCallExp(CGLibraryOperationCallExp cgOperationCallExp)
           
 java.lang.Object visitCGLibraryPropertyCallExp(CGLibraryPropertyCallExp cgPropertyCallExp)
           
 java.lang.Object visitCGOperation(CGOperation cgOperation)
           
 java.lang.Object visitCGProperty(CGProperty cgProperty)
           
 java.lang.Object visitCGTypedElement(CGTypedElement cgTypedElement)
           
 java.lang.Object visitCGTypeExp(CGTypeExp cgTypeExp)
           
 java.lang.Object visitCGUnboxExp(CGUnboxExp cgUnboxExp)
           
 java.lang.Object visitCGValuedElement(CGValuedElement cgValuedElement)
           
 java.lang.Object visiting(CGElement visitable)
          Return the result of visiting a visitable for which no more specific pivot type method is available.
 
Methods inherited from class org.eclipse.ocl.examples.codegen.cgmodel.util.AbstractExtendingCGModelVisitor
visitCGAccumulator, visitCGAssertNonNullExp, visitCGBoolean, visitCGCallable, visitCGCallExp, visitCGCastExp, visitCGCatchExp, visitCGClass, visitCGConstant, visitCGEcoreClassConstructorExp, visitCGEcoreDataTypeConstructorExp, visitCGEcoreOperation, visitCGEcoreOperationCallExp, visitCGEcoreOppositePropertyCallExp, visitCGEcorePropertyCallExp, visitCGElementId, visitCGExecutorConstructorPart, visitCGFinalVariable, visitCGGuardExp, visitCGIfExp, visitCGInteger, visitCGInvalid, visitCGIsEqualExp, visitCGIsInvalidExp, visitCGIsUndefinedExp, visitCGIterator, visitCGLibraryOperation, visitCGLocalVariable, visitCGModel, visitCGNamedElement, visitCGNavigationCallExp, visitCGNull, visitCGNumber, visitCGOperationCallExp, visitCGOppositePropertyCallExp, visitCGPackage, visitCGParameter, visitCGPropertyCallExp, visitCGReal, visitCGSettableVariable, visitCGString, visitCGText, visitCGTextParameter, visitCGThrowExp, visitCGTupleExp, visitCGTuplePart, visitCGTuplePartCallExp, visitCGTypeId, visitCGUnlimited, visitCGVariable, visitCGVariableExp
 
Methods inherited from class org.eclipse.ocl.examples.codegen.cgmodel.util.AbstractCGModelVisitor
getAdapter, safeVisit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ocl.examples.codegen.cgmodel.util.CGModelVisitor
getAdapter
 

Field Detail

codeGenerator

@NonNull
protected final JavaCodeGenerator codeGenerator

genModelHelper

@NonNull
protected final GenModelHelper genModelHelper

analyzer

@NonNull
protected final CodeGenAnalyzer analyzer

localContext

protected JavaLocalContext localContext
Constructor Detail

CG2JavaPreVisitor

public CG2JavaPreVisitor(@NonNull
                         JavaGlobalContext javaContext)
Method Detail

addOwnedTypeId

protected void addOwnedTypeId(@NonNull
                              CGValuedElement cgElement,
                              @NonNull
                              ElementId typeId)

doTypedElement

protected void doTypedElement(@NonNull
                              CGTypedElement cgTypedElement)

doValuedElement

protected void doValuedElement(@NonNull
                               CGValuedElement cgValuedElement)

getCodeGenerator

@NonNull
public JavaCodeGenerator getCodeGenerator()

installEvaluatorVariable

@Nullable
protected CGValuedElement installEvaluatorVariable(@NonNull
                                                            CGValuedElement cgValuedElement)

installIdResolverVariable

@Nullable
protected CGValuedElement installIdResolverVariable(@NonNull
                                                             CGValuedElement cgValuedElement)

installStandardLibraryVariable

@NonNull
protected CGText installStandardLibraryVariable(@NonNull
                                                        CGValuedElement cgValuedElement)

visiting

@Nullable
public java.lang.Object visiting(@NonNull
                                          CGElement visitable)
Description copied from interface: CGModelVisitor
Return the result of visiting a visitable for which no more specific pivot type method is available.


visitCGBoxExp

@Nullable
public java.lang.Object visitCGBoxExp(@NonNull
                                               CGBoxExp cgBoxExp)
Specified by:
visitCGBoxExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGBoxExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGBuiltInIterationCallExp

@Nullable
public java.lang.Object visitCGBuiltInIterationCallExp(@NonNull
                                                                CGBuiltInIterationCallExp cgBuiltInIterationCallExp)
Specified by:
visitCGBuiltInIterationCallExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGBuiltInIterationCallExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGCollectionExp

@Nullable
public java.lang.Object visitCGCollectionExp(@NonNull
                                                      CGCollectionExp cgCollectionExp)
Specified by:
visitCGCollectionExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGCollectionExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGCollectionPart

@Nullable
public java.lang.Object visitCGCollectionPart(@NonNull
                                                       CGCollectionPart cgCollectionPart)
Specified by:
visitCGCollectionPart in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGCollectionPart in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGConstantExp

@Nullable
public java.lang.Object visitCGConstantExp(@NonNull
                                                    CGConstantExp cgConstantExp)
Specified by:
visitCGConstantExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGConstantExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGConstraint

@Nullable
public java.lang.Object visitCGConstraint(@NonNull
                                                   CGConstraint cgConstraint)
Specified by:
visitCGConstraint in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGConstraint in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGConstructorExp

@Nullable
public java.lang.Object visitCGConstructorExp(@NonNull
                                                       CGConstructorExp cgConstructorExp)
Specified by:
visitCGConstructorExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGConstructorExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGConstructorPart

@Nullable
public java.lang.Object visitCGConstructorPart(@NonNull
                                                        CGConstructorPart cgConstructorPart)
Specified by:
visitCGConstructorPart in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGConstructorPart in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGElement

@Nullable
public java.lang.Object visitCGElement(@NonNull
                                                CGElement cgElement)
Specified by:
visitCGElement in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGElement in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGExecutorCompositionProperty

@Nullable
public java.lang.Object visitCGExecutorCompositionProperty(@NonNull
                                                                    CGExecutorCompositionProperty cgExecutorProperty)
Specified by:
visitCGExecutorCompositionProperty in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGExecutorCompositionProperty in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGExecutorNavigationProperty

@Nullable
public java.lang.Object visitCGExecutorNavigationProperty(@NonNull
                                                                   CGExecutorNavigationProperty cgExecutorProperty)
Specified by:
visitCGExecutorNavigationProperty in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGExecutorNavigationProperty in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGExecutorOperation

@Nullable
public java.lang.Object visitCGExecutorOperation(@NonNull
                                                          CGExecutorOperation cgExecutorOperation)
Specified by:
visitCGExecutorOperation in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGExecutorOperation in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGExecutorOperationCallExp

@Nullable
public java.lang.Object visitCGExecutorOperationCallExp(@NonNull
                                                                 CGExecutorOperationCallExp cgExecutorOperationCallExp)
Specified by:
visitCGExecutorOperationCallExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGExecutorOperationCallExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGExecutorOppositeProperty

@Nullable
public java.lang.Object visitCGExecutorOppositeProperty(@NonNull
                                                                 CGExecutorOppositeProperty cgExecutorProperty)
Specified by:
visitCGExecutorOppositeProperty in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGExecutorOppositeProperty in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGExecutorOppositePropertyCallExp

@Nullable
public java.lang.Object visitCGExecutorOppositePropertyCallExp(@NonNull
                                                                        CGExecutorOppositePropertyCallExp cgExecutorPropertyCallExp)
Specified by:
visitCGExecutorOppositePropertyCallExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGExecutorOppositePropertyCallExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGExecutorProperty

@Nullable
public java.lang.Object visitCGExecutorProperty(@NonNull
                                                         CGExecutorProperty cgExecutorProperty)
Specified by:
visitCGExecutorProperty in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGExecutorProperty in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGExecutorPropertyCallExp

@Nullable
public java.lang.Object visitCGExecutorPropertyCallExp(@NonNull
                                                                CGExecutorPropertyCallExp cgExecutorPropertyCallExp)
Specified by:
visitCGExecutorPropertyCallExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGExecutorPropertyCallExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGExecutorType

@Nullable
public java.lang.Object visitCGExecutorType(@NonNull
                                                     CGExecutorType cgExecutorType)
Specified by:
visitCGExecutorType in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGExecutorType in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGIterationCallExp

@Nullable
public java.lang.Object visitCGIterationCallExp(@NonNull
                                                         CGIterationCallExp cgIterationCallExp)
Specified by:
visitCGIterationCallExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGIterationCallExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGLetExp

@Nullable
public java.lang.Object visitCGLetExp(@NonNull
                                               CGLetExp cgLetExp)
Specified by:
visitCGLetExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGLetExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGLibraryIterateCallExp

@Nullable
public java.lang.Object visitCGLibraryIterateCallExp(@NonNull
                                                              CGLibraryIterateCallExp cgLibraryIterateCallExp)
Specified by:
visitCGLibraryIterateCallExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGLibraryIterateCallExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGLibraryIterationCallExp

@Nullable
public java.lang.Object visitCGLibraryIterationCallExp(@NonNull
                                                                CGLibraryIterationCallExp cgLibraryIterationCallExp)
Specified by:
visitCGLibraryIterationCallExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGLibraryIterationCallExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGLibraryOperationCallExp

@Nullable
public java.lang.Object visitCGLibraryOperationCallExp(@NonNull
                                                                CGLibraryOperationCallExp cgOperationCallExp)
Specified by:
visitCGLibraryOperationCallExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGLibraryOperationCallExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGLibraryPropertyCallExp

@Nullable
public java.lang.Object visitCGLibraryPropertyCallExp(@NonNull
                                                               CGLibraryPropertyCallExp cgPropertyCallExp)
Specified by:
visitCGLibraryPropertyCallExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGLibraryPropertyCallExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGOperation

@Nullable
public java.lang.Object visitCGOperation(@NonNull
                                                  CGOperation cgOperation)
Specified by:
visitCGOperation in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGOperation in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGProperty

@Nullable
public java.lang.Object visitCGProperty(@NonNull
                                                 CGProperty cgProperty)
Specified by:
visitCGProperty in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGProperty in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGTypeExp

@Nullable
public java.lang.Object visitCGTypeExp(@NonNull
                                                CGTypeExp cgTypeExp)
Specified by:
visitCGTypeExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGTypeExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGTypedElement

@Nullable
public java.lang.Object visitCGTypedElement(@NonNull
                                                     CGTypedElement cgTypedElement)
Specified by:
visitCGTypedElement in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGTypedElement in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGUnboxExp

@Nullable
public java.lang.Object visitCGUnboxExp(@NonNull
                                                 CGUnboxExp cgUnboxExp)
Specified by:
visitCGUnboxExp in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGUnboxExp in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>

visitCGValuedElement

@Nullable
public java.lang.Object visitCGValuedElement(@NonNull
                                                      CGValuedElement cgValuedElement)
Specified by:
visitCGValuedElement in interface CGModelVisitor<java.lang.Object>
Overrides:
visitCGValuedElement in class AbstractExtendingCGModelVisitor<java.lang.Object,JavaGlobalContext>