sleep.bridges

Class SleepClosure

public class SleepClosure extends Object implements Function

The Sleep Closure class. This class represents a Function object that is also a self contained closure
Constructor Summary
SleepClosure(ScriptInstance si, Block _code)
Creates a new Sleep Closure, with a brand new set of internal variables.
SleepClosure(ScriptInstance si, Block _code, Variable _var)
Creates a new Sleep Closure that uses the specified variable container for its internal variables
Method Summary
ScalarcallClosure(String message, ScriptInstance si, Stack locals)
"Safely" calls this closure.
Scalarevaluate(String message, ScriptInstance si, Stack locals)
Evaluates the closure, use callClosure instead.
ScriptInstancegetOwner()
Returns the owning script instance
BlockgetRunnableCode()
Returns the runnable block of code associated with this closure
VariablegetVariables()
Returns the variable container for this closures
IteratorscalarIterator()
voidsetVariables(Variable _variables)
Sets the variable environment for this closure
StringtoString()
Information about this closure in the form of &closure[:]#
StringtoStringGeneric()
Returns a generic string version of this closure without id information

Constructor Detail

SleepClosure

public SleepClosure(ScriptInstance si, Block _code)
Creates a new Sleep Closure, with a brand new set of internal variables. Don't be afraid, you can call this constructor from your code.

SleepClosure

public SleepClosure(ScriptInstance si, Block _code, Variable _var)
Creates a new Sleep Closure that uses the specified variable container for its internal variables

Method Detail

callClosure

public Scalar callClosure(String message, ScriptInstance si, Stack locals)
"Safely" calls this closure. Use this if you are evaluating this closure from your own code.

Parameters: message the message to pass to this closure (available as $0) the calling script instance (null value assumes same as owner) the local data as a stack object (available as $1 .. $n)

Returns: the scalar returned by this closure

evaluate

public Scalar evaluate(String message, ScriptInstance si, Stack locals)
Evaluates the closure, use callClosure instead.

getOwner

public ScriptInstance getOwner()
Returns the owning script instance

getRunnableCode

public Block getRunnableCode()
Returns the runnable block of code associated with this closure

getVariables

public Variable getVariables()
Returns the variable container for this closures

scalarIterator

public Iterator scalarIterator()

setVariables

public void setVariables(Variable _variables)
Sets the variable environment for this closure

toString

public String toString()
Information about this closure in the form of &closure[:]#

toStringGeneric

public String toStringGeneric()
Returns a generic string version of this closure without id information