Class TimeLimitIteration<E>

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

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

    • TimeLimitIteration Link icon

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

    • hasNext Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

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