| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface Operator
An operator in sleep parlance is anything used to operate on two variables inside of an expression. For example 2 + 3 is the expression add 2 and 3. The + plus sign is the operator.
Creating an Operator class and installing it into the environment makes the operator available for use within expressions.
To install an operator into a script environment:
 ScriptInstance script;           // assume
 Operator       myOperatorBridge; // assume
 
 Hashtable environment = script.getScriptEnvironment().getEnvironment();
 environment.put("operator", myOperatorBridge);
 
 
 Operator bridges probably won't be as common as other bridges. Operator bridges can be used for adding new math operators or new string manipulation operators.
| Method Summary | |
|---|---|
|  Scalar | operate(java.lang.String operatorName,
        ScriptInstance anInstance,
        java.util.Stack passedInLocals)apply operator operatorName on the values in the stack. | 
| Method Detail | 
|---|
Scalar operate(java.lang.String operatorName,
               ScriptInstance anInstance,
               java.util.Stack passedInLocals)
operatorName - the name of the operator, for example the String "+"anInstance - instance of the script calling this operatorpassedInLocals - a stack containing values the operator is to be applied to: [left hand side, right hand side]
| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||