Package net.sf.saxon.sort
Class NamedCollation
java.lang.Object
net.sf.saxon.sort.NamedCollation
- All Implemented Interfaces:
Serializable
,StringCollator
A StringCollator is used for comparing strings (Java String objects).
The URI is retained along with the collation so that the collation can
be reconstructed on demand, typically at run-time by compiled code which has access to the
URI but not the collation object itself.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compareStrings
(String o1, String o2) Compares its two arguments for order.Get the underlying comparatorGet a collation key for two Strings.getUri()
Get the URI identifying the collationvoid
setCollation
(Comparator collation) Set the underlying comparatorvoid
Set the URI identifying the collation
-
Constructor Details
-
NamedCollation
Create a NamedCollation- Parameters:
uri
- the name of the collationcollation
- the Comparator that does the actual string comparison
-
-
Method Details
-
compareStrings
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.- Specified by:
compareStrings
in interfaceStringCollator
- Parameters:
o1
- the first object to be compared.o2
- the second object to be compared.- Returns:
- a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
- Throws:
ClassCastException
- if the arguments' types prevent them from being compared by this Comparator.
-
getUri
Get the URI identifying the collation -
setUri
Set the URI identifying the collation- Parameters:
uri
- the collation URI
-
getCollation
Get the underlying comparator- Returns:
- the underlying comparator
-
setCollation
Set the underlying comparator- Parameters:
collation
- the underlying comparator
-
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
-