Package net.sf.saxon.expr.sort
Class CaseFirstCollator
java.lang.Object
net.sf.saxon.expr.sort.CaseFirstCollator
- All Implemented Interfaces:
StringCollator
A StringCollator that sorts lowercase before uppercase, or vice versa.
Case is irrelevant, unless the strings are equal ignoring case, in which case lowercase comes first.
-
Constructor Summary
ConstructorsConstructorDescriptionCaseFirstCollator
(StringCollator base, boolean upperFirst, String collationURI) Create a CaseFirstCollator -
Method Summary
Modifier and TypeMethodDescriptionboolean
comparesEqual
(UnicodeString s1, UnicodeString s2) Compare two strings for equality.int
Compare two string objects: case is irrelevant, unless the strings are equal ignoring case, in which case lowercase comes first.Get a collation key for a String.Get the collation URI.static StringCollator
makeCaseOrderedCollator
(String uri, StringCollator stringCollator, String caseOrder) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.saxon.lib.StringCollator
isEqualToEmpty
-
Constructor Details
-
CaseFirstCollator
Create a CaseFirstCollator- Parameters:
base
- the base collator, which determines how characters are sorted irrespective of caseupperFirst
- true if uppercase precedes lowercase, false otherwisecollationURI
- the URI of the collation
-
-
Method Details
-
makeCaseOrderedCollator
public static StringCollator makeCaseOrderedCollator(String uri, StringCollator stringCollator, String caseOrder) throws XPathException - Throws:
XPathException
-
getCollationURI
Get the collation URI. It must be possible to use this collation URI to reconstitute the collation- Specified by:
getCollationURI
in interfaceStringCollator
- Returns:
- a collation URI that can be used to reconstruct the collation when an XSLT package is reloaded.
-
compareStrings
Compare two string objects: case is irrelevant, unless the strings are equal ignoring case, in which case lowercase comes first.- Specified by:
compareStrings
in interfaceStringCollator
- Parameters:
a
- the first stringb
- the second string- Returns:
- <0 if a<b, 0 if a=b, >0 if a>b
- Throws:
ClassCastException
- if the objects are of the wrong type for this Comparer
-
comparesEqual
Compare two strings for equality. This may be more efficient than using compareStrings and testing whether the result is zero, but it must give the same result- Specified by:
comparesEqual
in interfaceStringCollator
- Parameters:
s1
- the first strings2
- the second string- Returns:
- true if and only if the strings are considered equal,
-
getCollationKey
Get a collation key for a String. The essential property of collation keys is that if (and only if) two strings are equal under the collation, then comparing the collation keys using the equals() method must return true.- Specified by:
getCollationKey
in interfaceStringCollator
- Parameters:
s
- the string whose collation key is required- Returns:
- the collation key
-