net.sf.saxon.sort

Class UppercaseFirstCollator

Implemented Interfaces:
Serializable, StringCollator

public class UppercaseFirstCollator
extends java.lang.Object
implements StringCollator, java.io.Serializable

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:
Serialized Form

Constructor Summary

UppercaseFirstCollator(StringCollator base)
Create an UppercaseFirstCollator

Method Summary

int
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.
Object
getCollationKey(String s)
Get a collation key for two Strings.

Constructor Details

UppercaseFirstCollator

public UppercaseFirstCollator(StringCollator base)
Create an UppercaseFirstCollator
Parameters:
base - the base collator used to compare strings irrespective of case

Method Details

compareStrings

public int 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.
Specified by:
compareStrings in interface StringCollator
Returns:
<0 if a0 if a>b

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.
Specified by:
getCollationKey in interface StringCollator