fmpp.tdd
Class DataLoaderEvaluationEnvironment

java.lang.Object
  extended by fmpp.tdd.DataLoaderEvaluationEnvironment
All Implemented Interfaces:
EvaluationEnvironment

public class DataLoaderEvaluationEnvironment
extends java.lang.Object
implements EvaluationEnvironment

Evaluates function calls as data loader invocations.


Field Summary
 
Fields inherited from interface fmpp.tdd.EvaluationEnvironment
EVENT_ENTER_FUNCTION_PARAMS, EVENT_ENTER_HASH, EVENT_ENTER_HASH_KEY, EVENT_ENTER_SEQUENCE, EVENT_LEAVE_FUNCTION_PARAMS, EVENT_LEAVE_HASH, EVENT_LEAVE_HASH_KEY, EVENT_LEAVE_SEQUENCE, RETURN_FRAGMENT, RETURN_SKIP
 
Constructor Summary
DataLoaderEvaluationEnvironment(Engine eng)
           
 
Method Summary
 java.lang.Object evalFunctionCall(FunctionCall fc, Interpreter ip)
          Evaluates the function call.
protected  java.lang.Object findTopLevelVariable(java.lang.String name)
          Override this to help TDD get function to find top level variables.
 java.lang.Object notify(int event, Interpreter ip, java.lang.String name, java.lang.Object extra)
          Notifies about an event during expression evaluation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataLoaderEvaluationEnvironment

public DataLoaderEvaluationEnvironment(Engine eng)
Method Detail

evalFunctionCall

public java.lang.Object evalFunctionCall(FunctionCall fc,
                                         Interpreter ip)
                                  throws java.lang.Exception
Description copied from interface: EvaluationEnvironment
Evaluates the function call. This method may simply returns its parameter, which means that the function was not resolved, and thus the function call will be availble for further interpretation in the result of the TDD expression evaluation.

Specified by:
evalFunctionCall in interface EvaluationEnvironment
Parameters:
fc - the function call to evaluate.
Returns:
the return value of the function call. During the evaluation of a TDD expression, function calls will be replaced with their return values. If the return value is a FunctionCall object, it will not be evaluated again. This way, the final result of a TDD expression evaluation can contain FunctionCall objects.
Throws:
java.lang.Exception

findTopLevelVariable

protected java.lang.Object findTopLevelVariable(java.lang.String name)
Override this to help TDD get function to find top level variables. The default implementation finds top-level variables already created in the executing TDD expression, and then it tries to get the variable with Engine.getData(String).

Returns:
the value of variable, or null if no variable with the given name exists.

notify

public java.lang.Object notify(int event,
                               Interpreter ip,
                               java.lang.String name,
                               java.lang.Object extra)
Description copied from interface: EvaluationEnvironment
Notifies about an event during expression evaluation.

Specified by:
notify in interface EvaluationEnvironment
Parameters:
event - An EVENT_... constant. Further events may will be added later, so the implementation must silently ignore events that it does not know. It is guaranteed that for each EVENT_ENTER_... event there will be an EVENT_LEAVE_... event later, except if notifyContextChange has thrown exception during handling EVENT_ENTER_..., in which case it is guaranteed that there will be no corresponding EVENT_LEAVE_... event.
ip - the Interpreter instance that evaluates the text. The value returned by Interpreter.getPosition() will be the position in the text where the this even has been created:
name - For EvaluationEnvironment.EVENT_ENTER_HASH_KEY and EvaluationEnvironment.EVENT_ENTER_FUNCTION_PARAMS, the name of the hash key or function. It is null otherwise.
extra - Even specific extra information.
Returns:
return The allowed return values and their meaning depends on the event. But return value null always means "do nothing special". The currently defiend non-null return values for the events: