net.sf.saxon.sort

Class SortedIterator

public class SortedIterator extends Object implements SequenceIterator, LastPositionFinder, Sortable

Class to do a sorted iteration
Field Summary
protected SequenceIteratorbase
protected XPathContextcontext
protected intcount
protected intindex
protected Object[]nodeKeys
protected intrecordSize
protected FixedSortKeyDefinition[]sortkeys
Constructor Summary
SortedIterator(XPathContext context, SequenceIterator base, FixedSortKeyDefinition[] sortkeys)
Method Summary
protected voidbuildArray()
intcompare(int a, int b)
Compare two items in sorted sequence (needed to implement the Sortable interface)
Itemcurrent()
SequenceIteratorgetAnother()
intgetLastPosition()
intgetProperties()
Get properties of this iterator, as a bit-significant integer.
Itemnext()
Get the next item, in sorted order
intposition()
voidsetHostLanguage(int language)
voidswap(int a, int b)
Swap two items (needed to implement the Sortable interface)

Field Detail

base

protected SequenceIterator base

context

protected XPathContext context

count

protected int count

index

protected int index

nodeKeys

protected Object[] nodeKeys

recordSize

protected int recordSize

sortkeys

protected FixedSortKeyDefinition[] sortkeys

Constructor Detail

SortedIterator

public SortedIterator(XPathContext context, SequenceIterator base, FixedSortKeyDefinition[] sortkeys)

Method Detail

buildArray

protected void buildArray()

compare

public int compare(int a, int b)
Compare two items in sorted sequence (needed to implement the Sortable interface)

Returns: <0 if obj[a]0 if obj[a]>obj[b]

current

public Item current()

getAnother

public SequenceIterator getAnother()

getLastPosition

public int getLastPosition()

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 GROUNDED, LAST_POSITION_FINDER, and 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()
Get the next item, in sorted order

position

public int position()

setHostLanguage

public void setHostLanguage(int language)

swap

public void swap(int a, int b)
Swap two items (needed to implement the Sortable interface)