org.basex.query.path
Class AxisPath

java.lang.Object
  extended by org.basex.query.ExprInfo
      extended by org.basex.query.expr.Expr
          extended by org.basex.query.path.Path
              extended by org.basex.query.path.AxisPath
Direct Known Subclasses:
IterPath

public class AxisPath
extends Path

Axis Path expression.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen, Sebastian Gath

Nested Class Summary
 
Nested classes/interfaces inherited from class org.basex.query.expr.Expr
Expr.Use
 
Field Summary
 Step[] step
          Expression list.
 
Fields inherited from class org.basex.query.path.Path
root
 
Method Summary
 AxisPath addPred(Expr pred)
          Adds a predicate to the last step.
 Expr addText(QueryContext ctx)
          Optionally adds a text node to an expression for potential index rewriting.
 Expr comp(QueryContext ctx)
          Optimizes and compiles the expression.
static AxisPath get(Expr r, Step... st)
          Constructor.
 AxisPath invertPath(Expr r, Step curr)
          Inverts a location path.
 Iter iter(QueryContext ctx)
          Evaluates the expression and returns an iterator on the resulting items.
 void plan(Serializer ser)
          Recursively sends the abstract syntax of this expression to the specified serializer.
 boolean removable(Var v, QueryContext ctx)
          Checks if the specified variable is removable.
 Expr remove(Var v)
          Removes the specified variable in a sub expression.
 Return returned(QueryContext ctx)
          Indicates the return type of an expression.
 boolean sameAs(Expr cmp)
          Checks the current and specified expression for equality.
 long size(QueryContext ctx)
          Returns the sequence size or 1.
 String toString()
           
 boolean uses(Expr.Use u, QueryContext ctx)
          Indicates if an expression uses the specified type.
 
Methods inherited from class org.basex.query.path.Path
color, toString
 
Methods inherited from class org.basex.query.expr.Expr
atomic, checkCtx, checkDbl, checkItr, duplicates, e, ebv, i, indexAccessible, indexEquivalent, test, v
 
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

step

public Step[] step
Expression list.

Method Detail

get

public static final AxisPath get(Expr r,
                                 Step... st)
Constructor.

Parameters:
r - root expression; can be null
st - location steps; will at least have one entry
Returns:
class instance

comp

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

Overrides:
comp in class Path
Parameters:
ctx - query context
Returns:
optimized Expression
Throws:
QueryException - query exception

iter

public 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.atomic(org.basex.query.QueryContext) must be implemented.

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

size

public final long size(QueryContext ctx)
Description copied from class: Expr
Returns the sequence size or 1.

Overrides:
size in class Expr
Parameters:
ctx - query context
Returns:
result of check

invertPath

public final AxisPath invertPath(Expr r,
                                 Step curr)
Inverts a location path.

Parameters:
r - new root node
curr - current location step
Returns:
inverted path

addPred

public final AxisPath addPred(Expr pred)
Adds a predicate to the last step.

Parameters:
pred - predicate to be added
Returns:
resulting path instance

addText

public final Expr addText(QueryContext ctx)
                   throws QueryException
Description copied from class: Expr
Optionally adds a text node to an expression for potential index rewriting.

Overrides:
addText in class Expr
Parameters:
ctx - query context
Returns:
expression
Throws:
QueryException - query exception

uses

public final boolean uses(Expr.Use u,
                          QueryContext ctx)
Description copied from class: Expr
Indicates if an expression uses the specified type. Called by the compiler to perform certain optimizations. true is returned by default and thus assumed as "worst-case".

Specified by:
uses in class Expr
Parameters:
u - use type to be checked
ctx - query context
Returns:
result of check

removable

public final boolean removable(Var v,
                               QueryContext ctx)
Description copied from class: Expr
Checks if the specified variable is removable.

Overrides:
removable in class Expr
Parameters:
v - variable to be removed
ctx - query context
Returns:
result of check

remove

public final Expr remove(Var v)
Description copied from class: Expr
Removes the specified variable in a sub expression.

Overrides:
remove in class Path
Parameters:
v - variable to be removed
Returns:
expression with removed variable

returned

public final Return returned(QueryContext ctx)
Description copied from class: Expr
Indicates the return type of an expression. Called by the compiler to check if expressions can be reformulated. null is returned by default.

Overrides:
returned in class Expr
Parameters:
ctx - query context
Returns:
result of check

sameAs

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

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

plan

public final void plan(Serializer ser)
                throws 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:
IOException - I/O exception

toString

public final String toString()
Specified by:
toString in class ExprInfo