net.sf.saxon.om
Class EmptyIterator

java.lang.Object
  extended bynet.sf.saxon.om.EmptyIterator
All Implemented Interfaces:
AxisIterator, LastPositionFinder, ReversibleIterator, SequenceIterator

public class EmptyIterator
extends java.lang.Object
implements AxisIterator, ReversibleIterator, LastPositionFinder

EmptyIterator: an iterator over an empty sequence. Since such an iterator has no state, only one instance is required; therefore a singleton instance is available via the static getInstance() method.


Constructor Summary
EmptyIterator()
           
 
Method Summary
 Item current()
          Get the current item, that is, the item returned by the most recent call of next().
 SequenceIterator getAnother()
          Get another iterator over the same items, positioned at the start.
static EmptyIterator getInstance()
          Get an EmptyIterator, an iterator over an empty sequence.
 int getLastPosition()
          Get the position of the last item in the sequence.
 SequenceIterator getReverseIterator()
          Get another iterator over the same items, in reverse order.
 Item next()
          Get the next item.
 int position()
          Get the position of the current item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyIterator

public EmptyIterator()
Method Detail

getInstance

public static EmptyIterator getInstance()
Get an EmptyIterator, an iterator over an empty sequence.

Returns:
an EmptyIterator (in practice, this always returns the same one)

next

public Item next()
Get the next item. This method should not be called unless hasNext() returns true.

Specified by:
next in interface AxisIterator
Returns:
the next item (always null in this implementation)

current

public Item current()
Get the current item, that is, the item returned by the most recent call of next().

Specified by:
current in interface AxisIterator
Returns:
the current item

position

public int position()
Get the position of the current item.

Specified by:
position in interface AxisIterator
Returns:
the position of the current item

getLastPosition

public int getLastPosition()
Get the position of the last item in the sequence.

Specified by:
getLastPosition in interface LastPositionFinder
Returns:
the position of the last item in the sequence, always zero in this implementation

getAnother

public SequenceIterator getAnother()
Get another iterator over the same items, positioned at the start.

Specified by:
getAnother in interface AxisIterator
Returns:
another iterator over an empty sequence (in practice, it returns the same iterator each time)

getReverseIterator

public SequenceIterator getReverseIterator()
Get another iterator over the same items, in reverse order.

Specified by:
getReverseIterator in interface ReversibleIterator
Returns:
a reverse iterator over an empty sequence (in practice, it returns the same iterator each time)