org.basex.query.func
Class StaticFuncCall

java.lang.Object
  extended by org.basex.data.ExprInfo
      extended by org.basex.query.expr.Expr
          extended by org.basex.query.expr.ParseExpr
              extended by org.basex.query.expr.Arr
                  extended by org.basex.query.func.StaticFuncCall
Direct Known Subclasses:
BaseFuncCall, TailFuncCall

public abstract class StaticFuncCall
extends Arr

Function call for user-defined functions.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.basex.query.expr.Expr
Expr.Flag
 
Field Summary
protected  StaticContext sc
          Static context of this function call.
 
Fields inherited from class org.basex.query.expr.Arr
expr
 
Fields inherited from class org.basex.query.expr.ParseExpr
info, size, type
 
Method Summary
 boolean accept(ASTVisitor visitor)
          Traverses this expression, notifying the visitor of declared and used variables, and checking the tree for other recursive properties.
 Expr compile(QueryContext ctx, VarScope scp)
          Compiles and optimizes the expression, assigns data types and cardinalities.
 BaseFuncCall copy(QueryContext ctx, VarScope scp, IntObjMap<Var> vs)
          Copies an expression.
 java.lang.String description()
          Returns a string description of the expression.
 StaticFunc func()
          Getter for the called function.
 boolean has(Expr.Flag flag)
          Indicates if an expression has the specified compiler property.
 StaticFuncCall init(StaticFunc f)
          Initializes the function and checks for visibility.
 boolean isVacuous()
          Tests if this is a vacuous expression (empty sequence or error function).
 Iter iter(QueryContext ctx)
          Evaluates the expression and returns an iterator on the resulting items.
 void plan(FElem plan)
          Creates an expression tree.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.query.expr.Arr
allAreValues, checkNoUp, checkUp, copyAll, count, exprSize, indexEquivalent, inline, removable, toString
 
Methods inherited from class org.basex.query.expr.ParseExpr
checkAdmin, checkAllUp, checkBinary, checkBln, checkColl, checkCreate, checkCtx, checkDbl, checkDBNode, checkEStr, checkEStr, checkFunc, checkItem, checkItr, checkItr, checkMap, checkNode, checkNode, checkNode, checkNoEmpty, checkNoneUp, checkNoUp, checkQNm, checkStr, checkStr, checkStrBin, checkType, checkWrite, compBln, copyType, ebv, item, optPre, preEval, size, test, type, value
 
Methods inherited from class org.basex.query.expr.Expr
addText, compEbv, copy, hasFreeVars, indexAccessible, inlineAll, isEmpty, isFunction, isItem, isValue, iterable, markTailCalls, optimize, sameAs, uses, visitAll
 
Methods inherited from class org.basex.data.ExprInfo
addPlan, addPlan, info, planAttr, planElem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sc

protected final StaticContext sc
Static context of this function call.

Method Detail

compile

public Expr compile(QueryContext ctx,
                    VarScope scp)
             throws QueryException
Description copied from class: Expr
Compiles and optimizes the expression, assigns data types and cardinalities.

Overrides:
compile in class Arr
Parameters:
ctx - query context
scp - variable scope
Returns:
optimized expression
Throws:
QueryException - query exception

iter

public final Iter iter(QueryContext ctx)
                throws QueryException
Description copied from class: Expr
Evaluates the expression and returns an iterator on the resulting items. If this method is not overwritten, Expr.item(org.basex.query.QueryContext, org.basex.util.InputInfo) must be implemented by an expression, as it may be called by this method.

Overrides:
iter in class ParseExpr
Parameters:
ctx - query context
Returns:
resulting item
Throws:
QueryException - query exception

copy

public final BaseFuncCall copy(QueryContext ctx,
                               VarScope scp,
                               IntObjMap<Var> vs)
Description copied from class: Expr
Copies an expression. Will be useful for inlining functions, or for copying static queries.

Specified by:
copy in class Expr
Parameters:
ctx - query context
scp - variable scope for creating new variables
vs - mapping from old variable IDs to new variable copies
Returns:
copied expression

init

public StaticFuncCall init(StaticFunc f)
                    throws QueryException
Initializes the function and checks for visibility.

Parameters:
f - function reference
Returns:
self reference
Throws:
QueryException - query exception

func

public final StaticFunc func()
Getter for the called function.

Returns:
user-defined function

isVacuous

public final boolean isVacuous()
Description copied from class: Expr
Tests if this is a vacuous expression (empty sequence or error function). This check is needed for updating queries.

Overrides:
isVacuous in class Expr
Returns:
result of check

has

public boolean has(Expr.Flag flag)
Description copied from class: Expr
Indicates if an expression has the specified compiler property. This method is called by numerous Expr.compile(org.basex.query.QueryContext, org.basex.query.var.VarScope) methods to test properties of sub-expressions. It returns true if at least one test is successful.

Overrides:
has in class Arr
Parameters:
flag - flag to be found
Returns:
result of check

plan

public final void plan(FElem plan)
Description copied from class: ExprInfo
Creates an expression tree.

Overrides:
plan in class Arr
Parameters:
plan - root element

description

public java.lang.String description()
Description copied from class: ExprInfo
Returns a string description of the expression. This method is only called by error messages. Contrary to the ExprInfo.toString() method, arguments are not included in the output.

Overrides:
description in class ExprInfo
Returns:
result of check

toString

public java.lang.String toString()
Specified by:
toString in class ExprInfo

accept

public boolean accept(ASTVisitor visitor)
Description copied from class: Expr
Traverses this expression, notifying the visitor of declared and used variables, and checking the tree for other recursive properties.

Overrides:
accept in class Arr
Parameters:
visitor - visitor
Returns:
if the walk should be continued