net.sf.saxon.sort

Class DocumentOrderIterator

Implemented Interfaces:
SequenceIterator, Sortable

public final class DocumentOrderIterator
extends java.lang.Object
implements SequenceIterator, Sortable

DocumentOrderIterator takes as input an iteration of nodes in any order, and returns as output an iteration of the same nodes in document order, eliminating any duplicates.

Fields inherited from interface net.sf.saxon.om.SequenceIterator

GROUNDED, LAST_POSITION_FINDER, LOOKAHEAD

Constructor Summary

DocumentOrderIterator(SequenceIterator base, NodeOrderComparer comparer)
Iterate over a sequence in document order.

Method Summary

int
compare(int a, int b)
Compare two nodes in document sequence (needed to implement the Sortable interface)
Item
current()
SequenceIterator
getAnother()
int
getProperties()
Get properties of this iterator, as a bit-significant integer.
Item
next()
int
position()
void
swap(int a, int b)
Swap two nodes (needed to implement the Sortable interface)

Constructor Details

DocumentOrderIterator

public DocumentOrderIterator(SequenceIterator base,
                             NodeOrderComparer comparer)
            throws XPathException
Iterate over a sequence in document order.

Method Details

compare

public int compare(int a,
                   int b)
Compare two nodes in document sequence (needed to implement the Sortable interface)
Specified by:
compare in interface Sortable

current

public Item current()
Specified by:
current in interface SequenceIterator

getAnother

public SequenceIterator getAnother()
            throws XPathException
Specified by:
getAnother in interface SequenceIterator

getProperties

public int getProperties()
Get properties of this iterator, as a bit-significant integer.
Specified by:
getProperties in interface SequenceIterator
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.

next

public Item next()
            throws XPathException
Specified by:
next in interface SequenceIterator

position

public int position()
Specified by:
position in interface SequenceIterator

swap

public void swap(int a,
                 int b)
Swap two nodes (needed to implement the Sortable interface)
Specified by:
swap in interface Sortable