2 *******************************************************************************
\r
3 * Copyright (C) 2008, International Business Machines Corporation and *
\r
4 * others. All Rights Reserved. *
\r
5 *******************************************************************************
\r
7 package com.ibm.icu.impl.jdkadapter;
\r
9 import com.ibm.icu.text.CollationKey;
\r
12 * CollationKeyICU is an adapter class which wraps ICU4J CollationKey and
\r
13 * implements java.text.CollationKey APIs.
\r
15 public class CollationKeyICU extends java.text.CollationKey {
\r
17 private CollationKey fIcuCollKey;
\r
19 private CollationKeyICU(CollationKey icuCollKey) {
\r
20 super(icuCollKey.getSourceString());
\r
21 fIcuCollKey = icuCollKey;
\r
24 public static java.text.CollationKey wrap(CollationKey icuCollKey) {
\r
25 return new CollationKeyICU(icuCollKey);
\r
28 public CollationKey unwrap() {
\r
33 public int compareTo(java.text.CollationKey target) {
\r
34 if (target instanceof CollationKeyICU) {
\r
35 return fIcuCollKey.compareTo(((CollationKeyICU)target).fIcuCollKey);
\r
41 public String getSourceString() {
\r
42 return fIcuCollKey.getSourceString();
\r
46 public byte[] toByteArray() {
\r
47 return fIcuCollKey.toByteArray();
\r
51 public boolean equals(Object obj) {
\r
52 if (obj instanceof CollationKeyICU) {
\r
53 return ((CollationKeyICU)obj).fIcuCollKey.equals(fIcuCollKey);
\r
59 public int hashCode() {
\r
60 return fIcuCollKey.hashCode();
\r