org.basex.query.xpath.locpath
Class Preds

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

public final class Preds
extends java.lang.Object

Location Steps.

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

Constructor Summary
Preds()
           
 
Method Summary
 void add(Expr expr)
          Adds an expression as predicate.
 void add(int min, int max)
          Adds a position predicate.
 void add(Pred pred)
          Adds a predicate.
 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 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 java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Preds

public Preds()
Method Detail

add

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

Parameters:
expr - expression to be added

add

public void add(int min,
                int max)
Adds a position predicate.

Parameters:
min - minimum value
max - maximum value

add

public void add(Pred pred)
Adds a predicate.

Parameters:
pred - predicate to be added

compile

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

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

eval

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

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

get

public Pred get(int i)
Returns a predicate.

Parameters:
i - predicate offset
Returns:
predicate

remove

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

Parameters:
s - step index

sameAs

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

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

size

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

Returns:
number of steps

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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