edu.rice.cs.plt.iter
Class BinaryMappedIterator<T1,T2,R>

java.lang.Object
  extended by edu.rice.cs.plt.iter.BinaryMappedIterator<T1,T2,R>
All Implemented Interfaces:
Composite, java.util.Iterator<R>

public class BinaryMappedIterator<T1,T2,R>
extends java.lang.Object
implements java.util.Iterator<R>, Composite

An Iterator that applies a provided mapping lambda to each corresponding member of two source iterators. remove() delegates to each of the source iterators. Assumes the iterators have the same length.


Constructor Summary
BinaryMappedIterator(java.util.Iterator<? extends T1> source1, java.util.Iterator<? extends T2> source2, Lambda2<? super T1,? super T2,? extends R> map)
           
 
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
<T1,T2,R> BinaryMappedIterator<T1,T2,R>
make(java.util.Iterator<? extends T1> source1, java.util.Iterator<? extends T2> source2, Lambda2<? super T1,? super T2,? extends R> map)
          Call the constructor (allows the type arguments to be inferred)
 R next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryMappedIterator

public BinaryMappedIterator(java.util.Iterator<? extends T1> source1,
                            java.util.Iterator<? extends T2> source2,
                            Lambda2<? super T1,? super T2,? extends R> map)
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 java.util.Iterator<R>

next

public R next()
Specified by:
next in interface java.util.Iterator<R>

remove

public void remove()
Specified by:
remove in interface java.util.Iterator<R>

make

public static <T1,T2,R> BinaryMappedIterator<T1,T2,R> make(java.util.Iterator<? extends T1> source1,
                                                           java.util.Iterator<? extends T2> source2,
                                                           Lambda2<? super T1,? super T2,? extends R> map)
Call the constructor (allows the type arguments to be inferred)