Class Frame
- java.lang.Object
-
- org.apache.commons.jexl3.internal.Frame
-
public final class Frame extends java.lang.Object
A call frame, created from a scope, stores the arguments and local variables in a "stack frame" (sic).- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) Frame
assign(java.lang.Object... values)
Assign values to this frame.(package private) java.lang.Object
get(int s)
Gets a value.Scope
getScope()
Gets the scope.java.lang.String[]
getUnboundParameters()
Gets this script unbound parameters, i.e.(package private) boolean
has(int s)
Whether this frame defines a symbol, ie declared it and assigned it a value.(package private) java.lang.Object[]
nocycleStack(Closure closure)
Replace any instance of a closure in this stack by its (fuzzy encoded) offset in it.(package private) void
set(int r, java.lang.Object value)
Sets a value.
-
-
-
Field Detail
-
scope
private final Scope scope
The scope.
-
stack
private final java.lang.Object[] stack
The actual stack frame.
-
curried
private final int curried
Number of curried parameters.
-
-
Constructor Detail
-
Frame
Frame(Scope s, java.lang.Object[] r, int c)
Creates a new frame.- Parameters:
s
- the scoper
- the stack framec
- the number of curried parameters
-
-
Method Detail
-
assign
Frame assign(java.lang.Object... values)
Assign values to this frame.- Parameters:
values
- the values- Returns:
- this frame
-
get
java.lang.Object get(int s)
Gets a value.- Parameters:
s
- the offset in this frame- Returns:
- the stacked value
-
getScope
public Scope getScope()
Gets the scope.- Returns:
- this frame scope
-
getUnboundParameters
public java.lang.String[] getUnboundParameters()
Gets this script unbound parameters, i.e. parameters not bound through curry().- Returns:
- the parameter names
-
has
boolean has(int s)
Whether this frame defines a symbol, ie declared it and assigned it a value.- Parameters:
s
- the offset in this frame- Returns:
- true if this symbol has been assigned a value, false otherwise
-
nocycleStack
java.lang.Object[] nocycleStack(Closure closure)
Replace any instance of a closure in this stack by its (fuzzy encoded) offset in it.This is to avoid the cyclic dependency between the closure and its frame stack that may point back to it that occur with recursive function definitions.
- Parameters:
closure
- the owning closure- Returns:
- the cleaned-up stack or the stack itself (most of the time)
-
set
void set(int r, java.lang.Object value)
Sets a value.- Parameters:
r
- the offset in this framevalue
- the value to set in this frame
-
-