jd.xml.xpath.expr.path
Class FilteredLocationStep

java.lang.Object
  extended byjd.xml.xpath.expr.ExpressionImpl
      extended byjd.xml.xpath.expr.NodeSetExpression
          extended byjd.xml.xpath.expr.path.LocationStep
              extended byjd.xml.xpath.expr.path.FilteredLocationStep
All Implemented Interfaces:
Expression

public class FilteredLocationStep
extends LocationStep

A FilteredLocationStep is a LocationStep with a simple filter predicate that uses axis iterators for evaluation and is therefore faster than a heavyweight PredicateExpression. - and a forward axis or a reverse axis and a unique filter expression The implementation uses axis iterators and applies the predicate filter directly to all iterated nodes which pass the nodetest (instead of evaluating the pure location step and then filtering the returned node-set with a PredicateExpression. Because iterators are used the context size is not known and therefore the filter expression may not contain last().


Field Summary
 
Fields inherited from class jd.xml.xpath.expr.path.LocationStep
axis_, maxAxisResultSize_, nodeTest_
 
Fields inherited from interface jd.xml.xpath.expr.Expression
DEP_CONTEXT_NODE, DEP_CONTEXT_POSITION, DEP_CONTEXT_SIZE, DEP_CONTEXT_STATIC, DEP_NONE, DEP_UNKNOWN
 
Method Summary
 void accept(ExpressionVisitor visitor)
          Accept a ExpressionVisitor.
static FilteredLocationStep create(SimpleLocationStep step, Expression filter)
          Create a FilteredLocationStep if possible
 int getContextDependencies()
          Return a bitfield indicating the expression dependencies.
 int getMaxResultSize()
          Return the maximum size of the returned NodeSet or 0 if not known.
 void getNodes(XPathContext context, XMutableNodeSet nodeSet)
          Evaluate the FilteredLocationStep.
 XNodeSet toNodeSet(XPathContext context, int nodeSetOrdering)
          Evaluate the FilteredLocationStep.
 
Methods inherited from class jd.xml.xpath.expr.path.LocationStep
getAxis, getNodeTest
 
Methods inherited from class jd.xml.xpath.expr.NodeSetExpression
canCreateModelWalker, getMaxResultSize, getMinResultSize, getMinResultSize, getModelWalker, getResultType, toBooleanValue, toNumberValue, toStringValue, toXObject
 
Methods inherited from class jd.xml.xpath.expr.ExpressionImpl
hasContextDependencies, isUniqueFilter, matchesFilter, toNode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static FilteredLocationStep create(SimpleLocationStep step,
                                          Expression filter)
Create a FilteredLocationStep if possible

Returns:
the step or null if the axis and filter don't allow to apply the FilteredLocationStep.

getMaxResultSize

public int getMaxResultSize()
Description copied from class: NodeSetExpression
Return the maximum size of the returned NodeSet or 0 if not known. The default implementation returns 0.

Overrides:
getMaxResultSize in class LocationStep

toNodeSet

public XNodeSet toNodeSet(XPathContext context,
                          int nodeSetOrdering)
Evaluate the FilteredLocationStep.

Specified by:
toNodeSet in interface Expression
Overrides:
toNodeSet in class ExpressionImpl

getNodes

public void getNodes(XPathContext context,
                     XMutableNodeSet nodeSet)
Evaluate the FilteredLocationStep.

Specified by:
getNodes in class LocationStep
Parameters:
context - the evaluation context
nodeSet - a NodeSet where to store the resulting nodes

getContextDependencies

public int getContextDependencies()
Return a bitfield indicating the expression dependencies.

Specified by:
getContextDependencies in interface Expression
Overrides:
getContextDependencies in class LocationStep

accept

public void accept(ExpressionVisitor visitor)
Description copied from interface: Expression
Accept a ExpressionVisitor.

Specified by:
accept in interface Expression
Overrides:
accept in class LocationStep