Class 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 Detail

      • QueryStack

        public QueryStack()
    • 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 to
        value - value to bind
        qc - 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