Package org.basex.query.var
Class QueryStack
- java.lang.Object
-
- org.basex.query.var.QueryStack
-
public final class QueryStack extends Object
The query stack, containing local variable bindings of all active scopes.- Author:
- BaseX Team 2005-23, BSD License, Leo Woerteler
-
-
Constructor Summary
Constructors Constructor Description QueryStack()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
dump()
Creates a dump of the current variable stack.int
enterFrame(int size)
Enters a new stack frame.void
exitFrame(int frame)
Exits a stack frame and makes all bound variables eligible for garbage collection.Value
get(Var var)
Gets the value bound to the given variable in the current stack frame.void
reuseFrame(int size)
Prepares the current stack frame to be reused.void
set(Var var, Value value, QueryContext qc)
Sets the value of the given variable in the current stack frame.String
toString()
-
-
-
Method Detail
-
enterFrame
public int enterFrame(int size)
Enters a new stack frame.- Parameters:
size
- size of this frame- Returns:
- stack pointer of the old frame
-
reuseFrame
public void reuseFrame(int size)
Prepares the current stack frame to be reused.- Parameters:
size
- new frame size
-
exitFrame
public void exitFrame(int frame)
Exits a stack frame and makes all bound variables eligible for garbage collection.- Parameters:
frame
- frame pointer of the underlying stack frame
-
get
public Value get(Var var)
Gets the value bound to the given variable in the current stack frame.- Parameters:
var
- variable- Returns:
- bound value
-
set
public void set(Var var, Value value, QueryContext qc) throws QueryException
Sets the value of the given variable in the current stack frame.- Parameters:
var
- variable to bind the value tovalue
- value to bindqc
- query context- Throws:
QueryException
- if the value does not have the right type
-
dump
public String dump()
Creates a dump of the current variable stack.- Returns:
- string dump
-
-