net.sf.saxon.sort

Class LowercaseFirstCollator

public class LowercaseFirstCollator extends Object implements StringCollator, Serializable

A StringCollator that sorts lowercase before uppercase.

Case is irrelevant, unless the strings are equal ignoring case, in which case lowercase comes first.

Author: Michael H. Kay

Constructor Summary
LowercaseFirstCollator(StringCollator base)
Create a LowercaseFirstCollator
Method Summary
booleancomparesEqual(String s1, String s2)
Compare two strings for equality.
intcompareStrings(String a, String b)
Compare two string objects: case is irrelevant, unless the strings are equal ignoring case, in which case lowercase comes first.
ObjectgetCollationKey(String s)
Get a collation key for two Strings.

Constructor Detail

LowercaseFirstCollator

public LowercaseFirstCollator(StringCollator base)
Create a LowercaseFirstCollator

Parameters: base the base collator, which determines how characters are sorted irrespective of case

Method Detail

comparesEqual

public boolean comparesEqual(String s1, String s2)
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

Parameters: s1 the first string s2 the second string

Returns: true if and only if the strings are considered equal,

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 lowercase comes first.

Returns: <0 if a0 if a>b

Throws: ClassCastException if the objects are of the wrong type for this Comparer

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.