net.sf.saxon.expr.flwor

## Class OrderByClausePull

- java.lang.Object
- - net.sf.saxon.expr.flwor.TuplePull
  - - net.sf.saxon.expr.flwor.OrderByClausePull

- All Implemented Interfaces:
    Sortable

      public class OrderByClausePull
      extends TuplePull
      implements Sortable

  Represents the tuple stream delivered by an "order by" clause. This sorts the tuple stream supplied as its input, and outputs the same tuples but in sorted order.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AtomicComparer[]` | `comparers`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OrderByClausePull(TuplePull base, TupleExpression tupleExpr, OrderByClause orderBy, XPathContext context)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close the tuple stream, indicating that although not all tuples have been read, no further tuples are required and resources can be released
    `int` | `compare(int a, int b)` Compare two objects within this Sortable, identified by their position.
    `boolean` | `nextTuple(XPathContext context)` Move on to the next tuple.
    `void` | `swap(int a, int b)` Swap two objects within this Sortable, identified by their position.

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

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

- - ### Field Detail

    - #### comparers

          protected AtomicComparer[] comparers

  - ### Constructor Detail

    - #### OrderByClausePull

          public OrderByClausePull(TuplePull base,
                           TupleExpression tupleExpr,
                           OrderByClause orderBy,
                           XPathContext context)

  - ### Method Detail

    - #### nextTuple

          public boolean nextTuple(XPathContext context)
                            throws XPathException

      Move on to the next tuple. Before returning, this method must set all the variables corresponding to the "returned" tuple in the local stack frame associated with the context object
      Specified by:
        `nextTuple` in class `TuplePull`
      Parameters:
        `context` - the dynamic evaluation context
      Returns:
        true if another tuple has been generated; false if the tuple stream is exhausted. If the method returns false, the values of the local variables corresponding to this tuple stream are undefined.
      Throws:
        `XPathException`

    - #### compare

          public int compare(int a,
                    int b)

      Compare two objects within this Sortable, identified by their position.
      Specified by:
        `compare` in interface `Sortable`
      Returns:
        <0 if obj[a]0 if obj[a]>obj[b]

    - #### swap

          public void swap(int a,
                  int b)

      Swap two objects within this Sortable, identified by their position.
      Specified by:
        `swap` in interface `Sortable`

    - #### close

          public void close()

      Close the tuple stream, indicating that although not all tuples have been read, no further tuples are required and resources can be released
      Overrides:
        `close` in class `TuplePull`

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.