Class Variables

java.lang.Object
org.basex.query.expr.ExprInfo
org.basex.query.var.Variables
All Implemented Interfaces:
Iterable<StaticVar>

public final class Variables extends ExprInfo implements Iterable<StaticVar>
Container of global variables of a module.
Author:
BaseX Team 2005-21, BSD License, Leo Woerteler
  • Constructor Details

    • Variables

      public Variables()
  • Method Details

    • declare

      public StaticVar declare(Var var, AnnList anns, Expr expr, boolean ext, String doc, VarScope vs) throws QueryException
      Declares a new static variable.
      Parameters:
      var - variable
      anns - annotations
      expr - bound expression, possibly null
      ext - external flag
      doc - xqdoc string
      vs - variable scope
      Returns:
      static variable reference
      Throws:
      QueryException - query exception
    • checkUp

      public void checkUp() throws QueryException
      Ensures that none of the variable expressions is updating.
      Throws:
      QueryException - query exception
    • check

      public void check() throws QueryException
      Checks if all variables were declared and are visible to all their references.
      Throws:
      QueryException - query exception
    • newRef

      public org.basex.query.var.StaticVarRef newRef(QNm name, StaticContext sc, InputInfo ii) throws QueryException
      Returns a new reference to the (possibly not yet declared) variable with the given name.
      Parameters:
      ii - input info
      name - variable name
      sc - static context
      Returns:
      reference
      Throws:
      QueryException - if the variable is not visible
    • bindExternal

      public void bindExternal(QueryContext qc, QNmMap<Value> bindings) throws QueryException
      Binds all external variables.
      Parameters:
      qc - query context
      bindings - variable bindings
      Throws:
      QueryException - query exception
    • iterator

      public Iterator<StaticVar> iterator()
      Specified by:
      iterator in interface Iterable<StaticVar>
    • plan

      public void plan(QueryPlan plan)
      Description copied from class: ExprInfo
      Creates a query plan.
      Specified by:
      plan in class ExprInfo
      Parameters:
      plan - expression plan
    • plan

      public void plan(QueryString qs)
      Description copied from class: ExprInfo
      Creates a query string.
      Specified by:
      plan in class ExprInfo
      Parameters:
      qs - query string builder