Class SplitMapUncertainIterator<T,K,R>

java.lang.Object
com.github.basking2.sdsai.itrex.iterators.splitjoin.SplitMapUncertainIterator<T,K,R>
All Implemented Interfaces:
UncertainIterator<UncertainIterator<R>>

public class SplitMapUncertainIterator<T,K,R> extends Object implements UncertainIterator<UncertainIterator<R>>
Split an iterator's elements across an UncertainIterator. This produces an object that may be processed and given to JoinUncertainIteratorsIterator. This object's operation is to take input elements from an iterator and pass them to "child" iterators. Because we never know if a child iterator will get another element from the source stream, based on the splitFunction, the child iterators must all be UncertainIterators. On calls to hasNext() an element is pulled from the input stream. It is checked if it will produce a new output iterator. If it will, then we create and stage that output iterator to be returned on the next call to next(). If the next element pulled maps to an existing iterator we return MAYBE from hasNext() and no element is available from next(). Recall that MAYBE should be considered FALSE until data is drawn from another source.
  • Constructor Details

  • Method Details

    • hasNext

      public UncertainIterator.HAS_NEXT hasNext()
      Calling this populates iterators. If this returns MAYBE then a new element was enqueued into another iterator. If this returns TRUE then a new element caused a new iterator to be creatd. If this returns FALSE then no inputs remain. Whatever is in the output iterators is all the work that remains.
      Specified by:
      hasNext in interface UncertainIterator<T>
      Returns:
      If there is another iterator to be fetched.
    • next

      public UncertainIterator<R> next()
      Description copied from interface: UncertainIterator
      Get the next value or throw NoSuchElementException.
      Specified by:
      next in interface UncertainIterator<T>
      Returns:
      The next element.