sleep.bridges
Class BasicIO

java.lang.Object
  extended by sleep.bridges.BasicIO
All Implemented Interfaces:
java.io.Serializable, Evaluation, Function, Loadable

public class BasicIO
extends java.lang.Object
implements Loadable, Function, Evaluation

provides IO functions for the sleep language

See Also:
Serialized Form

Constructor Summary
BasicIO()
           
 
Method Summary
 Scalar evaluate(java.lang.String n, ScriptInstance i, java.util.Stack l)
          Evaluate a function and return the resulting scalar.
 Scalar evaluateString(ScriptInstance script, java.lang.String value)
          Evaluate the specified string value.
 boolean scriptLoaded(ScriptInstance aScript)
          called when a script is loaded
 boolean scriptUnloaded(ScriptInstance aScript)
          called when a script is unloaded
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicIO

public BasicIO()
Method Detail

scriptUnloaded

public boolean scriptUnloaded(ScriptInstance aScript)
Description copied from interface: Loadable
called when a script is unloaded

Specified by:
scriptUnloaded in interface Loadable

evaluateString

public Scalar evaluateString(ScriptInstance script,
                             java.lang.String value)
Description copied from interface: Evaluation
Evaluate the specified string value.

Specified by:
evaluateString in interface Evaluation

scriptLoaded

public boolean scriptLoaded(ScriptInstance aScript)
Description copied from interface: Loadable
called when a script is loaded

Specified by:
scriptLoaded in interface Loadable

evaluate

public Scalar evaluate(java.lang.String n,
                       ScriptInstance i,
                       java.util.Stack l)
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:
n - the function being called.
i - an instance of the script calling this function.
l - 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)