org.basex.query.xpath.expr
Class Pos

java.lang.Object
  extended by org.basex.query.ExprInfo
      extended by org.basex.query.xpath.expr.Expr
          extended by org.basex.query.xpath.expr.Pos

public final class Pos
extends Expr

Position test.

Author:
Workgroup DBIS, University of Konstanz 2005-08, ISC License, Christian Gruen

Field Summary
 int max
          Maximum value.
 int min
          Minimum value.
 
Constructor Summary
Pos(int p)
          Constructor.
Pos(int mn, int mx)
          Constructor.
 
Method Summary
 Expr comp(XPContext ctx)
          Optimizes the expression.
static Expr create(double val, Comp type)
          Creates a position predicate, a false predicate for impossible comparisons or a null reference.
 Bln eval(XPContext ctx)
          Evaluates the expression with the specified context set.
 void plan(Serializer ser)
          Recursively sends the abstract syntax of this expression to the specified serializer.
 java.lang.String toString()
           
 boolean usesPos()
          Checks whether this Expression (or its children) make use of the position parameter.
 boolean usesSize()
          Checks whether this Expression (or its children) make use of the setsize parameter.
 
Methods inherited from class org.basex.query.xpath.expr.Expr
indexEquivalent, indexSizes, returnedValue, sameAs
 
Methods inherited from class org.basex.query.ExprInfo
color, info, name
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

min

public int min
Minimum value.


max

public int max
Maximum value.

Constructor Detail

Pos

public Pos(int p)
Constructor.

Parameters:
p - position

Pos

public Pos(int mn,
           int mx)
Constructor.

Parameters:
mn - minimum
mx - maximum
Method Detail

create

public static Expr create(double val,
                          Comp type)
Creates a position predicate, a false predicate for impossible comparisons or a null reference.

Parameters:
val - position value
type - comparison type
Returns:
predicate

comp

public Expr comp(XPContext ctx)
Description copied from class: Expr
Optimizes the expression.

Specified by:
comp in class Expr
Parameters:
ctx - expression context
Returns:
optimized Expression

eval

public Bln eval(XPContext ctx)
         throws QueryException
Description copied from class: Expr
Evaluates the expression with the specified context set. Additionally provides a context

Specified by:
eval in class Expr
Parameters:
ctx - query context
Returns:
resulting XPathValue
Throws:
QueryException - evaluation exception

usesPos

public boolean usesPos()
Description copied from class: Expr
Checks whether this Expression (or its children) make use of the position parameter. If not this allows some nice optimizations.

Specified by:
usesPos in class Expr
Returns:
whether position is used

usesSize

public boolean usesSize()
Description copied from class: Expr
Checks whether this Expression (or its children) make use of the setsize parameter. If not this allows early predicate evaluation.

Specified by:
usesSize in class Expr
Returns:
whether setsize is used

plan

public void plan(Serializer ser)
          throws java.io.IOException
Description copied from class: ExprInfo
Recursively sends the abstract syntax of this expression to the specified serializer.

Specified by:
plan in class ExprInfo
Parameters:
ser - serializer
Throws:
java.io.IOException - exception

toString

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