Package net.sf.saxon.sort
Class UppercaseFirstCollator
java.lang.Object
net.sf.saxon.sort.UppercaseFirstCollator
- All Implemented Interfaces:
Serializable
,StringCollator
A Collator used for comparing strings, with upper case collated before lower case
if the strings are otherwise equal. This is implemented as a wrapper around a collator
that compares the strings ignoring case.
- Author:
- Michael H. Kay
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an UppercaseFirstCollator -
Method Summary
Modifier and TypeMethodDescriptionint
compareStrings
(String a, String b) Compare two string objects: case is irrelevant, unless the strings are equal ignoring case, in which case uppercase comes first.Get a collation key for two Strings.
-
Constructor Details
-
UppercaseFirstCollator
Create an UppercaseFirstCollator- Parameters:
base
- the base collator used to compare strings irrespective of case
-
-
Method Details
-
compareStrings
Compare two string objects: case is irrelevant, unless the strings are equal ignoring case, in which case uppercase comes first.- Specified by:
compareStrings
in interfaceStringCollator
- Parameters:
a
- the first stringb
- the second string- Returns:
- invalid input: '<'0 if ainvalid input: '<'b, 0 if a=b, >0 if a>b
- Throws:
ClassCastException
- if the objects do not implement the CharSequence interface
-
getCollationKey
Get a collation key for two Strings. The essential property of collation keys is that if two values are equal under the collation, then the collation keys are compare correctly under the equals() method.- Specified by:
getCollationKey
in interfaceStringCollator
- Parameters:
s
- the string whose collation key is required- Returns:
- the collation key
-