sleep.taint
Class Sanitizer

java.lang.Object
  extended by sleep.taint.Sanitizer
All Implemented Interfaces:
java.io.Serializable, Function, Operator

public class Sanitizer
extends java.lang.Object
implements Function, Operator

See Also:
Serialized Form

Field Summary
protected  java.lang.Object function
           
 
Constructor Summary
Sanitizer(java.lang.Object f)
           
 
Method Summary
 Scalar evaluate(java.lang.String name, ScriptInstance script, java.util.Stack arguments)
          Evaluate a function and return the resulting scalar.
 Scalar operate(java.lang.String name, ScriptInstance script, java.util.Stack arguments)
          apply operator operatorName on the values in the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

function

protected java.lang.Object function
Constructor Detail

Sanitizer

public Sanitizer(java.lang.Object f)
Method Detail

operate

public Scalar operate(java.lang.String name,
                      ScriptInstance script,
                      java.util.Stack arguments)
Description copied from interface: Operator
apply operator operatorName on the values in the stack.

Specified by:
operate in interface Operator
Parameters:
name - the name of the operator, for example the String "+"
script - instance of the script calling this operator
arguments - a stack containing values the operator is to be applied to: [left hand side, right hand side]
Returns:
a Scalar containing the result of the operatorName applied to the passedInLocals, in the case of "+" applied to [4, 3] we would get a Scalar containing the integer 7.

evaluate

public Scalar evaluate(java.lang.String name,
                       ScriptInstance script,
                       java.util.Stack arguments)
Description copied from interface: Function
Evaluate a function and return the resulting scalar. Only the sleep interpreter should ever call this function. If you have a maddening desire to call this Function object yourself, then use the convienence method in SleepUtils.

Specified by:
evaluate in interface Function
Parameters:
name - the function being called.
script - an instance of the script calling this function.
arguments - a stack containing the locals passed to this function. The locals are Scalar values passed in reverse order i.e. [arg n, arg n-1, ..., arg 1, arg 0]
Returns:
an instance of Scalar containing the return value of this function.
See Also:
SleepUtils.runCode(Function, String, ScriptInstance, Stack)