org.basex.query.xpath.locpath
Class LocPath

java.lang.Object
  extended by org.basex.query.ExprInfo
      extended by org.basex.query.xpath.expr.Expr
          extended by org.basex.query.xpath.locpath.LocPath
Direct Known Subclasses:
LocPathAbs, LocPathRel

public abstract class LocPath
extends Expr

LocationPath (absolute or relative).

Author:
Workgroup DBIS, University of Konstanz 2005-08, ISC License, Tim Petrowsky

Field Summary
 Steps steps
          List of location steps.
 
Constructor Summary
LocPath()
           
 
Method Summary
 void addPosPred(XPContext ctx)
          Limit evaluation of predicates to first hit if only existence of path has to be checked.
 boolean checkAxes()
          Checks if the specified location step has suitable index axes.
 java.lang.String color()
          Returns a string description of the expression.
 Expr comp(XPContext ctx)
          Optimizes the expression.
abstract  Nod eval(XPContext ctx)
          Evaluates the expression with the specified context set.
 IndexToken indexable(XPContext ctx, Expr exp, Comp cmp)
          Checks if the path is indexable.
 LocPath invertPath(Step curr)
          Inverts a location path.
 void plan(Serializer ser)
          Recursively sends the abstract syntax of this expression to the specified serializer.
 boolean sameAs(Expr cmp)
          Checks current and specified expression for equivalence.
 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
 
Methods inherited from class org.basex.query.ExprInfo
info, name
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

steps

public Steps steps
List of location steps.

Constructor Detail

LocPath

public LocPath()
Method Detail

eval

public abstract Nod 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

comp

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

Specified by:
comp in class Expr
Parameters:
ctx - expression context
Returns:
optimized Expression
Throws:
QueryException - evaluation exception

sameAs

public final boolean sameAs(Expr cmp)
Description copied from class: Expr
Checks current and specified expression for equivalence.

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

usesSize

public final 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

usesPos

public final 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

addPosPred

public final void addPosPred(XPContext ctx)
Limit evaluation of predicates to first hit if only existence of path has to be checked.

Parameters:
ctx - query context

indexable

public final IndexToken indexable(XPContext ctx,
                                  Expr exp,
                                  Comp cmp)
Checks if the path is indexable.

Parameters:
ctx - query context
exp - expression which must be a literal
cmp - comparator
Returns:
result of check

checkAxes

public final boolean checkAxes()
Checks if the specified location step has suitable index axes.

Returns:
true result of check

invertPath

public final LocPath invertPath(Step curr)
Inverts a location path.

Parameters:
curr - current location step
Returns:
inverted path

plan

public final 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

color

public final java.lang.String color()
Description copied from class: ExprInfo
Returns a string description of the expression. Contrary to the ExprInfo.toString() method, the current expressions aren't included in the output.

Overrides:
color in class ExprInfo
Returns:
result of check

toString

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