StringCollator (original) (raw)
All Known Subinterfaces:
[SubstringMatcher](SubstringMatcher.html "interface in net.sf.saxon.lib")
All Known Implementing Classes:
[AlphanumericCollator](../expr/sort/AlphanumericCollator.html "class in net.sf.saxon.expr.sort")
, [CaseFirstCollator](../expr/sort/CaseFirstCollator.html "class in net.sf.saxon.expr.sort")
, [CodepointCollator](../expr/sort/CodepointCollator.html "class in net.sf.saxon.expr.sort")
, [HTML5CaseBlindCollator](../expr/sort/HTML5CaseBlindCollator.html "class in net.sf.saxon.expr.sort")
, [RuleBasedSubstringMatcher](../expr/sort/RuleBasedSubstringMatcher.html "class in net.sf.saxon.expr.sort")
, [SimpleCollation](../expr/sort/SimpleCollation.html "class in net.sf.saxon.expr.sort")
, [UcaCollatorUsingIcu](../../../../com/saxonica/expr/sort/UcaCollatorUsingIcu.html "class in com.saxonica.expr.sort")
, [UcaCollatorUsingJava](../expr/sort/UcaCollatorUsingJava.html "class in net.sf.saxon.expr.sort")
public interface StringCollator
This interface represents a "collation" as defined in XPath, that is, a set of rules for comparing strings
Note: an implementation of this interface that wraps a Java RuleBasedCollator is available: see RuleBasedSubstringMatcher.
Method Summary
boolean
Compare two strings for equality.int
Get a collation key for a String.default boolean
Test if a supplied string compares equal to the empty string
Method Details
getCollationURI
Get the collation URI. It must be possible to use this collation URI to reconstitute the collation
Returns:
a collation URI that can be used to reconstruct the collation when an XSLT package is reloaded.compareStrings
Compare two strings
Parameters:
o1
- the first string
o2
- the second string
Returns:
0 if the strings are considered equal, a negative integer if the first string is less than the second, a positive integer if the first string is greater than the secondcomparesEqual
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,isEqualToEmpty
Test if a supplied string compares equal to the empty string
Parameters:
s1
- the supplied stringgetCollationKey
Get a collation key for a String. The essential property of collation keys is that if (and only if) two strings are equal under the collation, then comparing the collation keys using the equals() method must return true.
Parameters:
s
- the string whose collation key is required
Returns:
the collation key