|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvxmlsurfer.Variables
public class Variables
This class maintains the varibles scope list. Scope object implemented as Scriptable object in Rhino.
Field Summary | |
---|---|
static java.lang.String |
NOTEXIST
Used to indicate that a variable does not exist. |
static java.util.Stack<org.mozilla.javascript.Scriptable> |
scopes
|
static java.lang.String |
UNDEFINED
Used to indicate that a variable exists but a value hasen't been assigned. |
Constructor Summary | |
---|---|
Variables()
|
Method Summary | |
---|---|
static void |
assignVar(java.lang.String var,
java.lang.String expr)
Takes var and value, resolves them in their appropriate scopes, and makes the assignment. |
static void |
clear()
Clears all variables reachable from the current scope. |
static void |
clear(java.lang.String[] arr)
Clears the specified variables. |
static void |
clearStack()
Empties the stack of scopes. |
static void |
defineVar(java.lang.String var)
Defines a variable and initializes it to UNDEFINED. |
static void |
defineVar(java.lang.String var,
java.lang.String expr)
Defines a variable and assigns it the resultant value. |
static java.lang.String |
evaluateExpr(java.lang.String expr)
Used to evaluate an expression. |
static org.mozilla.javascript.Scriptable |
getCurrentScope()
Returns the current scope. |
(package private) static org.mozilla.javascript.Scriptable |
getVarScope(java.lang.String val)
Used to get the scope in which the variable is defined. |
static java.lang.Object |
getVarVal(java.lang.String var)
Used to get the value of a variable. |
static boolean |
isDefined(java.lang.String var)
Checks if the variable is defined or not. |
static boolean |
isNull(java.lang.String var)
Checks if the variable has been assigned a value or not. |
static void |
newNamedVarScope(java.lang.String var)
Creates a new named variable scope. |
static void |
newVarScope()
Creates a new unnamed variable scope. |
static void |
popScope()
Gets the top-most scope from the scope stack and assigns it as the current scope. |
static void |
pushScope()
Pushes the current scope into a stack and reassigns current scope to the session scope. |
static void |
putVar(java.lang.String var,
java.lang.Object val)
Used to explicitly put a variable-value pain in the current scope. |
static void |
removeVarScope()
Destroys the current variable scope and sets the current variable scope to the parent of the variable scope just destroyed. |
static java.lang.String |
resolveExpr(java.lang.String expr)
Used to resolve variables. |
static void |
setScopeName(java.lang.String name)
Gives a name to the current scope. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.Stack<org.mozilla.javascript.Scriptable> scopes
public static java.lang.String UNDEFINED
public static java.lang.String NOTEXIST
Constructor Detail |
---|
public Variables()
Method Detail |
---|
public static void newVarScope()
public static void newNamedVarScope(java.lang.String var)
var
- name of scopepublic static void setScopeName(java.lang.String name)
var
- name of scopepublic static void removeVarScope()
public static void defineVar(java.lang.String var, java.lang.String expr)
var
- name of the variableexpr
- will be evaluated and its value will be assigned to varpublic static void defineVar(java.lang.String var)
var
- variable namepublic static java.lang.Object getVarVal(java.lang.String var)
var
- variable name
static org.mozilla.javascript.Scriptable getVarScope(java.lang.String val)
var
- name of variable
public static java.lang.String evaluateExpr(java.lang.String expr)
expr
- expression to be evaluated
public static java.lang.String resolveExpr(java.lang.String expr)
expr
- expression to be evaluated
public static void assignVar(java.lang.String var, java.lang.String expr)
var
- variable name. May be of the form expr
- value expression. Use '' to indicate a string literal. May use
variables here. Can assign numeric literals too.public static void putVar(java.lang.String var, java.lang.Object val)
var
- variable nameval
- valuepublic static boolean isDefined(java.lang.String var)
var
- variable
public static boolean isNull(java.lang.String var)
var
- variable
public static void clear()
public static void clear(java.lang.String[] arr)
arr
- list of variables to be cleared.public static void pushScope()
public static void popScope()
public static void clearStack()
public static org.mozilla.javascript.Scriptable getCurrentScope()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |