Class SortBy

All Implemented Interfaces:
Callable, IFunctionWithRetainedParameterNames, FunctionItem, GroundedValue, Item, Sequence

public class SortBy extends SystemFunction
This class implements the function fn:sort-by, which is a proposed function in XPath 4.0. It also provides supporting code underpinning the implementation of fn:sort.
  • Field Details

  • Constructor Details

    • SortBy

      public SortBy()
  • Method Details

    • call

      public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException
      Evaluate the expression
      Parameters:
      context - the dynamic evaluation context
      arguments - the values of the arguments, supplied as SequenceIterators
      Returns:
      the result of the evaluation, in the form of a SequenceIterator
      Throws:
      XPathException - if a dynamic error occurs during the evaluation of the expression
    • sort

      public static GroundedValue sort(SequenceIterator iterator, List<Callable> keyFunctions, List<AtomicComparer> comparers, XPathContext context) throws XPathException
      Sort a sequence
      Parameters:
      iterator - iterator over the input sequence
      keyFunctions - list of functions for computing sort key values, major to minor
      comparers - list of comparers for comparing sort key values, major to minor
      context - XPath dynamic evaluation context
      Returns:
      the sorted sequence
      Throws:
      XPathException - for example if there are incomparable keys present
    • listOfOne

      public static <T> List<T> listOfOne(T element)