org.axiondb.engine.rowiterators
Class CollatingRowIterator

java.lang.Object
  extended byorg.axiondb.engine.rowiterators.BaseRowIterator
      extended byorg.axiondb.engine.rowiterators.CollatingRowIterator
All Implemented Interfaces:
RowIterator

public class CollatingRowIterator
extends BaseRowIterator

Collates the results of two or more sorted RowIterators according to the given RowComparator. It is assumed that each iterator is already ordered (ascending) according to the given RowComparator.

Version:
$Revision: 1.11 $ $Date: 2004/09/09 23:47:43 $

Constructor Summary
CollatingRowIterator(RowComparator comparator)
           
 
Method Summary
 void addRowIterator(RowIterator iter)
           
 Row current()
          Returns the last Rowreturned by me (by next(),previous(), BaseRowIterator.first(),BaseRowIterator.last(), etc.).
 int currentIndex()
          Returns the index of the current()row, if any.
 boolean hasCurrent()
          Returns true if I have a current Row.
 boolean hasNext()
          Returns true if I have more Rows when traversing the list in the forward direction.
 boolean hasPrevious()
          Returns true if I have more Rows when traversing the list in the reverse direction.
 Row next()
          Returns the next Rowin the list, or throws NoSuchElementExceptionif no next Row exists.
 int nextIndex()
          Returns the index of the next()row, if any, or the number of elements is the iterator if we've reached the end.
 Row previous()
          Returns the previous Rowin the list, or throws NoSuchElementExceptionif no next Row exists.
 int previousIndex()
          Returns the index of the previous()row, if any, or -1 if we're add the beginning of the list.
 void remove()
          Not supported in the base implementation.
 void reset()
          Re-initialize this RowIterator to its initial state (positioned just before the first Rowin the list).
 void set(Row row)
          Not supported in the base implementation.
 
Methods inherited from class org.axiondb.engine.rowiterators.BaseRowIterator
add, first, isEmpty, last, peekNext, peekPrevious
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollatingRowIterator

public CollatingRowIterator(RowComparator comparator)
Method Detail

addRowIterator

public void addRowIterator(RowIterator iter)
                    throws IllegalStateException
Throws:
IllegalStateException

previous

public Row previous()
             throws AxionException
Description copied from interface: RowIterator
Returns the previous Rowin the list, or throws NoSuchElementExceptionif no next Row exists.

Specified by:
previous in interface RowIterator
Specified by:
previous in class BaseRowIterator
Throws:
AxionException

previousIndex

public int previousIndex()
Description copied from interface: RowIterator
Returns the index of the RowIterator.previous()row, if any, or -1 if we're add the beginning of the list.

Specified by:
previousIndex in interface RowIterator
Specified by:
previousIndex in class BaseRowIterator

hasPrevious

public boolean hasPrevious()
Description copied from interface: RowIterator
Returns true if I have more Rows when traversing the list in the reverse direction. (In other words, returns true iff RowIterator.previous()would return a Rowrather than throwing an exception.)

Specified by:
hasPrevious in interface RowIterator
Specified by:
hasPrevious in class BaseRowIterator

next

public Row next()
         throws AxionException
Description copied from interface: RowIterator
Returns the next Rowin the list, or throws NoSuchElementExceptionif no next Row exists.

Specified by:
next in interface RowIterator
Specified by:
next in class BaseRowIterator
Throws:
AxionException

nextIndex

public int nextIndex()
Description copied from interface: RowIterator
Returns the index of the RowIterator.next()row, if any, or the number of elements is the iterator if we've reached the end.

Specified by:
nextIndex in interface RowIterator
Specified by:
nextIndex in class BaseRowIterator

hasNext

public boolean hasNext()
Description copied from interface: RowIterator
Returns true if I have more Rows when traversing the list in the forward direction. (In other words, returns true iff RowIterator.next()would return a Rowrather than throwing an exception.)

Specified by:
hasNext in interface RowIterator
Specified by:
hasNext in class BaseRowIterator

current

public Row current()
Description copied from interface: RowIterator
Returns the last Rowreturned by me (by RowIterator.next(),RowIterator.previous(), RowIterator.first(),RowIterator.last(), etc.).

Specified by:
current in interface RowIterator
Specified by:
current in class BaseRowIterator

currentIndex

public int currentIndex()
Description copied from interface: RowIterator
Returns the index of the RowIterator.current()row, if any.

Specified by:
currentIndex in interface RowIterator
Specified by:
currentIndex in class BaseRowIterator

hasCurrent

public boolean hasCurrent()
Description copied from interface: RowIterator
Returns true if I have a current Row. (In other words, returns true iff RowIterator.current()would return a Rowrather than throwing an exception.)

Specified by:
hasCurrent in interface RowIterator
Specified by:
hasCurrent in class BaseRowIterator

reset

public void reset()
           throws AxionException
Description copied from interface: RowIterator
Re-initialize this RowIterator to its initial state (positioned just before the first Rowin the list).

Specified by:
reset in interface RowIterator
Specified by:
reset in class BaseRowIterator
Throws:
AxionException

set

public void set(Row row)
         throws AxionException
Description copied from class: BaseRowIterator
Not supported in the base implementation.

Specified by:
set in interface RowIterator
Overrides:
set in class BaseRowIterator
Throws:
AxionException

remove

public void remove()
            throws AxionException
Description copied from class: BaseRowIterator
Not supported in the base implementation.

Specified by:
remove in interface RowIterator
Overrides:
remove in class BaseRowIterator
Throws:
AxionException