org.sintef.mofscript.runtime.expression
Class FunctionCallEvaluator

java.lang.Object
  extended by org.sintef.mofscript.runtime.expression.ExpressionEvaluator
      extended by org.sintef.mofscript.runtime.expression.SimpleExpressionEvaluator
          extended by org.sintef.mofscript.runtime.expression.FunctionCallEvaluator
Direct Known Subclasses:
UMLFunctionCallEvaluator

public class FunctionCallEvaluator
extends SimpleExpressionEvaluator

Handles function calls

Author:
jol

Field Summary
protected  ExpressionEvaluator evaluator
           
protected  ValueExpression p1
           
protected  java.lang.Object p1Result
           
protected  ValueExpression p2
           
protected  java.lang.Object p2Result
           
protected  ValueExpression p3
           
protected  java.lang.Object p3Result
           
 
Fields inherited from class org.sintef.mofscript.runtime.expression.ExpressionEvaluator
_env, _expression, _ownerRuleExecutor, _positionCounter, _referenceStringLength
 
Constructor Summary
FunctionCallEvaluator(Expression expression, ExecutionEnvironment env, RuleExecutor ownerRuleExecutor)
          Constructor
 
Method Summary
protected  void evaluateParameterValues(java.util.List parameters)
          Evaluates parameter values
protected  java.lang.Object evaluateSimple(java.lang.Object inputObject)
          Evaluates simple
protected  java.lang.Object handleFunctionCall(FunctionCall f, java.lang.Object inputContext)
          Handles the function call
protected  java.lang.Object handleModelEscapeFunction(java.lang.Object variable, java.lang.String fName, FunctionCall f)
          Handles model escape functions
protected  java.lang.Object handleOclGeneralFunction(java.lang.Object variable, java.lang.String fName, FunctionCall f)
          Handles OCL general functions
protected  java.lang.Object handleSystemFunction(java.lang.String fName, FunctionCall f)
          Handles the system function
protected  java.lang.Object handleVariableFunctionCall(java.lang.Object variable, java.lang.String fName, FunctionCall f)
          Handles variable function calls
static java.lang.Boolean isKindOf(org.eclipse.emf.ecore.EObject toCheck, java.lang.Object clazz)
          Checks whether an EObject is kind of Object clazz
protected  boolean isSystemFunction(java.lang.String functionName)
          Checks if the function is a system function e.g. time or java
static java.lang.Boolean isTypeOf(org.eclipse.emf.ecore.EObject toCheck, java.lang.Object clazz)
          Checks whether an EObject is of type Object clazz
 
Methods inherited from class org.sintef.mofscript.runtime.expression.SimpleExpressionEvaluator
checkAdditionalExpressionParts, evaluate, handleAdditionalFunction, handleStringFunction
 
Methods inherited from class org.sintef.mofscript.runtime.expression.ExpressionEvaluator
evaluateExpression, resetPosisionCounter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

p1

protected ValueExpression p1

p2

protected ValueExpression p2

p3

protected ValueExpression p3

p1Result

protected java.lang.Object p1Result

p2Result

protected java.lang.Object p2Result

p3Result

protected java.lang.Object p3Result

evaluator

protected ExpressionEvaluator evaluator
Constructor Detail

FunctionCallEvaluator

public FunctionCallEvaluator(Expression expression,
                             ExecutionEnvironment env,
                             RuleExecutor ownerRuleExecutor)
Constructor

Parameters:
expression - The expression to be evaluated
env - The ExecutionEnvironment
ownerRuleExecutor - The rule executor that owns the expression
Method Detail

evaluateSimple

protected java.lang.Object evaluateSimple(java.lang.Object inputObject)
                                   throws MofScriptExecutionException
Evaluates simple

Specified by:
evaluateSimple in class SimpleExpressionEvaluator
Parameters:
inputObject -
Returns:
object
Throws:
MofScriptExecutionException

evaluateParameterValues

protected void evaluateParameterValues(java.util.List parameters)
                                throws MofScriptExecutionException
Evaluates parameter values

Parameters:
parameters -
Throws:
MofScriptExecutionException

handleFunctionCall

protected java.lang.Object handleFunctionCall(FunctionCall f,
                                              java.lang.Object inputContext)
Handles the function call

Parameters:
f -
inputContext -
Returns:
object result

handleVariableFunctionCall

protected java.lang.Object handleVariableFunctionCall(java.lang.Object variable,
                                                      java.lang.String fName,
                                                      FunctionCall f)
                                               throws MofScriptExecutionException
Handles variable function calls

Parameters:
variable -
fName -
f -
Returns:
Throws:
MofScriptExecutionException

handleOclGeneralFunction

protected java.lang.Object handleOclGeneralFunction(java.lang.Object variable,
                                                    java.lang.String fName,
                                                    FunctionCall f)
                                             throws MofScriptExecutionException
Handles OCL general functions

Parameters:
variable -
fName -
f -
Returns:
Throws:
MofScriptExecutionException

handleModelEscapeFunction

protected java.lang.Object handleModelEscapeFunction(java.lang.Object variable,
                                                     java.lang.String fName,
                                                     FunctionCall f)
                                              throws MofScriptExecutionException
Handles model escape functions

Parameters:
variable -
fName -
f -
Returns:
Throws:
MofScriptExecutionException

isSystemFunction

protected boolean isSystemFunction(java.lang.String functionName)
Checks if the function is a system function e.g. time or java

Parameters:
functionName -
Returns:

handleSystemFunction

protected java.lang.Object handleSystemFunction(java.lang.String fName,
                                                FunctionCall f)
                                         throws MofScriptExecutionException
Handles the system function

Parameters:
fName -
f -
Returns:
Throws:
MofScriptExecutionException

isTypeOf

public static java.lang.Boolean isTypeOf(org.eclipse.emf.ecore.EObject toCheck,
                                         java.lang.Object clazz)
Checks whether an EObject is of type Object clazz

Parameters:
toCheck -
clazz -
Returns:

isKindOf

public static java.lang.Boolean isKindOf(org.eclipse.emf.ecore.EObject toCheck,
                                         java.lang.Object clazz)
Checks whether an EObject is kind of Object clazz

Parameters:
toCheck -
clazz -
Returns: