|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.jexl3.internal.Scope
public final class Scope
A script scope, stores the declaration of parameters and local variables as symbols.
Nested Class Summary | |
---|---|
static class |
Scope.Frame
A call frame, created from a scope, stores the arguments and local variables in a "stack frame" (sic). |
Constructor Summary | |
---|---|
Scope(Scope scope,
String... parameters)
Creates a new scope with a list of parameters. |
Method Summary | |
---|---|
Scope.Frame |
createFrame(Scope.Frame frame)
Creates a frame by copying values up to the number of parameters. |
void |
declareParameter(String name)
Declares a parameter. |
Integer |
declareVariable(String name)
Declares a local variable. |
boolean |
equals(Object o)
|
int |
getArgCount()
Gets the (maximum) number of arguments this script expects. |
Integer |
getHoisted(int symbol)
Gets the hoisted index of a given symbol, ie the target index of a symbol in a child frame. |
String[] |
getLocalVariables()
Gets this script local variable, i.e. |
String[] |
getParameters()
Gets this script parameters, i.e. |
Integer |
getSymbol(String name)
Checks whether an identifier is a local variable or argument, ie a symbol. |
String[] |
getSymbols()
Gets this script symbols names, i.e. |
int |
hashCode()
|
boolean |
isHoistedSymbol(int symbol)
Checks whether a given symbol is hoisted. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Scope(Scope scope, String... parameters)
scope
- the parent scope if anyparameters
- the list of parametersMethod Detail |
---|
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public Integer getSymbol(String name)
name
- the symbol name
public boolean isHoistedSymbol(int symbol)
symbol
- the symbol number
public void declareParameter(String name)
This method creates an new entry in the symbol map.
name
- the parameter namepublic Integer declareVariable(String name)
This method creates an new entry in the symbol map.
name
- the variable name
public Scope.Frame createFrame(Scope.Frame frame)
This captures the hoisted variables values.
frame
- the caller frame
public Integer getHoisted(int symbol)
symbol
- the symbol index
public int getArgCount()
public String[] getSymbols()
public String[] getParameters()
public String[] getLocalVariables()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |