SortKeyDefinition
Date: 2016-07-03

com.icl.saxon.sort

## Class SortKeyDefinition

- java.lang.Object
- - com.icl.saxon.sort.SortKeyDefinition

-     public class SortKeyDefinition
      extends java.lang.Object

  A SortKeyDefinition defines one component of a sort key.
  Note that most attributes defining the sort key can be attribute value templates, and can therefore vary from one invocation to another. We hold them as expressions, but optimise for the case where the attributes are all fixed strings: in this case we can use the same Comparer object each time.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SortKeyDefinition()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `bindComparer()` If possible, use the same comparer every time
    `Expression` | `getCaseOrder()`
    `Comparer` | `getComparer(Context context)` Get a Comparer which can be used to compare two values according to this sort key.
    `Expression` | `getDataType()`
    `Expression` | `getLanguage()`
    `Expression` | `getOrder()`
    `Expression` | `getSortKey()`
    `void` | `setCaseOrder(Expression exp)` Set the case order.
    `void` | `setDataType(Expression exp)` Set the data type.
    `void` | `setLanguage(Expression exp)` Set the language.
    `void` | `setOrder(Expression exp)` Set the order.
    `void` | `setSortKey(Expression exp)` Set the expression used as the sort key
    `void` | `setStaticContext(StaticContext sc)` Set the static context.

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

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

- - ### Constructor Detail

    - #### SortKeyDefinition

          public SortKeyDefinition()

  - ### Method Detail

    - #### setSortKey

          public void setSortKey(Expression exp)

      Set the expression used as the sort key

    - #### setOrder

          public void setOrder(Expression exp)

      Set the order. This is supplied as an expression which must evaluate to "ascending" or "descending". If the order is fixed, supply e.g. new StringValue("ascending"). Default is "ascending".

    - #### setDataType

          public void setDataType(Expression exp)

      Set the data type. This is supplied as an expression which must evaluate to "text", "number", or a QName. If the data type is fixed, supply e.g. new StringValue("text"). Default is "text".

    - #### setCaseOrder

          public void setCaseOrder(Expression exp)

      Set the case order. This is supplied as an expression which must evaluate to "upper-first" or "lower-first" or "#default". If the order is fixed, supply e.g. new StringValue("lower-first"). Default is "#default".

    - #### setLanguage

          public void setLanguage(Expression exp)

      Set the language. This is supplied as an expression which evaluate to the language name. If the order is fixed, supply e.g. new StringValue("de"). Default is "en".

    - #### setStaticContext

          public void setStaticContext(StaticContext sc)

      Set the static context. This is used only for resolving any QName supplied in the data-type property.

    - #### getSortKey

          public Expression getSortKey()

    - #### getOrder

          public Expression getOrder()

    - #### getDataType

          public Expression getDataType()

    - #### getCaseOrder

          public Expression getCaseOrder()

    - #### getLanguage

          public Expression getLanguage()

    - #### bindComparer

          public void bindComparer()
                            throws XPathException

      If possible, use the same comparer every time
      Throws:
        `XPathException`

    - #### getComparer

          public Comparer getComparer(Context context)
                               throws XPathException

      Get a Comparer which can be used to compare two values according to this sort key.
      Throws:
        `XPathException`