sleep.bridges

Class BasicNumbers

Implemented Interfaces:
Function, Loadable, Operator, Predicate, Serializable

public class BasicNumbers
extends Object
implements Predicate, Operator, Loadable, Function

provides some of the basic number crunching functionality

Field Summary

static Class
TYPE_DOUBLE
static Class
TYPE_INT
static Class
TYPE_LONG

Constructor Summary

BasicNumbers()

Method Summary

boolean
decide(String n, ScriptInstance i, Stack l)
decides the truthfulness of the proposition predicateName applied to the passedInTerms.
Scalar
evaluate(String name, ScriptInstance si, Stack args)
Scalar
operate(String o, ScriptInstance i, Stack locals)
apply operator operatorName on the values in the stack.
boolean
scriptLoaded(ScriptInstance aScript)
boolean
scriptUnloaded(ScriptInstance aScript)

Field Details

TYPE_DOUBLE

public static Class TYPE_DOUBLE

TYPE_INT

public static Class TYPE_INT

TYPE_LONG

public static Class TYPE_LONG

Constructor Details

BasicNumbers

public BasicNumbers()

Method Details

decide

public boolean decide(String n,
                      ScriptInstance i,
                      Stack l)
decides the truthfulness of the proposition predicateName applied to the passedInTerms.
Specified by:
decide in interface Predicate
Parameters:
Returns:
a boolean, in the case of a predicate == and the terms [3, 4] we know 3 == 4 is false so return false.

evaluate

public Scalar evaluate(String name,
                       ScriptInstance si,
                       Stack args)
Specified by:
evaluate in interface Function

operate

public Scalar operate(String o,
                      ScriptInstance i,
                      Stack locals)
apply operator operatorName on the values in the stack.
Specified by:
operate in interface Operator
Parameters:
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.

scriptLoaded

public boolean scriptLoaded(ScriptInstance aScript)
Specified by:
scriptLoaded in interface Loadable

scriptUnloaded

public boolean scriptUnloaded(ScriptInstance aScript)
Specified by:
scriptUnloaded in interface Loadable