it.eng.spagobi.tools.scheduler.utils
Class BIObjectParametersIterator

java.lang.Object
  extended by it.eng.spagobi.tools.scheduler.utils.BIObjectParametersIterator

public class BIObjectParametersIterator
extends java.lang.Object


Constructor Summary
BIObjectParametersIterator(java.util.List cartproduct)
          Constructor.
 
Method Summary
 boolean hasNext()
          Returns true if there are any more elements in the Cartesian product to return.
 java.lang.Object next()
          Returns another tuple not returned previously.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BIObjectParametersIterator

public BIObjectParametersIterator(java.util.List cartproduct)
Constructor.

Parameters:
cartproduct - a List of BIObjectParameter objects from which the tuples' components are to be draw.
Method Detail

hasNext

public boolean hasNext()
Returns true if there are any more elements in the Cartesian product to return.


next

public java.lang.Object next()
Returns another tuple not returned previously.

The iterator stores its state in the private member currstate -- an ArrayList of the iterators of the individual Collections of any BIObjectParameter in the cartesian product. In the start state, each iterator returns a single element. Afterwards, while iterator #1 has anything to return, we replace the first element of the previous tuple to obtain a new tuple. Once iterator #1 runs out of elements we replace it and advance iterator #2. We keep on advancing iterator #1 until it runs out of elements for the second time, reinitialize it again, and advance iterator #2 once more. We repeat these operations until iterator #2 runs out of elements and we start advancing iterator #3, and so on, until all iterators run out of elements.