net.sf.saxon.expr

Class FilterIterator

public class FilterIterator extends Object implements SequenceIterator

A FilterIterator filters an input sequence using a filter expression. Note that a FilterIterator is not used where the filter is a constant number (PositionFilter is used for this purpose instead), so this class does no optimizations for numeric predicates.
Nested Class Summary
static classFilterIterator.Leading
Subclass to support the extension function saxon:leading, which terminates the iteration at the first item whose predicate is false
static classFilterIterator.NonNumeric
Subclass to handle the common special case where it is statically known that the filter cannot return a numeric value
Field Summary
protected SequenceIteratorbase
protected Expressionfilter
protected XPathContextfilterContext
Constructor Summary
FilterIterator(SequenceIterator base, Expression filter, XPathContext context)
Constructor
Method Summary
Itemcurrent()
SequenceIteratorgetAnother()
Get another iterator to return the same nodes
protected ItemgetNextMatchingItem()
Get the next node that matches the filter predicate if there is one, or null if not.
intgetProperties()
Get properties of this iterator, as a bit-significant integer.
protected booleanmatches()
Determine whether the context item matches the filter predicate
Itemnext()
Get the next item if there is one
intposition()

Field Detail

base

protected SequenceIterator base

filter

protected Expression filter

filterContext

protected XPathContext filterContext

Constructor Detail

FilterIterator

public FilterIterator(SequenceIterator base, Expression filter, XPathContext context)
Constructor

Parameters: base An iteration of the items to be filtered filter The expression defining the filter predicate context The context in which the expression is being evaluated

Method Detail

current

public Item current()

getAnother

public SequenceIterator getAnother()
Get another iterator to return the same nodes

getNextMatchingItem

protected Item getNextMatchingItem()
Get the next node that matches the filter predicate if there is one, or null if not.

getProperties

public int getProperties()
Get properties of this iterator, as a bit-significant integer.

Returns: the properties of this iterator. This will be some combination of properties such as SequenceIterator.GROUNDED, SequenceIterator.LAST_POSITION_FINDER, and SequenceIterator.LOOKAHEAD. It is always acceptable to return the value zero, indicating that there are no known special properties. It is acceptable for the properties of the iterator to change depending on its state.

matches

protected boolean matches()
Determine whether the context item matches the filter predicate

next

public Item next()
Get the next item if there is one

position

public int position()