Package net.sf.saxon.expr.sort

This package provides utility routines for sorting and grouping.

See:
          Description

Interface Summary
AtomicComparer Interface representing an object that can be used to compare two XPath atomic values for equality or for ordering.
GroupIterator A GroupIterator is an iterator that iterates over a sequence of groups.
IntIterator An iterator over a sequence of unboxed int values
IntSet A set of integers represented as int values
IntToIntMap Interface defining a map from integers to integers
NodeOrderComparer A Comparer used for comparing nodes in document order
Sortable A Sortable is an object that can be sorted using the QuickSort method.
SortKeyEvaluator Callback interface used to evaluate sort keys.
SubstringMatcher This interface is implemented by a collation that is capable of supporting the XPath functions that require matching of a substring: namely contains(), starts-with, ends-with, substring-before, and substring-after.
 

Class Summary
AlphanumericCollator A Comparer that treats strings as an alternating sequence of alpha parts and numeric parts.
AtomicSortComparer An AtomicComparer used for comparing atomic values of arbitrary item types.
CalendarValueComparer A comparer specifically for comparing two date, time, or dateTime values
CodepointCollatingComparer An AtomicComparer used for comparing strings, untypedAtomic values, and URIs using the Unicode codepoint collation.
CodepointCollator A collating sequence that uses Unicode codepoint ordering
CollatingAtomicComparer An AtomicComparer used for comparing strings, untypedAtomic values, and URIs using a collation.
ComparableAtomicValueComparer A comparer for comparing two "ordinary" atomic values, where the values implement the Comparable interface and the equals() method with the appropriate XPath semantics.
ComparisonKey An object used as a comparison key.
ConditionalSorter An expression that sorts an underlying sequence into document order if some condition is true, or that returns the sequence "as is" (knowing that it doesn't need sorting) if the condition is false.
DecimalSortComparer An AtomicComparer used for sorting values that are known to be instances of xs:decimal (including xs:integer), It also supports a separate method for getting a collation key to test equality of items
DescendingComparer A Comparer used for comparing descending keys.
DocumentOrderIterator DocumentOrderIterator takes as input an iteration of nodes in any order, and returns as output an iteration of the same nodes in document order, eliminating any duplicates.
DocumentSorter A DocumentSorter is an expression that sorts a sequence of nodes into document order.
DoubleSortComparer An AtomicComparer used for sorting values that are known to be numeric.
EmptyGreatestComparer A Comparer that modifies a base comparer by sorting empty key values and NaN values last (greatest), as opposed to the default which sorts them first.
EmptyIntIterator An iterator over a zero-length sequence of integers
EqualityComparer A comparer for comparing two atomic values where (a) equals is defined, and is implemented using the Java equals() method, and (b) ordering is not defined, and results in a dynamic error.
GenericAtomicComparer An AtomicComparer used for comparing atomic values of arbitrary item types.
GenericSorter Generically sorts arbitrary shaped data (for example multiple arrays, 1,2 or 3-d matrices, and so on) using a quicksort or mergesort.
GlobalOrderComparer A Comparer used for comparing nodes in document order.
GroupAdjacentIterator A GroupAdjacentIterator iterates over a sequence of groups defined by xsl:for-each-group group-adjacent="x".
GroupByIterator A GroupByIterator iterates over a sequence of groups defined by xsl:for-each-group group-by="x".
GroupBySingletonIterator A variant of the GroupByIterator used for XQuery 1.1 grouping, where the grouping key is either a single atomic value or an empty sequence, and an empty sequence compares equal to an empty sequence.
GroupEndingIterator A GroupEndingIterator iterates over a sequence of groups defined by xsl:for-each-group group-ending-with="x".
GroupStartingIterator A GroupStartingIterator iterates over a sequence of groups defined by xsl:for-each-group group-starting-with="x".
IntArraySet Set of int values.
IntHashMap<T> A hash table that maps int keys to Object values.
IntHashSet Set of int values.
IntRangeSet Set of int values.
IntSingletonSet An immutable integer set containing a single integer
IntToIntArrayMap An implementation of IntToIntMap that relies on serial searching, and is therefore optimized for very small map sizes
IntToIntHashMap A hash table that maps int keys to int values.
LocalOrderComparer A Comparer used for comparing nodes in document order.
LowercaseFirstCollator A StringCollator that sorts lowercase before uppercase.
LRUCache<K,V> An LRU cache, based on LinkedHashMap.
NamedCollation A StringCollator is used for comparing strings (Java String objects).
NumericComparer A Comparer used for comparing sort keys when data-type="number".
NumericComparer11 A Comparer used for comparing sort keys when data-type="number".
RuleBasedSubstringMatcher This class wraps a RuleBasedCollator to provide a SubstringMatcher.
SortedGroupIterator A SortedGroupIterator is a modified SortedIterator.
SortedIterator Class to do a sorted iteration
SortedTupleIterator A SortedTupleIterator is a modified SortedIterator.
SortExpression Expression equivalent to the imaginary syntax expr sortby (sort-key)+
SortKeyDefinition A SortKeyDefinition defines one component of a sort key.
TerminatedIntIterator An iterator over a sequence of integers held in an array.
TextComparer A Comparer used for comparing sort keys when data-type="text".
TupleExpression A tuple expression is an expression that returns a tuple.
TupleSorter A TupleSorter is an expression that sorts a stream of tuples.
TupleSorter.TupleUnwrapper Mapping function to map the wrapped objects returned by the SortedTupleIterator into real items.
UppercaseFirstCollator A Collator used for comparing strings, with upper case collated before lower case if the strings are otherwise equal.
 

Package net.sf.saxon.expr.sort Description

This package provides utility routines for sorting and grouping. Specifically, it contains a QuickSort implementation, and some AtomicComparer objects that handle character and numeric comparisons, together with the important DocumentOrderIterator which iterates over a set of nodes in document order.

The package also contains the classes to support the implementation of the XSLT 2.0 instruction xsl:for-each-group, and some utilities for maintaining sets and maps whose keys are unboxed integer values.


Michael H. Kay
Saxonica Limited
22 September 2005



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