net.sf.saxon.sort
Class NamedCollation
java.lang.Object
net.sf.saxon.sort.NamedCollation
- Serializable, StringCollator
public class NamedCollation
extends java.lang.Object
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.
NamedCollation(String uri, Comparator collation) - Create a NamedCollation
|
int | compareStrings(String o1, String o2) - Compares its two arguments for order.
|
Comparator | getCollation() - Get the underlying comparator
|
Object | getCollationKey(String s) - Get a collation key for two Strings.
|
String | getUri() - Get the URI identifying the collation
|
void | setCollation(Comparator collation) - Set the underlying comparator
|
void | setUri(String uri) - Set the URI identifying the collation
|
NamedCollation
public NamedCollation(String uri,
Comparator collation)
Create a NamedCollation
uri
- the name of the collationcollation
- the Comparator that does the actual string comparison
compareStrings
public int compareStrings(String o1,
String o2)
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.
- compareStrings in interface StringCollator
o1
- the first object to be compared.o2
- the second object to be compared.
- a negative integer, zero, or a positive integer as the
first argument is less than, equal to, or greater than the
second.
getCollation
public Comparator getCollation()
Get the underlying comparator
- the underlying comparator
getCollationKey
public Object getCollationKey(String s)
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.
- getCollationKey in interface StringCollator
getUri
public String getUri()
Get the URI identifying the collation
setCollation
public void setCollation(Comparator collation)
Set the underlying comparator
collation
- the underlying comparator
setUri
public void setUri(String uri)
Set the URI identifying the collation