Class TimeLimitIteration<E>

All Implemented Interfaces:
AutoCloseable, Iterator<E>, CloseableIteration<E>

public abstract class TimeLimitIteration<E> extends IterationWrapper<E>
Author:
Arjohn Kampman
  • Constructor Details

    • TimeLimitIteration

      protected TimeLimitIteration(CloseableIteration<? extends E> iter, long timeLimit)
  • Method Details

    • hasNext

      public boolean hasNext()
      Description copied from class: IterationWrapper
      Checks whether the wrapped Iteration contains more elements, closing this Iteration when this is not the case.
      Specified by:
      hasNext in interface Iterator<E>
      Overrides:
      hasNext in class IterationWrapper<E>
      Returns:
      true if the wrapped Iteration contains more elements, false otherwise.
    • next

      public E next()
      Description copied from class: IterationWrapper
      Returns the next element from the wrapped Iteration.
      Specified by:
      next in interface Iterator<E>
      Overrides:
      next in class IterationWrapper<E>
    • remove

      public void remove()
      Description copied from class: IterationWrapper
      Removes the last element that has been returned from the wrapped Iteration.
      Specified by:
      remove in interface Iterator<E>
      Overrides:
      remove in class IterationWrapper<E>
    • handleClose

      protected void handleClose()
      Description copied from class: IterationWrapper
      Closes this Iteration and also closes the wrapped Iteration if it is a CloseableIteration.
      Overrides:
      handleClose in class IterationWrapper<E>
    • throwInterruptedException

      protected abstract void throwInterruptedException()
      If the iteration is interrupted by its time limit, this method is called to generate and throw the appropriate exception.