## com.icl.saxon.expr
Class SortKeyEnumeration

    java.lang.Object
      com.icl.saxon.expr.SortKeyEnumeration

All Implemented Interfaces:
  LastPositionFinder, NodeEnumeration, Sortable

public final class SortKeyEnumeration
extends java.lang.Object
implements NodeEnumeration, LastPositionFinder, Sortable

A SortKeyEnumeration is NodeEnumeration that delivers the nodes sorted according to a specified sort key.

Field Summary
`protected NodeEnumeration` `base`

Constructor Summary
`SortKeyEnumeration(Context context, NodeEnumeration _base, SortKeyDefinition[] sortkeys)`

Method Summary
`int` `compare(int a, int b)` Compare two nodes in sorted sequence (needed to implement the Sortable interface)
`int` `getLastPosition()` Get the last position
`boolean` `hasMoreElements()` Determine whether there are more nodes
`boolean` `isPeer()` Determine whether the nodes returned by this enumeration are known to be peers, that is, no node is a descendant or ancestor of another node.
`boolean` `isReverseSorted()` Determine whether the nodes returned by this enumeration are known to be in reverse document order.
`boolean` `isSorted()` Determine whether the nodes returned by this enumeration are known to be in document order
`NodeInfo` `nextElement()` Get the next node, in sorted order
`void` `swap(int a, int b)` Swap two nodes (needed to implement the Sortable interface)

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### base

    protected NodeEnumeration base

Constructor Detail

### SortKeyEnumeration

    public SortKeyEnumeration(Context context,
                              NodeEnumeration _base,
                              SortKeyDefinition[] sortkeys)
                       throws XPathException

Method Detail

### hasMoreElements

    public boolean hasMoreElements()

  Determine whether there are more nodes

  Specified by:
    `hasMoreElements` in interface `NodeEnumeration`
  Returns:
    true if there are more nodes

### nextElement

    public NodeInfo nextElement()
                         throws XPathException

  Get the next node, in sorted order

  Specified by:
    `nextElement` in interface `NodeEnumeration`
  Returns:
    the next NodeInfo
  Throws:
    `XPathException`

### isSorted

    public boolean isSorted()

  Description copied from interface: `NodeEnumeration`
  Determine whether the nodes returned by this enumeration are known to be in document order

  Specified by:
    `isSorted` in interface `NodeEnumeration`
  Returns:
    true if the nodes are guaranteed to be in document order.

### isReverseSorted

    public boolean isReverseSorted()

  Description copied from interface: `NodeEnumeration`
  Determine whether the nodes returned by this enumeration are known to be in reverse document order.

  Specified by:
    `isReverseSorted` in interface `NodeEnumeration`
  Returns:
    true if the nodes are guaranteed to be in document order.

### isPeer

    public boolean isPeer()

  Description copied from interface: `NodeEnumeration`
  Determine whether the nodes returned by this enumeration are known to be peers, that is, no node is a descendant or ancestor of another node. This significance of this property is that if a peer enumeration is applied to each node in a set derived from another peer enumeration, and if both enumerations are sorted, then the result is also sorted.

  Specified by:
    `isPeer` in interface `NodeEnumeration`

### getLastPosition

    public int getLastPosition()
                        throws XPathException

  Description copied from interface: `LastPositionFinder`
  Get the last position

  Specified by:
    `getLastPosition` in interface `LastPositionFinder`
  Throws:
    `XPathException`

### compare

    public int compare(int a,
                       int b)

  Compare two nodes in sorted sequence (needed to implement the Sortable interface)

  Specified by:
    `compare` in interface `Sortable`
  Returns:
    <0 if obj[a]<obj[b], 0 if obj[a]=obj[b], >0 if obj[a]>obj[b]

### swap

    public void swap(int a,
                     int b)

  Swap two nodes (needed to implement the Sortable interface)

  Specified by:
    `swap` in interface `Sortable`