edu.rice.cs.plt.iter
Class ComposedIterator<T>

java.lang.Object
  extended by edu.rice.cs.plt.iter.ComposedIterator<T>
All Implemented Interfaces:
Composite, Iterator<T>

public class ComposedIterator<T>
extends Object
implements Iterator<T>, Composite

Defines an iterator by composing two other iterators. Supports remove().


Constructor Summary
ComposedIterator(Iterator<? extends T> i1, Iterator<? extends T> i2)
          The result traverses i1, then i2
 
Method Summary
 int compositeHeight()
          Get the maximum path length from this node to a leaf.
 int compositeSize()
          Get the number of nodes in the tree rooted at this node.
 boolean hasNext()
           
static
<T> ComposedIterator<T>
make(Iterator<? extends T> i1, Iterator<? extends T> i2)
          Call the constructor (allows T to be inferred)
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComposedIterator

public ComposedIterator(Iterator<? extends T> i1,
                        Iterator<? extends T> i2)
The result traverses i1, then i2

Method Detail

compositeHeight

public int compositeHeight()
Description copied from interface: Composite
Get the maximum path length from this node to a leaf.

Specified by:
compositeHeight in interface Composite

compositeSize

public int compositeSize()
Description copied from interface: Composite
Get the number of nodes in the tree rooted at this node. Always 1 or greater.

Specified by:
compositeSize in interface Composite

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<T>

next

public T next()
Specified by:
next in interface Iterator<T>

remove

public void remove()
Specified by:
remove in interface Iterator<T>

make

public static <T> ComposedIterator<T> make(Iterator<? extends T> i1,
                                           Iterator<? extends T> i2)
Call the constructor (allows T to be inferred)