org.basex.query.gflwor
Class GFLWOR.Clause

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.gflwor.GFLWOR.Clause
Direct Known Subclasses:
Count, For, GroupBy, Let, OrderBy, Where, Window
Enclosing class:
GFLWOR

public abstract static class GFLWOR.Clause
extends ParseExpr

A FLWOR clause.

Author:
BaseX Team 2005-12, BSD License, Leo Woerteler

Nested Class Summary
 
Nested classes/interfaces inherited from class org.basex.query.expr.Expr
Expr.Flag
 
Field Summary
 
Fields inherited from class org.basex.query.expr.ParseExpr
info, size, type
 
Constructor Summary
protected GFLWOR.Clause(InputInfo ii, Var... vs)
          Constructor.
 
Method Summary
abstract  GFLWOR.Clause compile(QueryContext ctx, VarScope scp)
          Compiles and optimizes the expression, assigns data types and cardinalities.
abstract  GFLWOR.Clause copy(QueryContext ctx, VarScope scp, IntObjMap<Var> vs)
          Copies an expression.
 boolean declares(Var v)
          Checks if the given variable is declared by this clause.
abstract  GFLWOR.Clause inline(QueryContext ctx, VarScope scp, Var v, Expr e)
          Inlines an expression into this one, replacing all references to the given variable.
 Item item(QueryContext ctx, InputInfo ii)
          Deprecated. 
 Iter iter(QueryContext ctx)
          Deprecated. 
abstract  GFLWOR.Clause optimize(QueryContext ctx, VarScope scp)
          Optimizes an already compiled expression without recompiling its sub-expressions.
 Value value(QueryContext ctx)
          Deprecated. 
 Var[] vars()
          All declared variables of this clause.
 
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, optPre, preEval, size, test, type
 
Methods inherited from class org.basex.query.expr.Expr
accept, addText, checkUp, compEbv, copy, count, exprSize, has, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isItem, isVacuous, isValue, iterable, markTailCalls, removable, sameAs, uses, visitAll
 
Methods inherited from class org.basex.data.ExprInfo
addPlan, addPlan, description, info, plan, planAttr, planElem, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GFLWOR.Clause

protected GFLWOR.Clause(InputInfo ii,
                        Var... vs)
Constructor.

Parameters:
ii - input info
vs - declared variables
Method Detail

compile

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

Specified by:
compile in class Expr
Parameters:
ctx - query context
scp - variable scope
Returns:
optimized expression
Throws:
QueryException - query exception

optimize

public abstract GFLWOR.Clause optimize(QueryContext ctx,
                                       VarScope scp)
                                throws QueryException
Description copied from class: Expr
Optimizes an already compiled expression without recompiling its sub-expressions.

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

inline

public abstract GFLWOR.Clause inline(QueryContext ctx,
                                     VarScope scp,
                                     Var v,
                                     Expr e)
                              throws QueryException
Description copied from class: Expr
Inlines an expression into this one, replacing all references to the given variable.

Specified by:
inline in class Expr
Parameters:
ctx - query context for recompilation
scp - variable scope for recompilation
v - variable to replace
e - expression to inline
Returns:
resulting expression in something changed, null otherwise
Throws:
QueryException - query exception

iter

@Deprecated
public Iter iter(QueryContext ctx)
          throws QueryException
Deprecated. 

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

value

@Deprecated
public Value value(QueryContext ctx)
            throws QueryException
Deprecated. 

Description copied from class: Expr
Evaluates the expression and returns the resulting value.

Overrides:
value in class ParseExpr
Parameters:
ctx - query context
Returns:
iterator
Throws:
QueryException - query exception

item

@Deprecated
public Item item(QueryContext ctx,
                            InputInfo ii)
          throws QueryException
Deprecated. 

Description copied from class: Expr
Evaluates the expression and returns the resulting item or a null reference, if the expression yields an empty sequence. If this method is not overwritten, Expr.iter(org.basex.query.QueryContext) must be implemented by an expression, as it may be called by this method.

Overrides:
item in class ParseExpr
Parameters:
ctx - query context
ii - input info
Returns:
iterator
Throws:
QueryException - query exception

copy

public abstract GFLWOR.Clause 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

vars

public final Var[] vars()
All declared variables of this clause.

Returns:
declared variables

declares

public final boolean declares(Var v)
Checks if the given variable is declared by this clause.

Parameters:
v - variable
Returns:
{code true} if the variable was declared here, false otherwise