Package net.sf.saxon.lib
Interface StringCollator
-
- All Superinterfaces:
java.io.Serializable
- All Known Subinterfaces:
SubstringMatcher
- All Known Implementing Classes:
AlphanumericCollator
,CaseFirstCollator
,CodepointCollator
,RuleBasedSubstringMatcher
,SimpleCollation
public interface StringCollator extends java.io.Serializable
This interface represents a "collation" as defined in XPath, that is, a set of rules for comparing stringsNote: an implementation of this interface that wraps a Java
RuleBasedCollator
is available: seeRuleBasedSubstringMatcher
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
comparesEqual(java.lang.String s1, java.lang.String s2)
Compare two strings for equality.int
compareStrings(java.lang.String o1, java.lang.String o2)
Compare two stringsjava.lang.Object
getCollationKey(java.lang.String s)
Get a collation key for a String.
-
-
-
Method Detail
-
compareStrings
int compareStrings(java.lang.String o1, java.lang.String o2)
Compare two strings- Parameters:
o1
- the first stringo2
- 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 second
-
comparesEqual
boolean comparesEqual(java.lang.String s1, java.lang.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 strings2
- the second string- Returns:
- true if and only if the strings are considered equal,
-
getCollationKey
java.lang.Object getCollationKey(java.lang.String s)
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
-
-