org.apache.jackrabbit.decorator
Class DecoratingRangeIterator

java.lang.Object
  extended byorg.apache.jackrabbit.decorator.DecoratingRangeIterator
All Implemented Interfaces:
Iterator, RangeIterator
Direct Known Subclasses:
DecoratingNodeIterator

public class DecoratingRangeIterator
extends Object
implements RangeIterator

Range iterator that decorates all iterated objects. This class is used as the base class of the various decorating iterator utility classes used by the decorator layer.

All the method calls are delegated to the underlying iterator, and best effort is made to decorate the objects returned by the next() method.


Constructor Summary
DecoratingRangeIterator(DecoratorFactory factory, Session session, RangeIterator iterator)
          Creates a decorating iterator.
 
Method Summary
 long getPosition()
          Returns the position of the underlying iterator.
 long getSize()
          Returns the size of the underlying iterator.
 boolean hasNext()
          Checks whether the underlying iterator has more elements.
 Object next()
          Decorates and returns the next objects from the underlying iterator.
 void remove()
          Removes the current object from the underlying iterator.
 void skip(long skipNum)
          Advances the underlying iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DecoratingRangeIterator

public DecoratingRangeIterator(DecoratorFactory factory,
                               Session session,
                               RangeIterator iterator)
Creates a decorating iterator.

Parameters:
factory - decorator factory
session - decorated session
iterator - underlying iterator
Method Detail

skip

public void skip(long skipNum)
Advances the underlying iterator.

Specified by:
skip in interface RangeIterator
Parameters:
skipNum - number of elements to skip
See Also:
RangeIterator.skip(long)

getSize

public long getSize()
Returns the size of the underlying iterator.

Specified by:
getSize in interface RangeIterator
Returns:
size of the iterator
See Also:
RangeIterator.getSize()

getPosition

public long getPosition()
Returns the position of the underlying iterator.

Specified by:
getPosition in interface RangeIterator
Returns:
position of the iterator
See Also:
RangeIterator.getPosition()

hasNext

public boolean hasNext()
Checks whether the underlying iterator has more elements.

Specified by:
hasNext in interface Iterator
Returns:
true if more elements exist, false otherwise
See Also:
Iterator.hasNext()

next

public Object next()
Decorates and returns the next objects from the underlying iterator.

Specified by:
next in interface Iterator
Returns:
decorated object
Throws:
UnsupportedOperationException - if the returned object can not be decorated
See Also:
Iterator.next()

remove

public void remove()
Removes the current object from the underlying iterator.

Specified by:
remove in interface Iterator
See Also:
Iterator.remove()


Copyright © 2004-2005 . All Rights Reserved.