Class IteratorTransform<I,T>

java.lang.Object
org.apache.commons.geometry.core.internal.IteratorTransform<I,T>
Type Parameters:
I - Input iterator type
T - Output iterator type
All Implemented Interfaces:
Iterator<T>
Direct Known Subclasses:
AbstractRegionBSPTree.RegionBoundaryIterator

public abstract class IteratorTransform<I,T> extends Object implements Iterator<T>
Class that wraps another iterator, converting each input iterator value into one or more output iterator values.
  • Field Details

    • inputIterator

      private final Iterator<I> inputIterator
      Input iterator instance that supplies the input values for this instance.
    • outputQueue

      private final Deque<T> outputQueue
      Output value queue.
  • Constructor Details

    • IteratorTransform

      protected IteratorTransform(Iterator<I> inputIterator)
      Create a new instance that uses the given iterator as the input source.
      Parameters:
      inputIterator - iterator supplying input values
  • Method Details

    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<I>
    • next

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

      private boolean loadNextOutput()
      Load the next output values into the output queue. Returns true if the output queue contains more entries.
      Returns:
      true if more output values are available
    • addOutput

      protected void addOutput(T value)
      Add a value to the output queue.
      Parameters:
      value - value to add to the output queue
    • addAllOutput

      protected void addAllOutput(Collection<T> values)
      Add multiple values to the output queue.
      Parameters:
      values - values to add to the output queue
    • acceptInput

      protected abstract void acceptInput(I input)
      Accept a value from the input iterator. This method should take the input value and add one or more values to the output queue.
      Parameters:
      input - value from the input iterator