org.eclipse.mtl.parser.ast
Class ASTFactory

java.lang.Object
  extended by org.eclipse.mtl.parser.ast.ASTFactory

public class ASTFactory
extends java.lang.Object

The class used to create and store the objects of the AST model. You have to call 'initOCL' to initialize the OCL environment.


Field Summary
protected  OCLParser pOCL
          To parse an OCL Expression with the OCL plug-in.
 
Constructor Summary
ASTFactory()
          Constructor.
 
Method Summary
 OCLParser getOCL()
          Gets the OCL parser (from the OCL plug-in).
protected  Block getOrCreateBlock(Block iBlock)
          Gets or creates an AST Block corresponding to a CST Block.
protected  FileBlock getOrCreateFileBlock(FileBlock iFileBlock)
          Gets or creates an AST FileBlock corresponding to a CST FileBlock.
protected  ForBlock getOrCreateForBlock(ForBlock iForBlock)
          Gets or creates an AST ForBlock corresponding to a CST ForBlock.
protected  IfBlock getOrCreateIfBlock(IfBlock iIfBlock)
          Gets or creates an AST IfBlock corresponding to a CST IfBlock.
protected  InitSection getOrCreateInitSection(InitSection iInitSection)
          Gets or creates an AST InitSection corresponding to a CST InitSection.
protected  LetBlock getOrCreateLetBlock(LetBlock iLetBlock)
          Gets or creates an AST LetBlock corresponding to a CST LetBlock.
protected  Macro getOrCreateMacro(Macro iMacro)
          Gets or creates an AST Macro corresponding to a CST Macro.
protected  Module getOrCreateModule(Module iModule)
          Gets or creates an AST Module corresponding to a CST Module.
protected  org.eclipse.ocl.ecore.OCLExpression getOrCreateOCLExpression(ModelExpression iModelExpression)
          Gets or creates an AST OCLExpression corresponding to a CST OCLExpression.
protected  ProtectedAreaBlock getOrCreateProtectedAreaBlock(ProtectedAreaBlock iProtectedAreaBlock)
          Gets or creates an AST ProtectedAreaBlock corresponding to a CST ProtectedAreaBlock.
protected  Query getOrCreateQuery(Query iQuery)
          Gets or creates an AST Query corresponding to a CST Query.
protected  org.eclipse.ocl.ecore.StringLiteralExp getOrCreateStringLiteralExp(TextExpression iTextExpression)
          Gets or creates an AST StringLiteralExp corresponding to a CST TextExpression.
protected  Template getOrCreateTemplate(Template iTemplate)
          Gets or creates an AST Template corresponding to a CST Template.
protected  TemplateExpression getOrCreateTemporaryTemplateExpression(TemplateExpression iTemplateExpression)
          Gets or creates an AST TemplateExpression corresponding to a CST TemplateExpression.
protected  TraceBlock getOrCreateTraceBlock(TraceBlock iTraceBlock)
          Gets or creates an AST TraceBlock corresponding to a CST TraceBlock.
protected  TypedModel getOrCreateTypedModel(TypedModel iTypedModel)
          Gets or creates an AST TypedModel corresponding to a CST TypedModel.
protected  org.eclipse.ocl.ecore.Variable getOrCreateVariable(Variable iVariable)
          Gets or creates an AST Variable corresponding to a CST Variable.
protected  TemplateExpression getTemporaryTemplateExpression(TemplateExpression iTemplateExpression)
          Gets (but not create) an AST TemplateExpression corresponding to a CST TemplateExpression.
 void initOCL(org.eclipse.emf.ecore.resource.Resource resourceOCL)
          Initializes the OCL environment.
protected  void log(java.lang.String message, int posBegin, int posEnd)
          To log a new problem.
 void setLogHandler(IASTLogHandler logHandler)
          Sets the log Handler to save AST logging messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pOCL

protected OCLParser pOCL
To parse an OCL Expression with the OCL plug-in.

Constructor Detail

ASTFactory

public ASTFactory()
Constructor.

Method Detail

initOCL

public void initOCL(org.eclipse.emf.ecore.resource.Resource resourceOCL)
Initializes the OCL environment.

Parameters:
resourceOCL - is the resource used to keep the OCL environment

getOCL

public OCLParser getOCL()
Gets the OCL parser (from the OCL plug-in).

Returns:
the OCL parser

setLogHandler

public void setLogHandler(IASTLogHandler logHandler)
Sets the log Handler to save AST logging messages.

Parameters:
logHandler - is the new log handler

getOrCreateModule

protected Module getOrCreateModule(Module iModule)
Gets or creates an AST Module corresponding to a CST Module.

Parameters:
iModule - is the input object of type 'org.eclipse.mtl.cst.Module'
Returns:
the output object of type 'org.eclipse.mtl.Module'

getOrCreateTypedModel

protected TypedModel getOrCreateTypedModel(TypedModel iTypedModel)
Gets or creates an AST TypedModel corresponding to a CST TypedModel.

Parameters:
iTypedModel - is the input object of type 'org.eclipse.mtl.cst.TypedModel'
Returns:
the output object of type 'org.eclipse.mtl.TypedModel'

getOrCreateTemplate

protected Template getOrCreateTemplate(Template iTemplate)
Gets or creates an AST Template corresponding to a CST Template.

Parameters:
iTemplate - is the input object of type 'org.eclipse.mtl.cst.Template'
Returns:
the output object of type 'org.eclipse.mtl.Template'

getOrCreateVariable

protected org.eclipse.ocl.ecore.Variable getOrCreateVariable(Variable iVariable)
Gets or creates an AST Variable corresponding to a CST Variable.

Parameters:
iVariable - is the input object of type 'org.eclipse.mtl.cst.Variable'
Returns:
the output object of type 'org.eclipse.ocl.ecore.Variable'

getOrCreateTemporaryTemplateExpression

protected TemplateExpression getOrCreateTemporaryTemplateExpression(TemplateExpression iTemplateExpression)
Gets or creates an AST TemplateExpression corresponding to a CST TemplateExpression. The output object is a temporary object. It will be replaced by an OCL expression in the OCL step. It's a strategy to keep the good index in a list like 'Block.body'.

Parameters:
iTemplateExpression - is the input object of type 'org.eclipse.mtl.cst.TemplateExpression'
Returns:
the output object of type 'org.eclipse.mtl.TemplateExpression'

getTemporaryTemplateExpression

protected TemplateExpression getTemporaryTemplateExpression(TemplateExpression iTemplateExpression)
Gets (but not create) an AST TemplateExpression corresponding to a CST TemplateExpression. The output object is a temporary object. It will be replaced by an OCL expression in the OCL step. It's a strategy to keep the good index in a list like 'Block.body'.

Parameters:
iTemplateExpression - is the input object of type 'org.eclipse.mtl.cst.TemplateExpression'
Returns:
the output object of type 'org.eclipse.mtl.TemplateExpression'

getOrCreateOCLExpression

protected org.eclipse.ocl.ecore.OCLExpression getOrCreateOCLExpression(ModelExpression iModelExpression)
Gets or creates an AST OCLExpression corresponding to a CST OCLExpression.

Parameters:
iModelExpression - is the input object of type 'org.eclipse.mtl.cst.ModelExpression'
Returns:
the output object of type 'org.eclipse.ocl.ecore.OCLExpression'

getOrCreateStringLiteralExp

protected org.eclipse.ocl.ecore.StringLiteralExp getOrCreateStringLiteralExp(TextExpression iTextExpression)
Gets or creates an AST StringLiteralExp corresponding to a CST TextExpression.

Parameters:
iTextExpression - is the input object of type 'org.eclipse.mtl.cst.TextExpression'
Returns:
the output object of type 'org.eclipse.ocl.ecore.StringLiteralExp'

getOrCreateBlock

protected Block getOrCreateBlock(Block iBlock)
Gets or creates an AST Block corresponding to a CST Block.

Parameters:
iBlock - is the input object of type 'org.eclipse.mtl.cst.Block'
Returns:
the output object of type 'org.eclipse.mtl.Block'

getOrCreateInitSection

protected InitSection getOrCreateInitSection(InitSection iInitSection)
Gets or creates an AST InitSection corresponding to a CST InitSection.

Parameters:
iInitSection - is the input object of type 'org.eclipse.mtl.cst.InitSection'
Returns:
the output object of type 'org.eclipse.mtl.InitSection'

getOrCreateProtectedAreaBlock

protected ProtectedAreaBlock getOrCreateProtectedAreaBlock(ProtectedAreaBlock iProtectedAreaBlock)
Gets or creates an AST ProtectedAreaBlock corresponding to a CST ProtectedAreaBlock.

Parameters:
iProtectedAreaBlock - is the input object of type 'org.eclipse.mtl.cst.ProtectedAreaBlock'
Returns:
the output object of type 'org.eclipse.mtl.ProtectedAreaBlock'

getOrCreateForBlock

protected ForBlock getOrCreateForBlock(ForBlock iForBlock)
Gets or creates an AST ForBlock corresponding to a CST ForBlock.

Parameters:
iForBlock - is the input object of type 'org.eclipse.mtl.cst.ForBlock'
Returns:
the output object of type 'org.eclipse.mtl.ForBlock'

getOrCreateIfBlock

protected IfBlock getOrCreateIfBlock(IfBlock iIfBlock)
Gets or creates an AST IfBlock corresponding to a CST IfBlock.

Parameters:
iIfBlock - is the input object of type 'org.eclipse.mtl.cst.IfBlock'
Returns:
the output object of type 'org.eclipse.mtl.IfBlock'

getOrCreateLetBlock

protected LetBlock getOrCreateLetBlock(LetBlock iLetBlock)
Gets or creates an AST LetBlock corresponding to a CST LetBlock.

Parameters:
iLetBlock - is the input object of type 'org.eclipse.mtl.cst.LetBlock'
Returns:
the output object of type 'org.eclipse.mtl.LetBlock'

getOrCreateFileBlock

protected FileBlock getOrCreateFileBlock(FileBlock iFileBlock)
Gets or creates an AST FileBlock corresponding to a CST FileBlock.

Parameters:
iFileBlock - is the input object of type 'org.eclipse.mtl.cst.FileBlock'
Returns:
the output object of type 'org.eclipse.mtl.FileBlock'

getOrCreateTraceBlock

protected TraceBlock getOrCreateTraceBlock(TraceBlock iTraceBlock)
Gets or creates an AST TraceBlock corresponding to a CST TraceBlock.

Parameters:
iTraceBlock - is the input object of type 'org.eclipse.mtl.cst.TraceBlock'
Returns:
the output object of type 'org.eclipse.mtl.TraceBlock'

getOrCreateMacro

protected Macro getOrCreateMacro(Macro iMacro)
Gets or creates an AST Macro corresponding to a CST Macro.

Parameters:
iMacro - is the input object of type 'org.eclipse.mtl.cst.Macro'
Returns:
the output object of type 'org.eclipse.mtl.Macro'

getOrCreateQuery

protected Query getOrCreateQuery(Query iQuery)
Gets or creates an AST Query corresponding to a CST Query.

Parameters:
iQuery - is the input object of type 'org.eclipse.mtl.cst.Query'
Returns:
the output object of type 'org.eclipse.mtl.Query'

log

protected void log(java.lang.String message,
                   int posBegin,
                   int posEnd)
To log a new problem.

Parameters:
message - is the message
posBegin - is the beginning index of the problem
posEnd - is the ending index of the problem

Copyright 2008 Obeo
All Rights Reserved.