org.eclipse.rdf4j.query.algebra.evaluation.iterator

## Class OrderIterator

- java.lang.Object
- - org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E,X>
  - - org.eclipse.rdf4j.common.iteration.DelayedIteration<BindingSet,QueryEvaluationException>
    - - org.eclipse.rdf4j.query.algebra.evaluation.iterator.OrderIterator

- All Implemented Interfaces:
    AutoCloseable, CloseableIteration<BindingSet,QueryEvaluationException>, Iteration<BindingSet,QueryEvaluationException>
  Direct Known Subclasses:
    LimitedSizeOrderIteration

      public class OrderIterator
      extends DelayedIteration<BindingSet,QueryEvaluationException>

  Sorts the input and optionally applies limit and distinct.
  Author:
    James Leigh, Arjohn Kampman

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OrderIterator(CloseableIteration<BindingSet,QueryEvaluationException> iter, Comparator<BindingSet> comparator)`
    `OrderIterator(CloseableIteration<BindingSet,QueryEvaluationException> iter, Comparator<BindingSet> comparator, long limit, boolean distinct)`
    `OrderIterator(CloseableIteration<BindingSet,QueryEvaluationException> iter, Comparator<BindingSet> comparator, long limit, boolean distinct, long iterationSyncThreshold)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Iteration<BindingSet,QueryEvaluationException>` | `createIteration()` Creates the iteration that should be iterated over.
    `protected void` | `decrement(int amount)`
    `protected void` | `handleClose()` Closes this iteration as well as the underlying iteration if it has already been created and happens to be a `CloseableIteration`.
    `protected void` | `increment()`
    `void` | `remove()` Calls the `remove` method of the underlying iteration.

    - ### Methods inherited from class org.eclipse.rdf4j.common.iteration.DelayedIteration

      `hasNext, next`

    - ### Methods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration

      `close, isClosed`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.common.iteration.Iteration

      `stream`

- - ### Constructor Detail

    - #### OrderIterator

          public OrderIterator(CloseableIteration<BindingSet,QueryEvaluationException> iter,
                               Comparator<BindingSet> comparator)

    - #### OrderIterator

          public OrderIterator(CloseableIteration<BindingSet,QueryEvaluationException> iter,
                               Comparator<BindingSet> comparator,
                               long limit,
                               boolean distinct)

    - #### OrderIterator

          public OrderIterator(CloseableIteration<BindingSet,QueryEvaluationException> iter,
                               Comparator<BindingSet> comparator,
                               long limit,
                               boolean distinct,
                               long iterationSyncThreshold)

  - ### Method Detail

    - #### createIteration

          protected Iteration<BindingSet,QueryEvaluationException> createIteration()
                                                                            throws QueryEvaluationException

      Description copied from class: `DelayedIteration`
      Creates the iteration that should be iterated over. This method is called only once, when the iteration is first needed.
      Specified by:
        `createIteration` in class `DelayedIteration<BindingSet,QueryEvaluationException>`
      Throws:
        `QueryEvaluationException`

    - #### increment

          protected void increment()
                            throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

    - #### decrement

          protected void decrement(int amount)
                            throws QueryEvaluationException

      Throws:
        `QueryEvaluationException`

    - #### remove

          public void remove()
                      throws QueryEvaluationException

      Description copied from class: `DelayedIteration`
      Calls the `remove` method of the underlying iteration.
      Specified by:
        `remove` in interface `Iteration<BindingSet,QueryEvaluationException>`
      Overrides:
        `remove` in class `DelayedIteration<BindingSet,QueryEvaluationException>`
      Throws:
        `QueryEvaluationException`

    - #### handleClose

          protected void handleClose()
                              throws QueryEvaluationException

      Description copied from class: `DelayedIteration`
      Closes this iteration as well as the underlying iteration if it has already been created and happens to be a `CloseableIteration`.
      Overrides:
        `handleClose` in class `DelayedIteration<BindingSet,QueryEvaluationException>`
      Throws:
        `QueryEvaluationException`

Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.