org.embl.ebi.escience.baclava.iterator
Class JoinIterator

java.lang.Object
  extended by org.embl.ebi.escience.baclava.iterator.JoinIterator
All Implemented Interfaces:
java.util.Iterator, ResumableIterator

public class JoinIterator
extends java.lang.Object
implements ResumableIterator

Provides an Iterator that iterates over the orthogonal join of a set of BaclavaIterator instances.

Author:
Tom Oinn

Constructor Summary
JoinIterator()
           
JoinIterator(ResumableIterator[] b)
          The iterator is constructed with an array of BaclavaIterator instances and creates an iterator that iterates over the orthogonal join of this set, where the iterator at position 0 in the array is regarded as the outermost one
 
Method Summary
 int[] getCurrentLocation()
          Get the current location by appending all the current location arrays of all child iterators
 boolean hasNext()
          The join has next if any iterator within it has a next value of true
 java.lang.Object next()
          Get an array of objects corresponding to the current next state of the join of the member iterators
 void remove()
          Calls to the remove operation are not allowed from this iterator
 void reset()
          Reset the join iterator to its starting state
 int size()
          Return the total number of iterations this joinIterator will produce, this is the product of the sizes of all component iterators.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JoinIterator

public JoinIterator()

JoinIterator

public JoinIterator(ResumableIterator[] b)
The iterator is constructed with an array of BaclavaIterator instances and creates an iterator that iterates over the orthogonal join of this set, where the iterator at position 0 in the array is regarded as the outermost one

Method Detail

getCurrentLocation

public int[] getCurrentLocation()
Get the current location by appending all the current location arrays of all child iterators

Specified by:
getCurrentLocation in interface ResumableIterator

hasNext

public boolean hasNext()
The join has next if any iterator within it has a next value of true

Specified by:
hasNext in interface java.util.Iterator

remove

public void remove()
            throws java.lang.UnsupportedOperationException
Calls to the remove operation are not allowed from this iterator

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Get an array of objects corresponding to the current next state of the join of the member iterators

Specified by:
next in interface java.util.Iterator
Throws:
java.util.NoSuchElementException

size

public int size()
Return the total number of iterations this joinIterator will produce, this is the product of the sizes of all component iterators.

Specified by:
size in interface ResumableIterator

reset

public void reset()
Reset the join iterator to its starting state

Specified by:
reset in interface ResumableIterator