| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.expr.sort; |
| 9 |
|
| 10 |
import net.sf.saxon.regex.UnicodeString; |
| 11 |
import net.sf.saxon.value.AtomicValue; |
| 12 |
import net.sf.saxon.value.Base64BinaryValue; |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
public class CodepointMatchKey implements Comparable<CodepointMatchKey>, AtomicMatchKey { |
| 18 |
|
| 19 |
private UnicodeString value; |
| 20 |
|
| 21 |
public CodepointMatchKey(CharSequence in) { |
| 22 |
value = UnicodeString.makeUnicodeString(in); |
| 23 |
} |
| 24 |
|
| 25 |
public UnicodeString getValue() { |
| 26 |
return value; |
| 27 |
} |
| 28 |
|
| 29 |
public int compareTo(CodepointMatchKey o) { |
| 30 |
return value.compareTo(o.value); |
| 31 |
} |
| 32 |
|
| 33 |
@Override |
| 34 |
public int hashCode() { |
| 35 |
return value.hashCode(); |
| 36 |
} |
| 37 |
|
| 38 |
@Override |
| 39 |
public boolean equals(Object o) { |
| 40 |
return this == o || (o instanceof CodepointMatchKey && compareTo((CodepointMatchKey)o) == 0); |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public AtomicValue asAtomic() { |
| 49 |
return new Base64BinaryValue(value.getCodepointCollationKey()); |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
|