com.novell.xml.xpath
Class SingleNodeList

java.lang.Object
  extended bycom.novell.xml.xpath.SingleNodeList
All Implemented Interfaces:
ContextNodeList

public class SingleNodeList
extends Object
implements ContextNodeList

A convenience class to provide a context node list of one


Field Summary
 
Fields inherited from interface com.novell.xml.xpath.ContextNodeList
DOCUMENT_ORDER, REVERSE_DOCUMENT_ORDER, UNKNOWN_ORDER
 
Constructor Summary
SingleNodeList()
           
 
Method Summary
 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()
 void setNode(Node node)
          Set the node for this SingleNodeList;
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleNodeList

public SingleNodeList()
Method Detail

setNode

public void setNode(Node node)
Set the node for this SingleNodeList;

Parameters:
node - The node for this single node list

first

public Node first()
           throws XPathEvaluationException
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
Throws:
XPathEvaluationException

next

public Node next()
          throws XPathEvaluationException
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
Throws:
XPathEvaluationException

count

public int count()
          throws XPathEvaluationException
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.
Throws:
XPathEvaluationException

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