org.basex.query.xpath.locpath
Class Preds

java.lang.Object
  extended by org.basex.query.ExprInfo
      extended by org.basex.query.xpath.locpath.Preds

public final class Preds
extends ExprInfo

Location Steps.

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

Constructor Summary
Preds()
           
 
Method Summary
 void add(Expr expr)
          Adds an expression as predicate.
 void add(Pred pred)
          Adds a predicate.
 java.lang.String color()
          Returns a string description of the expression.
 boolean compile(XPContext ctx)
          Optimizes the predicates.
 void eval(XPContext ctx, NodeBuilder nodes, NodeBuilder result)
          Evaluates the predicates.
 Pred get(int i)
          Returns a predicate.
 void plan(Serializer ser)
          Recursively sends the abstract syntax of this expression to the specified serializer.
 void remove(int s)
          Removes the specified step.
 boolean sameAs(Preds cmp)
          Returns the predicates for equality.
 int size()
          Returns the number of location steps.
 java.lang.String toString()
           
 boolean usesPos()
          Checks whether the predicates make use of the position parameter.
 boolean usesSetSize()
          Checks whether the predicates make use of the size parameter.
 
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
 

Constructor Detail

Preds

public Preds()
Method Detail

size

public int size()
Returns the number of location steps.

Returns:
number of steps

get

public Pred get(int i)
Returns a predicate.

Parameters:
i - predicate offset
Returns:
predicate

add

public void add(Pred pred)
Adds a predicate.

Parameters:
pred - predicate to be added

remove

public void remove(int s)
Removes the specified step.

Parameters:
s - step index

add

public void add(Expr expr)
Adds an expression as predicate.

Parameters:
expr - expression to be added

eval

public void eval(XPContext ctx,
                 NodeBuilder nodes,
                 NodeBuilder result)
          throws QueryException
Evaluates the predicates.

Parameters:
ctx - query context
nodes - nodes to be evaluated
result - result nodes
Throws:
QueryException - evaluation exception

compile

public boolean compile(XPContext ctx)
                throws QueryException
Optimizes the predicates.

Parameters:
ctx - query context
Returns:
false if predicate always yields false
Throws:
QueryException - evaluation exception

usesPos

public boolean usesPos()
Checks whether the predicates make use of the position parameter.

Returns:
whether position is used

usesSetSize

public boolean usesSetSize()
Checks whether the predicates make use of the size parameter.

Returns:
whether node set size is used

sameAs

public boolean sameAs(Preds cmp)
Returns the predicates for equality.

Parameters:
cmp - predicates to be compared
Returns:
result of check

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

color

public 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