org.eigenbase.runtime
Class CompoundIterator

java.lang.Object
  extended by org.eigenbase.runtime.CompoundIterator
All Implemented Interfaces:
Iterator, RestartableIterator

public class CompoundIterator
extends Object
implements RestartableIterator

CompoundIterator creates an iterator out of several. CompoundIterator is serial: it yields all the elements of its first input Iterator, then all those of its second input, etc. When all inputs are exhausted, it is done.

NOTE jvs 21-Mar-2006: This class is no longer used except by Saffron, but is generally useful. Should probably be moved to a utility package.


Nested Class Summary
static class CompoundIterator.Test
           
 
Field Summary
private  int i
           
private  Iterator iterator
           
private  Iterator[] iterators
           
private static Logger tracer
           
 
Constructor Summary
CompoundIterator(Iterator[] iterators)
           
 
Method Summary
 boolean hasNext()
           
 Object next()
           
private  boolean nextIterator()
           
 void remove()
           
 void restart()
          Restarts this iterator, so that a subsequent call to next() returns the first element in the collection being iterated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tracer

private static final Logger tracer

iterator

private Iterator iterator

iterators

private Iterator[] iterators

i

private int i
Constructor Detail

CompoundIterator

public CompoundIterator(Iterator[] iterators)
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator

next

public Object next()
Specified by:
next in interface Iterator

remove

public void remove()
Specified by:
remove in interface Iterator

nextIterator

private boolean nextIterator()

restart

public void restart()
Description copied from interface: RestartableIterator
Restarts this iterator, so that a subsequent call to next() returns the first element in the collection being iterated.

Specified by:
restart in interface RestartableIterator