Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 7 8 20 21 package java.text; 22 23 82 83 public final class CollationKey implements Comparable <CollationKey > { 84 94 public int compareTo(CollationKey target) 95 { 96 int result = key.compareTo(target.key); 97 if (result <= Collator.LESS) 98 return Collator.LESS; 99 else if (result >= Collator.GREATER) 100 return Collator.GREATER; 101 return Collator.EQUAL; 102 } 103 104 112 public boolean equals(Object target) { 113 if (this == target) return true; 114 if (target == null || !getClass().equals(target.getClass())) { 115 return false; 116 } 117 CollationKey other = (CollationKey )target; 118 return key.equals(other.key); 119 } 120 121 129 public int hashCode() { 130 return (key.hashCode()); 131 } 132 133 134 137 public String getSourceString() { 138 return source; 139 } 140 141 142 148 public byte[] toByteArray() { 149 150 char[] src = key.toCharArray(); 151 byte[] dest = new byte[ 2*src.length ]; 152 int j = 0; 153 for( int i=0; i<src.length; i++ ) { 154 dest[j++] = (byte)(src[i] >>> 8); 155 dest[j++] = (byte)(src[i] & 0x00ff); 156 } 157 return dest; 158 } 159 160 163 CollationKey(String source, String key) { 164 this.source = source; 165 this.key = key; 166 } 167 168 private String source = null; 169 private String key = null; 170 } 171 172 173 174
| Popular Tags
|