org.sintef.mofscript.runtime.expression
Class ExpressionEvaluator

java.lang.Object
  extended by org.sintef.mofscript.runtime.expression.ExpressionEvaluator
Direct Known Subclasses:
ArithmeticExpressionEvaluator, ComparisonExpressionEvaluator, LogicalExpressionEvaluator, NullEvaluator, SelectExpressionEvaluator, SimpleExpressionEvaluator

public abstract class ExpressionEvaluator
extends java.lang.Object

Handles expressions

Author:
jol

Field Summary
protected  ExecutionEnvironment _env
           
protected  Expression _expression
           
protected  RuleExecutor _ownerRuleExecutor
           
protected static int _positionCounter
           
protected static int _referenceStringLength
           
protected static int _stringPosCounter
           
 
Constructor Summary
ExpressionEvaluator(Expression expression, ExecutionEnvironment env, RuleExecutor ownerRuleExecutor)
          Constructor
 
Method Summary
protected abstract  java.lang.Object evaluate(java.lang.Object inputObject)
          To be defined by subclasses - the actual evaluation of the expression
 java.lang.Object evaluateExpression(java.lang.Object inputObject)
          Evaluates an expression and returns the value as an Object
static void resetPosisionCounter()
          Resetes the position counter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_expression

protected Expression _expression

_env

protected ExecutionEnvironment _env

_ownerRuleExecutor

protected RuleExecutor _ownerRuleExecutor

_positionCounter

protected static int _positionCounter

_stringPosCounter

protected static int _stringPosCounter

_referenceStringLength

protected static int _referenceStringLength
Constructor Detail

ExpressionEvaluator

public ExpressionEvaluator(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

evaluateExpression

public final java.lang.Object evaluateExpression(java.lang.Object inputObject)
                                          throws MofScriptExecutionException
Evaluates an expression and returns the value as an Object

Parameters:
exp -
Returns:
Throws:
MofScriptExecutionException

resetPosisionCounter

public static void resetPosisionCounter()
Resetes the position counter


evaluate

protected abstract java.lang.Object evaluate(java.lang.Object inputObject)
                                      throws MofScriptExecutionException
To be defined by subclasses - the actual evaluation of the expression

Returns:
Throws:
MofScriptExecutionException