public class SleepClosure extends java.lang.Object implements Function, java.lang.Runnable
Constructor and Description |
---|
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
|
Modifier and Type | Method and Description |
---|---|
Scalar |
callClosure(java.lang.String message,
ScriptInstance si,
java.util.Stack locals)
"Safely" calls this closure.
|
Scalar |
evaluate(java.lang.String message,
ScriptInstance si,
java.util.Stack locals)
Evaluates the closure, use callClosure instead.
|
java.lang.Object |
getAndRemoveMetadata(java.lang.Object key,
java.lang.Object defaultv)
obtain a key from the metadata store associated with this closure
|
ScriptInstance |
getOwner()
Returns the owning script instance
|
Block |
getRunnableCode()
Returns the runnable block of code associated with this closure
|
Variable |
getVariables()
Returns the variable container for this closures
|
void |
putMetadata(java.lang.Object key,
java.lang.Object value)
put some value into the metadata store associated with this closure.
|
void |
run()
"Safely" calls this closure.
|
java.util.Iterator |
scalarIterator() |
void |
setVariables(Variable _variables)
Sets the variable environment for this closure
|
java.lang.String |
toString()
Information about this closure in the form of &closure[
|
java.lang.String |
toStringGeneric()
Returns a generic string version of this closure without id information
|
public SleepClosure(ScriptInstance si, Block _code)
public SleepClosure(ScriptInstance si, Block _code, Variable _var)
public java.util.Iterator scalarIterator()
public void putMetadata(java.lang.Object key, java.lang.Object value)
public java.lang.Object getAndRemoveMetadata(java.lang.Object key, java.lang.Object defaultv)
public java.lang.String toStringGeneric()
public java.lang.String toString()
toString
in class java.lang.Object
public ScriptInstance getOwner()
public Block getRunnableCode()
public Variable getVariables()
public void setVariables(Variable _variables)
public void run()
run
in interface java.lang.Runnable
public Scalar callClosure(java.lang.String message, ScriptInstance si, java.util.Stack locals)
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)public Scalar evaluate(java.lang.String message, ScriptInstance si, java.util.Stack locals)
evaluate
in interface Function
message
- the function being called.si
- an instance of the script calling this function.locals
- 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]SleepUtils.runCode(Function, String, ScriptInstance, Stack)