org.eclipse.ocl.examples.codegen.analyzer
Class AS2CGVisitor

java.lang.Object
  extended by org.eclipse.ocl.examples.pivot.util.AbstractVisitor<R,C>
      extended by org.eclipse.ocl.examples.pivot.util.AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>
          extended by org.eclipse.ocl.examples.codegen.analyzer.AS2CGVisitor
All Implemented Interfaces:
Visitor<CGNamedElement>
Direct Known Subclasses:
AutoAS2CGVisitor, OCLinEcoreAS2CGVisitor

public class AS2CGVisitor
extends AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

The AS2CGVisitor performs the first stage of code generation by converting the Pivot AST to the CG AST.


Nested Class Summary
protected static class AS2CGVisitor.Variables
           
 
Field Summary
protected  CodeGenerator codeGenerator
           
protected  GenModelHelper genModelHelper
           
protected  MetaModelManager metaModelManager
           
 
Fields inherited from class org.eclipse.ocl.examples.pivot.util.AbstractVisitor
context
 
Constructor Summary
AS2CGVisitor(CodeGenAnalyzer analyzer)
           
 
Method Summary
protected  void addParameter(Variable aParameter, CGParameter cgParameter)
           
 CGVariable basicGetParameter(Variable aParameter)
           
 CGVariable createCGVariable(Variable asVariable)
           
protected  CGVariable createCGVariable(Variable contextVariable, OCLExpression source)
           
<T extends CGElement>
T
doVisit(java.lang.Class<T> requiredClass, Element pElement)
           
 CodeGenAnalyzer getAnalyzer()
           
 CGIterator getIterator(VariableDeclaration asVariable)
           
 CGVariable getLocalVariable(VariableDeclaration asVariable)
           
 CGParameter getParameter(Variable aParameter)
           
 CGParameter getSelfParameter(Variable aParameter)
           
 CGVariable getVariable(VariableDeclaration asVariable)
           
 AS2CGVisitor.Variables getVariablesStack()
           
protected  CGValuedElement inlineOperationCall(OperationCallExp callExp, OpaqueExpression bodyExpression)
           
protected  boolean isEcoreProperty(LibraryProperty libraryProperty)
           
protected  void setAst(CGNamedElement cgElement, NamedElement asElement)
           
protected  void setAst(CGTypedElement cgElement, TypedElement asElement)
           
 CGConstantExp visitBooleanLiteralExp(BooleanLiteralExp element)
           
 CGClass visitClass(Class element)
           
 CGCollectionPart visitCollectionItem(CollectionItem element)
           
 CGCollectionExp visitCollectionLiteralExp(CollectionLiteralExp element)
           
 CGCollectionPart visitCollectionRange(CollectionRange element)
           
 CGConstraint visitConstraint(Constraint element)
           
 CGConstructorExp visitConstructorExp(ConstructorExp element)
           
 CGConstructorPart visitConstructorPart(ConstructorPart element)
           
 CGConstantExp visitEnumLiteralExp(EnumLiteralExp element)
           
 CGValuedElement visitExpressionInOCL(ExpressionInOCL element)
           
 CGIfExp visitIfExp(IfExp element)
           
 CGValuedElement visiting(Visitable visitable)
          Return the result of visiting a visitable for which no more specific pivot type method is available.
 CGConstantExp visitIntegerLiteralExp(IntegerLiteralExp element)
           
 CGConstantExp visitInvalidLiteralExp(InvalidLiteralExp element)
           
 CGIterationCallExp visitIterateExp(IterateExp element)
           
 CGIterationCallExp visitIteratorExp(IteratorExp element)
           
 CGLetExp visitLetExp(LetExp element)
           
 CGConstantExp visitNullLiteralExp(NullLiteralExp element)
           
 CGOperation visitOperation(Operation element)
           
 CGValuedElement visitOperationCallExp(OperationCallExp element)
           
 CGValuedElement visitOppositePropertyCallExp(OppositePropertyCallExp element)
           
 CGPackage visitPackage(Package element)
           
 CGProperty visitProperty(Property element)
           
 CGValuedElement visitPropertyCallExp(PropertyCallExp element)
           
 CGConstantExp visitRealLiteralExp(RealLiteralExp element)
           
 CGNamedElement visitStateExp(StateExp element)
           
 CGConstantExp visitStringLiteralExp(StringLiteralExp element)
           
 CGTupleExp visitTupleLiteralExp(TupleLiteralExp element)
           
 CGTuplePart visitTupleLiteralPart(TupleLiteralPart element)
           
 CGTypeExp visitTypeExp(TypeExp pTypeExp)
           
 CGConstantExp visitUnlimitedNaturalLiteralExp(UnlimitedNaturalLiteralExp element)
           
 CGNamedElement visitUnspecifiedValueExp(UnspecifiedValueExp element)
           
 CGValuedElement visitVariableExp(VariableExp asVariableExp)
           
 
Methods inherited from class org.eclipse.ocl.examples.pivot.util.AbstractExtendingVisitor
visitAnnotation, visitAnyType, visitAssociationClass, visitAssociationClassCallExp, visitBagType, visitBehavior, visitCallExp, visitCallOperationAction, visitCollectionLiteralPart, visitCollectionType, visitComment, visitConnectionPointReference, visitDataType, visitDetail, visitDynamicElement, visitDynamicProperty, visitDynamicType, visitElement, visitElementExtension, visitEnumeration, visitEnumerationLiteral, visitFeature, visitFeatureCallExp, visitFinalState, visitImport, visitInvalidType, visitIteration, visitLambdaType, visitLibrary, visitLiteralExp, visitLoopExp, visitMessageExp, visitMessageType, visitMetaclass, visitNamedElement, visitNamespace, visitNavigationCallExp, visitNumericLiteralExp, visitOCLExpression, visitOpaqueExpression, visitOperationTemplateParameter, visitOrderedSetType, visitPackageableElement, visitParameter, visitParameterableElement, visitPrecedence, visitPrimitiveLiteralExp, visitPrimitiveType, visitProfile, visitProfileApplication, visitPseudostate, visitRegion, visitRoot, visitSelfType, visitSendSignalAction, visitSequenceType, visitSetType, visitSignal, visitState, visitStateMachine, visitStereotype, visitTemplateableElement, visitTemplateBinding, visitTemplateParameter, visitTemplateParameterSubstitution, visitTemplateParameterType, visitTemplateSignature, visitTransition, visitTrigger, visitTupleType, visitType, visitTypedElement, visitTypedMultiplicityElement, visitTypeExtension, visitTypeTemplateParameter, visitUnspecifiedType, visitValueSpecification, visitVariable, visitVariableDeclaration, visitVertex, visitVoidType
 
Methods inherited from class org.eclipse.ocl.examples.pivot.util.AbstractVisitor
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.pivot.util.Visitor
getAdapter
 

Field Detail

codeGenerator

@NonNull
protected final CodeGenerator codeGenerator

metaModelManager

@NonNull
protected final MetaModelManager metaModelManager

genModelHelper

@NonNull
protected final GenModelHelper genModelHelper
Constructor Detail

AS2CGVisitor

public AS2CGVisitor(@NonNull
                    CodeGenAnalyzer analyzer)
Method Detail

addParameter

protected void addParameter(@NonNull
                            Variable aParameter,
                            @NonNull
                            CGParameter cgParameter)

basicGetParameter

@Nullable
public CGVariable basicGetParameter(@NonNull
                                             Variable aParameter)

createCGVariable

@NonNull
public CGVariable createCGVariable(@NonNull
                                           Variable asVariable)

createCGVariable

protected CGVariable createCGVariable(@NonNull
                                      Variable contextVariable,
                                      @NonNull
                                      OCLExpression source)

doVisit

@NonNull
public <T extends CGElement> T doVisit(@NonNull
                                               java.lang.Class<T> requiredClass,
                                               @Nullable
                                               Element pElement)

getAnalyzer

@NonNull
public CodeGenAnalyzer getAnalyzer()

getIterator

@NonNull
public CGIterator getIterator(@NonNull
                                      VariableDeclaration asVariable)

getLocalVariable

@NonNull
public CGVariable getLocalVariable(@NonNull
                                           VariableDeclaration asVariable)

getParameter

@NonNull
public CGParameter getParameter(@NonNull
                                        Variable aParameter)

getSelfParameter

@NonNull
public CGParameter getSelfParameter(@NonNull
                                            Variable aParameter)

getVariable

@NonNull
public CGVariable getVariable(@NonNull
                                      VariableDeclaration asVariable)

getVariablesStack

@NonNull
public AS2CGVisitor.Variables getVariablesStack()

inlineOperationCall

@Nullable
protected CGValuedElement inlineOperationCall(@NonNull
                                                       OperationCallExp callExp,
                                                       @NonNull
                                                       OpaqueExpression bodyExpression)

isEcoreProperty

protected boolean isEcoreProperty(@NonNull
                                  LibraryProperty libraryProperty)

setAst

protected void setAst(@NonNull
                      CGNamedElement cgElement,
                      @NonNull
                      NamedElement asElement)

setAst

protected void setAst(@NonNull
                      CGTypedElement cgElement,
                      @NonNull
                      TypedElement asElement)

visitBooleanLiteralExp

@Nullable
public CGConstantExp visitBooleanLiteralExp(@NonNull
                                                     BooleanLiteralExp element)
Specified by:
visitBooleanLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitBooleanLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitClass

@Nullable
public CGClass visitClass(@NonNull
                                   Class element)
Specified by:
visitClass in interface Visitor<CGNamedElement>
Overrides:
visitClass in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitCollectionItem

@Nullable
public CGCollectionPart visitCollectionItem(@NonNull
                                                     CollectionItem element)
Specified by:
visitCollectionItem in interface Visitor<CGNamedElement>
Overrides:
visitCollectionItem in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitCollectionLiteralExp

@Nullable
public CGCollectionExp visitCollectionLiteralExp(@NonNull
                                                          CollectionLiteralExp element)
Specified by:
visitCollectionLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitCollectionLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitCollectionRange

@Nullable
public CGCollectionPart visitCollectionRange(@NonNull
                                                      CollectionRange element)
Specified by:
visitCollectionRange in interface Visitor<CGNamedElement>
Overrides:
visitCollectionRange in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitConstraint

@Nullable
public CGConstraint visitConstraint(@NonNull
                                             Constraint element)
Specified by:
visitConstraint in interface Visitor<CGNamedElement>
Overrides:
visitConstraint in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitConstructorExp

@Nullable
public CGConstructorExp visitConstructorExp(@NonNull
                                                     ConstructorExp element)
Specified by:
visitConstructorExp in interface Visitor<CGNamedElement>
Overrides:
visitConstructorExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitConstructorPart

@Nullable
public CGConstructorPart visitConstructorPart(@NonNull
                                                       ConstructorPart element)
Specified by:
visitConstructorPart in interface Visitor<CGNamedElement>
Overrides:
visitConstructorPart in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitEnumLiteralExp

@Nullable
public CGConstantExp visitEnumLiteralExp(@NonNull
                                                  EnumLiteralExp element)
Specified by:
visitEnumLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitEnumLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitExpressionInOCL

@NonNull
public CGValuedElement visitExpressionInOCL(@NonNull
                                                    ExpressionInOCL element)
Specified by:
visitExpressionInOCL in interface Visitor<CGNamedElement>
Overrides:
visitExpressionInOCL in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitIfExp

@NonNull
public CGIfExp visitIfExp(@NonNull
                                  IfExp element)
Specified by:
visitIfExp in interface Visitor<CGNamedElement>
Overrides:
visitIfExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitIntegerLiteralExp

@Nullable
public CGConstantExp visitIntegerLiteralExp(@NonNull
                                                     IntegerLiteralExp element)
Specified by:
visitIntegerLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitIntegerLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitInvalidLiteralExp

@Nullable
public CGConstantExp visitInvalidLiteralExp(@NonNull
                                                     InvalidLiteralExp element)
Specified by:
visitInvalidLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitInvalidLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitIterateExp

@NonNull
public CGIterationCallExp visitIterateExp(@NonNull
                                                  IterateExp element)
Specified by:
visitIterateExp in interface Visitor<CGNamedElement>
Overrides:
visitIterateExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitIteratorExp

@NonNull
public CGIterationCallExp visitIteratorExp(@NonNull
                                                   IteratorExp element)
Specified by:
visitIteratorExp in interface Visitor<CGNamedElement>
Overrides:
visitIteratorExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitLetExp

@Nullable
public CGLetExp visitLetExp(@NonNull
                                     LetExp element)
Specified by:
visitLetExp in interface Visitor<CGNamedElement>
Overrides:
visitLetExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitNullLiteralExp

@Nullable
public CGConstantExp visitNullLiteralExp(@NonNull
                                                  NullLiteralExp element)
Specified by:
visitNullLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitNullLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitOperation

@Nullable
public CGOperation visitOperation(@NonNull
                                           Operation element)
Specified by:
visitOperation in interface Visitor<CGNamedElement>
Overrides:
visitOperation in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitOperationCallExp

@NonNull
public CGValuedElement visitOperationCallExp(@NonNull
                                                     OperationCallExp element)
Specified by:
visitOperationCallExp in interface Visitor<CGNamedElement>
Overrides:
visitOperationCallExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitOppositePropertyCallExp

@NonNull
public CGValuedElement visitOppositePropertyCallExp(@NonNull
                                                            OppositePropertyCallExp element)
Specified by:
visitOppositePropertyCallExp in interface Visitor<CGNamedElement>
Overrides:
visitOppositePropertyCallExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitPackage

@Nullable
public CGPackage visitPackage(@NonNull
                                       Package element)
Specified by:
visitPackage in interface Visitor<CGNamedElement>
Overrides:
visitPackage in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitProperty

@Nullable
public CGProperty visitProperty(@NonNull
                                         Property element)
Specified by:
visitProperty in interface Visitor<CGNamedElement>
Overrides:
visitProperty in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitPropertyCallExp

@NonNull
public CGValuedElement visitPropertyCallExp(@NonNull
                                                    PropertyCallExp element)
Specified by:
visitPropertyCallExp in interface Visitor<CGNamedElement>
Overrides:
visitPropertyCallExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitRealLiteralExp

@Nullable
public CGConstantExp visitRealLiteralExp(@NonNull
                                                  RealLiteralExp element)
Specified by:
visitRealLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitRealLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitStateExp

@Nullable
public CGNamedElement visitStateExp(@NonNull
                                             StateExp element)
Specified by:
visitStateExp in interface Visitor<CGNamedElement>
Overrides:
visitStateExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitStringLiteralExp

@Nullable
public CGConstantExp visitStringLiteralExp(@NonNull
                                                    StringLiteralExp element)
Specified by:
visitStringLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitStringLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitTupleLiteralExp

@Nullable
public CGTupleExp visitTupleLiteralExp(@NonNull
                                                TupleLiteralExp element)
Specified by:
visitTupleLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitTupleLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitTupleLiteralPart

@Nullable
public CGTuplePart visitTupleLiteralPart(@NonNull
                                                  TupleLiteralPart element)
Specified by:
visitTupleLiteralPart in interface Visitor<CGNamedElement>
Overrides:
visitTupleLiteralPart in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitTypeExp

@Nullable
public CGTypeExp visitTypeExp(@NonNull
                                       TypeExp pTypeExp)
Specified by:
visitTypeExp in interface Visitor<CGNamedElement>
Overrides:
visitTypeExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitUnlimitedNaturalLiteralExp

@Nullable
public CGConstantExp visitUnlimitedNaturalLiteralExp(@NonNull
                                                              UnlimitedNaturalLiteralExp element)
Specified by:
visitUnlimitedNaturalLiteralExp in interface Visitor<CGNamedElement>
Overrides:
visitUnlimitedNaturalLiteralExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitUnspecifiedValueExp

@Nullable
public CGNamedElement visitUnspecifiedValueExp(@NonNull
                                                        UnspecifiedValueExp element)
Specified by:
visitUnspecifiedValueExp in interface Visitor<CGNamedElement>
Overrides:
visitUnspecifiedValueExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visitVariableExp

@Nullable
public CGValuedElement visitVariableExp(@NonNull
                                                 VariableExp asVariableExp)
Specified by:
visitVariableExp in interface Visitor<CGNamedElement>
Overrides:
visitVariableExp in class AbstractExtendingVisitor<CGNamedElement,CodeGenAnalyzer>

visiting

@Nullable
public CGValuedElement visiting(@NonNull
                                         Visitable visitable)
Description copied from interface: Visitor
Return the result of visiting a visitable for which no more specific pivot type method is available.