com.ibm.icu4jni.text
Class CollationKey

java.lang.Object
  |
  +--com.ibm.icu4jni.text.CollationKey
All Implemented Interfaces:
java.lang.Comparable

public final class CollationKey
extends java.lang.Object
implements java.lang.Comparable

Collation key wrapper, containing the byte array sort key.

Status:
Stable ICU 2.4.

Method Summary
 int compareTo(CollationKey target)
          Bitwise comparison for the collation keys
 int compareTo(java.lang.Object target)
          Bitwise comparison for the collation keys.
 boolean equals(java.lang.Object target)
          Checks if target object is equal to this object.
 int hashCode()
          Creates a hash code for this CollationKey.
 byte[] toByteArray()
          Create the value of the Collation key in term of bytes
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

compareTo

public int compareTo(CollationKey target)
Bitwise comparison for the collation keys

Parameters:
target - CollationKey to be compared
Returns:
comparison result from Collator, RESULT_LESS, RESULT_EQUAL, RESULT_GREATER
Status:
Stable ICU 2.4.

compareTo

public int compareTo(java.lang.Object target)
Bitwise comparison for the collation keys. Argument is casted to CollationKey

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
target - CollationKey to be compared
Returns:
comparison result from Collator, RESULT_LESS, RESULT_EQUAL, RESULT_GREATER
Status:
Stable ICU 2.4.

equals

public boolean equals(java.lang.Object target)
Checks if target object is equal to this object. Target is first casted to CollationKey and bitwise compared.

Overrides:
equals in class java.lang.Object
Parameters:
target - comparison object
Returns:
true if both objects are equal, false otherwise
Status:
Stable ICU 2.4.

hashCode

public int hashCode()
Creates a hash code for this CollationKey. Compute the hash by iterating sparsely over about 32 (up to 63) bytes spaced evenly through the string. For each byte, multiply the previous hash value by a prime number and add the new byte in, like a linear congruential random number generator, producing a pseudorandom deterministic value well distributed over the output range.

Overrides:
hashCode in class java.lang.Object
Returns:
hash value of collation key. Hash value is never 0.
Status:
Stable ICU 2.4.

toByteArray

public byte[] toByteArray()
Create the value of the Collation key in term of bytes

Returns:
value of Collation key in bytes
Status:
Stable ICU 2.4.