javax.jcr
Interface RangeIterator

All Superinterfaces:
java.util.Iterator
All Known Subinterfaces:
AccessControlPolicyIterator, EventIterator, EventJournal, EventListenerIterator, NodeIterator, NodeTypeIterator, PropertyIterator, RowIterator, VersionIterator

public interface RangeIterator
extends java.util.Iterator

Extends Iterator with the skip, getSize and getPosition methods. The base interface of all type-specific iterators in the javax.jcr and its sub packages.


Method Summary
 long getPosition()
          Returns the current position within the iterator.
 long getSize()
          Returns the total number of of items available through this iterator.
 void skip(long skipNum)
          Skip a number of elements in the iterator.
 
Methods inherited from interface java.util.Iterator
hasNext, next, remove
 

Method Detail

skip

void skip(long skipNum)
Skip a number of elements in the iterator.

Parameters:
skipNum - the non-negative number of elements to skip
Throws:
java.util.NoSuchElementException - if skipped past the last element in the iterator.

getSize

long getSize()
Returns the total number of of items available through this iterator. For example, for some node N, N.getNodes().getSize() returns the number of child nodes of N visible through the current Session. In some implementations precise information about the number of elements may not be available. In such cases this method must return -1. API clients will then be able to use RangeIterator.getNumberRemaining to get an estimate on the number of elements.

Returns:
a long

getPosition

long getPosition()
Returns the current position within the iterator. The number returned is the 0-based index of the next element in the iterator, i.e. the one that will be returned on the subsequent next call.

Note that this method does not check if there is a next element, i.e. an empty iterator will always return 0.

Returns:
a long


Copyright © 2009 Day Software. All Rights Reserved.