Top Fields Constructors Methods
com.sun.org.apache.xalan.internal.xsltc.dom

public final Class SortingIterator

extends DTMAxisIteratorBase
Class Inheritance
Imports
com.sun.org.apache.xalan.internal.xsltc.runtime.BasisLibrary, com.sun.org.apache.xml.internal.dtm.DTMAxisIterator, com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase

Authors
Jacek Ambroziak, Santiago Pericas-Geertsen, Morten Jorgensen

Field Summary

Modifier and TypeField and Description
private int
private NodeSortRecord[]
private NodeSortRecordFactory
private int
private DTMAxisIterator
private static final int
Inherited from com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase:
_includeSelf_isRestartable_last_markedNode_position_startNode

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
public DTMAxisIterator
cloneIterator()

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase.cloneIterator.

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.cloneIterator.

Clone a SortingIterator by cloning its source iterator and then sharing the factory and the array of NodeSortRecords.

public int
getLast()

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase.getLast.

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getLast.

Returns the position of the last node within the iteration, as defined by XPath.

public int
public void
gotoMark()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.gotoMark.

Restores the current node remembered by setMark().

public int
next()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.next.

Get the next node in the iteration.

private int
partition(int p, int r)

private void
quicksort(int p, int r)

public void
setMark()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.setMark.

Remembers the current node for the next call to gotoMark().

public DTMAxisIterator
setStartNode(int
Sets the root of the iteration.
node
)

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.setStartNode.

Set start to END should 'close' the iterator, i.e. subsequent call to next() should return END.

Inherited from com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase:
getAxisgetNodeByPositiongetStartNodeincludeSelfisDocOrderedisReverseresetresetPositionreturnNodesetRestartable

Field Detail

_currentback to summary
private int _current
_databack to summary
private NodeSortRecord[] _data
_factoryback to summary
private NodeSortRecordFactory _factory
_freeback to summary
private int _free
_sourceback to summary
private DTMAxisIterator _source
INIT_DATA_SIZEback to summary
private static final int INIT_DATA_SIZE

Constructor Detail

SortingIteratorback to summary
public SortingIterator(DTMAxisIterator source, NodeSortRecordFactory factory)

Method Detail

addRecordback to summary
private void addRecord(NodeSortRecord record)
cloneIteratorback to summary
public DTMAxisIterator cloneIterator()

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase.cloneIterator.

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.cloneIterator.

Clone a SortingIterator by cloning its source iterator and then sharing the factory and the array of NodeSortRecords.

Returns:DTMAxisIterator

Doc from com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase.cloneIterator.

a deep copy of this iterator.

getLastback to summary
public int getLast()

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase.getLast.

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getLast.

Doc from com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase.getLast.

Returns the position of the last node within the iteration, as defined by XPath. In a forward iterator, I believe this equals the number of nodes which this iterator will yield. In a reverse iterator, I believe it should return 1 (since the "last" is the first produced.) This may be an expensive operation when called the first time, since it may have to iterate through a large part of the document to produce its answer.

Returns:int

The number of nodes in this iterator (forward) or 1 (reverse).

getPositionback to summary
public int getPosition()

Overrides com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase.getPosition.

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.getPosition.

Returns:int

Doc from com.sun.org.apache.xml.internal.dtm.ref.DTMAxisIteratorBase.getPosition.

The position of the current node within the set, as defined by XPath. Note that this is one-based, not zero-based.

gotoMarkback to summary
public void gotoMark()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.gotoMark.

Doc from com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.gotoMark.

Restores the current node remembered by setMark().

nextback to summary
public int next()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.next.

Doc from com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.next.

Get the next node in the iteration.

Returns:int

The next node handle in the iteration, or END.

partitionback to summary
private int partition(int p, int r)
quicksortback to summary
private void quicksort(int p, int r)
setMarkback to summary
public void setMark()

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.setMark.

Doc from com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.setMark.

Remembers the current node for the next call to gotoMark().

setStartNodeback to summary
public DTMAxisIterator setStartNode(int node)

Implements com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.setStartNode.

Doc from com.sun.org.apache.xml.internal.dtm.DTMAxisIterator.setStartNode.

Set start to END should 'close' the iterator, i.e. subsequent call to next() should return END.

Parameters
node:int

Sets the root of the iteration.

Returns:DTMAxisIterator

A DTMAxisIterator set to the start of the iteration.