com.novell.xsl.process
Class CurrentNodeList

java.lang.Object
  extended bycom.novell.xsl.process.CurrentNodeList
All Implemented Interfaces:
ContextNodeList

public class CurrentNodeList
extends Object
implements ContextNodeList

An implementation of ContextNodeList used for holding sorted lists of nodes (sort in other than document order)


Nested Class Summary
protected  class CurrentNodeList.Mark
           
 
Field Summary
 
Fields inherited from interface com.novell.xml.xpath.ContextNodeList
DOCUMENT_ORDER, REVERSE_DOCUMENT_ORDER, UNKNOWN_ORDER
 
Constructor Summary
CurrentNodeList()
          Create an empty CurrentNodeList.
 
Method Summary
 void add(Node node)
          Add a node to the list.
 void clear()
          Set the list to empty.
 int count()
          Return a count of nodes in the context node list.
 Node first()
          Return the first node in the context node list.
 ContextListMark getMark()
          Return a marker to a position in a ContextNodeList.
 Node next()
          Return a the subsequent node in the context node list after a call to first() or next()
 int order()
          Return order in which nodes are returned from first()-next()
 int position()
          Return the position of the last node returned by a call to first() or next()
 Node returnToMark(ContextListMark mark)
          Go to a position in a ContextNodeList previously marked with getMark()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrentNodeList

public CurrentNodeList()
Create an empty CurrentNodeList.

Method Detail

add

public void add(Node node)
Add a node to the list. Note that this doesn't check for duplicates (and there shouldn't ever be duplicate nodes in a current node list).

Parameters:
node - The node to add.

clear

public void clear()
Set the list to empty.


first

public Node first()
Return the first node in the context node list.

Specified by:
first in interface ContextNodeList
Returns:
First node in list. null is returned if list is empty

next

public Node next()
Return a the subsequent node in the context node list after a call to first() or next()

Specified by:
next in interface ContextNodeList
Returns:
The next node in the context node list. null is returned if there are no more nodes in the node list

count

public int count()
Return a count of nodes in the context node list. NOTE: this should be implemented with lazy evaluation if possible, since context node lists can be very large, depending on the document.

Specified by:
count in interface ContextNodeList
Returns:
Count of nodes in the context node list.

position

public int position()
Return the position of the last node returned by a call to first() or next()

Specified by:
position in interface ContextNodeList
Returns:
Node position in node list. 0 is returned if no nodes have been returned. Once first() or next() return null (indicating no more nodes in list) the return will be the position of the last node in the list.

order

public int order()
Return order in which nodes are returned from first()-next()

Specified by:
order in interface ContextNodeList
Returns:
DOCUMENT_ORDER or REVERSE_DOCUMENT_ORDER

getMark

public ContextListMark getMark()
Return a marker to a position in a ContextNodeList. This marker can be used later in a call to returnToMark() to return to a particular position in the list.

Specified by:
getMark in interface ContextNodeList
Returns:
an opaque marker

returnToMark

public Node returnToMark(ContextListMark mark)
Go to a position in a ContextNodeList previously marked with getMark()

Specified by:
returnToMark in interface ContextNodeList
Parameters:
mark - mark returned from getMark()
Returns:
The node at the mark