org.basex.query.expr
Class Pos

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.Simple
                  extended by org.basex.query.expr.Pos

public final class Pos
extends Simple

Pos expression.

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
 
Fields inherited from class org.basex.query.expr.ParseExpr
info, size, type
 
Method Summary
 Pos copy(QueryContext ctx, VarScope scp, IntObjMap<Var> vs)
          Copies an expression.
static Expr get(CmpV.OpV cmp, Expr a, Expr o, InputInfo ii)
          Returns an instance of this class, if possible, and the input expression otherwise.
static Expr get(long mn, long mx, InputInfo ii)
          Returns a position expression, or an optimized boolean item.
 boolean has(Expr.Flag flag)
          Indicates if an expression has the specified compiler property.
 Bln item(QueryContext ctx, InputInfo ii)
          Evaluates the expression and returns the resulting item or a null reference, if the expression yields an empty sequence.
 void plan(FElem plan)
          Creates an expression tree.
 boolean sameAs(Expr cmp)
          Compares the current and specified expression for equality.
 boolean skip(QueryContext ctx)
          Returns false if no more results can be expected.
 java.lang.String toString()
           
 
Methods inherited from class org.basex.query.expr.Simple
accept, checkUp, compile, count, exprSize, inline, removable
 
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, iter, optPre, preEval, size, test, type, value
 
Methods inherited from class org.basex.query.expr.Expr
addText, compEbv, copy, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isItem, isVacuous, isValue, iterable, markTailCalls, optimize, uses, visitAll
 
Methods inherited from class org.basex.data.ExprInfo
addPlan, addPlan, description, info, planAttr, planElem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

get

public static Expr get(long mn,
                       long mx,
                       InputInfo ii)
Returns a position expression, or an optimized boolean item.

Parameters:
mn - minimum value
mx - minimum value
ii - input info
Returns:
expression

get

public static Expr get(CmpV.OpV cmp,
                       Expr a,
                       Expr o,
                       InputInfo ii)
Returns an instance of this class, if possible, and the input expression otherwise.

Parameters:
cmp - comparator
a - argument
o - original expression
ii - input info
Returns:
resulting expression, or null

item

public Bln item(QueryContext ctx,
                InputInfo ii)
         throws QueryException
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 Pos 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

skip

public boolean skip(QueryContext ctx)
Returns false if no more results can be expected.

Parameters:
ctx - query context
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 Simple
Parameters:
flag - flag to be found
Returns:
result of check

sameAs

public boolean sameAs(Expr cmp)
Description copied from class: Expr
Compares the current and specified expression for equality.

Overrides:
sameAs in class Expr
Parameters:
cmp - expression to be compared
Returns:
result of check

plan

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

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

toString

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