org.eclipse.mofscript.parser
Class MofScriptModelChecker

java.lang.Object
  extended by org.eclipse.mofscript.parser.MofScriptModelChecker
Direct Known Subclasses:
MofScriptUMLModelChecker

public class MofScriptModelChecker
extends java.lang.Object

Semantic checker for MOFScript

Author:
Jon Oldevik

Field Summary
static int SOURCE_METAMODEL
           
static int TARGET_METAMODEL
           
 
Constructor Summary
MofScriptModelChecker()
          Default constructor
 
Method Summary
 void addImportedTransformation(java.lang.String importName, java.lang.String importUri, MOFScriptTransformation importedTr)
          Add imported transformations
 boolean addSourceMetaModel(MOFScriptParameter param)
           
 boolean addTargetMetaModel(MOFScriptParameter param)
           
 void checkExpression(Expression exp)
          Checks an expression
 void checkMetaModels()
          sets the source and target metamodels from transformation objects
 void checkParameter(MOFScriptParameter parameter)
          Checks a domain (a parameter) to the rule
 void checkReference(Reference ref)
          Checks the refrence
 void checkReferenceName(java.lang.String refName, MOFScriptObject checkObj)
          Checks the refrence name
 void checkStatement(MOFScriptStatement statement, boolean postCheck)
          Checks a statement within a rule
 void checkTransformationRule(TransformationRule rule, boolean postCheck)
          Checks a transformation rule for type usages, rule invocations etc
 void checkVariableDeclaration(VariableDeclaration varDecl)
          Checks properties of the transformation
 void clear()
          Clears all stored values
 java.lang.String findGlobalParameter(java.lang.String name)
          Returns the type name of the parameter if it exists
 VariableDeclaration findGlobalVariables(MOFScriptTransformation transformation, java.lang.String name)
          Finds global variables
 java.lang.Object findVariable(java.lang.String name)
          Find a variable either globally or locally
 int getErrorCount()
          Gets the error count
 MofScriptErrorManager getErrorManager()
          Gets the error manager
 java.util.Iterator getErrors()
          Gets the errors
 boolean getMetaModelsOK()
           
 MOFScriptTransformation getTransformationModel()
           
 TransformationProxy getTransformationProxy()
          returns the current transformation model
 MOFScriptSpecification getTransformationSpecification()
           
 boolean isSuperTransformation(MOFScriptTransformation transformation, MOFScriptTransformation possibleSuper)
           
 void postCheck()
          Semantic checks of the complete model
 void printErrors()
          Prints the errors to system.out
 void setTransformationModel(MOFScriptTransformation transformation)
           
 void setTransformationSpecification(MOFScriptSpecification trModel)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCE_METAMODEL

public static int SOURCE_METAMODEL

TARGET_METAMODEL

public static int TARGET_METAMODEL
Constructor Detail

MofScriptModelChecker

public MofScriptModelChecker()
Default constructor

Method Detail

getTransformationProxy

public TransformationProxy getTransformationProxy()
returns the current transformation model

Returns:

setTransformationSpecification

public void setTransformationSpecification(MOFScriptSpecification trModel)
Parameters:
trModel -

getTransformationSpecification

public MOFScriptSpecification getTransformationSpecification()
Returns:
the transformation specification

setTransformationModel

public void setTransformationModel(MOFScriptTransformation transformation)
Parameters:
transformation -

getTransformationModel

public MOFScriptTransformation getTransformationModel()

clear

public void clear()
Clears all stored values


getMetaModelsOK

public boolean getMetaModelsOK()
Returns:

checkMetaModels

public void checkMetaModels()
sets the source and target metamodels from transformation objects


addSourceMetaModel

public boolean addSourceMetaModel(MOFScriptParameter param)
Parameters:
param -
Returns:

addTargetMetaModel

public boolean addTargetMetaModel(MOFScriptParameter param)

checkVariableDeclaration

public void checkVariableDeclaration(VariableDeclaration varDecl)
Checks properties of the transformation


checkTransformationRule

public void checkTransformationRule(TransformationRule rule,
                                    boolean postCheck)
Checks a transformation rule for type usages, rule invocations etc


checkParameter

public void checkParameter(MOFScriptParameter parameter)
Checks a domain (a parameter) to the rule

Parameters:
domain -

checkStatement

public void checkStatement(MOFScriptStatement statement,
                           boolean postCheck)
Checks a statement within a rule

Parameters:
statement -

findGlobalParameter

public java.lang.String findGlobalParameter(java.lang.String name)
Returns the type name of the parameter if it exists

Parameters:
exp -

findGlobalVariables

public VariableDeclaration findGlobalVariables(MOFScriptTransformation transformation,
                                               java.lang.String name)
Finds global variables

Parameters:
name -
Returns:

findVariable

public java.lang.Object findVariable(java.lang.String name)
Find a variable either globally or locally

Parameters:
exp -

checkExpression

public void checkExpression(Expression exp)
Checks an expression

Parameters:
exp -

checkReference

public void checkReference(Reference ref)
Checks the refrence

Parameters:
ref -

checkReferenceName

public void checkReferenceName(java.lang.String refName,
                               MOFScriptObject checkObj)
Checks the refrence name

Parameters:
refName -
checkObj -

postCheck

public void postCheck()
               throws MofScriptModelException
Semantic checks of the complete model

Throws:
MofScriptModelException

isSuperTransformation

public boolean isSuperTransformation(MOFScriptTransformation transformation,
                                     MOFScriptTransformation possibleSuper)
Parameters:
transformation -
possibleSuper -
Returns:
true if a transformation is a supertype of another

addImportedTransformation

public void addImportedTransformation(java.lang.String importName,
                                      java.lang.String importUri,
                                      MOFScriptTransformation importedTr)
Add imported transformations

Parameters:
importName -
importUri -
importedTr -

printErrors

public void printErrors()
Prints the errors to system.out


getErrorManager

public MofScriptErrorManager getErrorManager()
Gets the error manager

Returns:

getErrorCount

public int getErrorCount()
Gets the error count

Returns:

getErrors

public java.util.Iterator getErrors()
Gets the errors

Returns: