Class StaticFuncs

java.lang.Object
org.basex.query.expr.ExprInfo
org.basex.query.func.StaticFuncs

public final class StaticFuncs extends ExprInfo
Container for user-defined functions.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • StaticFuncs

      public StaticFuncs()
  • Method Details

    • declare

      public StaticFunc declare(AnnList anns, QNm qname, Var[] params, SeqType type, Expr expr, String doc, VarScope vs, InputInfo ii) throws QueryException
      Declares a new user-defined function.
      Parameters:
      anns - annotations
      qname - function name
      params - formal parameters
      type - declared return type (can be null)
      expr - function body (can be null)
      doc - xqdoc string
      vs - variable scope
      ii - input info
      Returns:
      static function reference
      Throws:
      QueryException - query exception
    • registerFuncLiteral

      public void registerFuncLiteral(Closure literal)
      Registers a literal for a function that was not yet encountered during parsing.
      Parameters:
      literal - the literal
    • check

      public void check(QueryContext qc) throws QueryException
      Checks if all functions have been correctly declared, and initializes all function calls.
      Parameters:
      qc - query context
      Throws:
      QueryException - query exception
    • checkUp

      public void checkUp() throws QueryException
      Checks if the updating semantics are satisfied.
      Throws:
      QueryException - query exception
    • compileAll

      public void compileAll(CompileContext cc)
      Compiles all functions.
      Parameters:
      cc - compilation context
    • compile

      public void compile(CompileContext cc)
      Compiles all referenced functions.
      Parameters:
      cc - compilation context
    • get

      public StaticFunc get(QNm qname, long arity)
      Returns the function with the given name and arity.
      Parameters:
      qname - function name
      arity - function arity
      Returns:
      function if found, null otherwise
    • seqTypes

      public SeqType[] seqTypes(StaticFunc func)
      Returns the unions of the sequences types for function calls of the specified function.
      Parameters:
      func - function
      Returns:
      sequence types or null
    • similarError

      public QueryException similarError(QNm qname, InputInfo ii)
      Throws an exception if the name of a function is similar to the specified function name.
      Parameters:
      qname - function name
      ii - input info
      Returns:
      exception
    • funcs

      public StaticFunc[] funcs()
      Returns all user-defined functions.
      Returns:
      functions
    • 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