1 10 11 package java.lang; 12 13 15 16 class CharacterData0E { 17 52 53 static int getProperties(int ch) { 54 char offset = (char)ch; 55 int props = A[Y[X[offset>>5]|((offset>>1)&0xF)]|(offset&0x1)]; 56 return props; 57 } 58 59 static int getType(int ch) { 60 int props = getProperties(ch); 61 return (props & 0x1F); 62 } 63 64 static boolean isLowerCase(int ch) { 65 int type = getType(ch); 66 return (type == Character.LOWERCASE_LETTER); 67 } 68 69 static boolean isUpperCase(int ch) { 70 int type = getType(ch); 71 return (type == Character.UPPERCASE_LETTER); 72 } 73 74 static boolean isTitleCase(int ch) { 75 int type = getType(ch); 76 return (type == Character.TITLECASE_LETTER); 77 } 78 79 static boolean isDigit(int ch) { 80 int type = getType(ch); 81 return (type == Character.DECIMAL_DIGIT_NUMBER); 82 } 83 84 static boolean isDefined(int ch) { 85 int type = getType(ch); 86 return (type != Character.UNASSIGNED); 87 } 88 89 static boolean isLetter(int ch) { 90 int type = getType(ch); 91 return (((((1 << Character.UPPERCASE_LETTER) | 92 (1 << Character.LOWERCASE_LETTER) | 93 (1 << Character.TITLECASE_LETTER) | 94 (1 << Character.MODIFIER_LETTER) | 95 (1 << Character.OTHER_LETTER)) >> type) & 1) != 0); 96 } 97 98 static boolean isLetterOrDigit(int ch) { 99 int type = getType(ch); 100 return (((((1 << Character.UPPERCASE_LETTER) | 101 (1 << Character.LOWERCASE_LETTER) | 102 (1 << Character.TITLECASE_LETTER) | 103 (1 << Character.MODIFIER_LETTER) | 104 (1 << Character.OTHER_LETTER) | 105 (1 << Character.DECIMAL_DIGIT_NUMBER)) >> type) & 1) != 0); 106 } 107 108 static boolean isSpaceChar(int ch) { 109 int type = getType(ch); 110 return (((((1 << Character.SPACE_SEPARATOR) | 111 (1 << Character.LINE_SEPARATOR) | 112 (1 << Character.PARAGRAPH_SEPARATOR)) 113 >> type) & 1) != 0); 114 } 115 116 117 static boolean isJavaIdentifierStart(int ch) { 118 int props = getProperties(ch); 119 return ((props & 0x00007000) >= 0x00005000); 120 } 121 122 static boolean isJavaIdentifierPart(int ch) { 123 int props = getProperties(ch); 124 return ((props & 0x00003000) != 0); 125 } 126 127 static boolean isUnicodeIdentifierStart(int ch) { 128 int props = getProperties(ch); 129 return ((props & 0x00007000) == 0x00007000); 130 } 131 132 static boolean isUnicodeIdentifierPart(int ch) { 133 int props = getProperties(ch); 134 return ((props & 0x00001000) != 0); 135 } 136 137 static boolean isIdentifierIgnorable(int ch) { 138 int props = getProperties(ch); 139 return ((props & 0x00007000) == 0x00001000); 140 } 141 142 static int toLowerCase(int ch) { 143 int mapChar = ch; 144 int val = getProperties(ch); 145 146 if ((val & 0x00020000) != 0) { 147 int offset = val << 5 >> (5+18); 148 mapChar = ch + offset; 149 } 150 return mapChar; 151 } 152 153 static int toUpperCase(int ch) { 154 int mapChar = ch; 155 int val = getProperties(ch); 156 157 if ((val & 0x00010000) != 0) { 158 int offset = val << 5 >> (5+18); 159 mapChar = ch - offset; 160 } 161 return mapChar; 162 } 163 164 static int toTitleCase(int ch) { 165 int mapChar = ch; 166 int val = getProperties(ch); 167 168 if ((val & 0x00008000) != 0) { 169 if ((val & 0x00010000) == 0) { 171 mapChar = ch + 1; 174 } 175 else if ((val & 0x00020000) == 0) { 176 mapChar = ch - 1; 179 } 180 } 186 else if ((val & 0x00010000) != 0) { 187 mapChar = toUpperCase(ch); 190 } 191 return mapChar; 192 } 193 194 static int digit(int ch, int radix) { 195 int value = -1; 196 if (radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) { 197 int val = getProperties(ch); 198 int kind = val & 0x1F; 199 if (kind == Character.DECIMAL_DIGIT_NUMBER) { 200 value = ch + ((val & 0x3E0) >> 5) & 0x1F; 201 } 202 else if ((val & 0xC00) == 0x00000C00) { 203 value = (ch + ((val & 0x3E0) >> 5) & 0x1F) + 10; 205 } 206 } 207 return (value < radix) ? value : -1; 208 } 209 210 static int getNumericValue(int ch) { 211 int val = getProperties(ch); 212 int retval = -1; 213 214 switch (val & 0xC00) { 215 default: case (0x00000000): retval = -1; 218 break; 219 case (0x00000400): retval = ch + ((val & 0x3E0) >> 5) & 0x1F; 221 break; 222 case (0x00000800) : retval = -2; 224 break; 225 case (0x00000C00): retval = (ch + ((val & 0x3E0) >> 5) & 0x1F) + 10; 227 break; 228 } 229 return retval; 230 } 231 232 static boolean isWhitespace(int ch) { 233 int props = getProperties(ch); 234 return ((props & 0x00007000) == 0x00004000); 235 } 236 237 static byte getDirectionality(int ch) { 238 int val = getProperties(ch); 239 byte directionality = (byte)((val & 0x78000000) >> 27); 240 if (directionality == 0xF ) { 241 directionality = Character.DIRECTIONALITY_UNDEFINED; 242 } 243 return directionality; 244 } 245 246 static boolean isMirrored(int ch) { 247 int props = getProperties(ch); 248 return ((props & 0x80000000) != 0); 249 } 250 251 255 259 static final char X[] = ( 260 "\000\020\020\020\040\040\040\040\060\060\060\060\060\060\060\100\040\040\040"+ 261 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 262 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 263 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 264 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 265 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 266 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 267 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 268 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 269 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 270 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 271 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 272 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 273 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 274 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 275 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 276 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 277 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 278 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 279 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 280 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 281 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 282 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 283 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 284 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 285 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 286 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 287 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 288 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 289 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 290 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 291 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 292 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 293 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 294 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 295 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 296 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 297 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 298 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 299 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 300 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 301 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 302 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 303 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 304 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 305 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 306 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 307 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 308 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 309 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 310 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 311 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 312 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 313 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 314 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 315 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 316 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 317 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 318 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 319 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 320 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 321 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 322 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 323 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 324 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 325 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 326 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 327 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 328 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 329 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 330 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 331 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 332 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 333 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 334 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 335 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 336 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 337 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 338 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 339 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 340 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 341 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 342 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 343 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 344 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 345 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 346 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 347 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 348 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 349 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 350 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 351 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 352 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 353 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 354 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 355 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 356 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 357 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 358 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 359 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 360 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 361 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 362 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 363 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 364 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 365 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 366 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040"+ 367 "\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040").toCharArray(); 368 369 371 static final char Y[] = ( 372 "\000\002\002\002\002\002\002\002\002\002\002\002\002\002\002\002\004\004\004"+ 373 "\004\004\004\004\004\004\004\004\004\004\004\004\004\002\002\002\002\002\002"+ 374 "\002\002\002\002\002\002\002\002\002\002\006\006\006\006\006\006\006\006\006"+ 375 "\006\006\006\006\006\006\006\006\006\006\006\006\006\006\006\002\002\002\002"+ 376 "\002\002\002\002").toCharArray(); 377 378 380 static final int A[] = new int[8]; 381 static final String A_DATA = 382 "\u7800\000\u4800\u1010\u7800\000\u7800\000\u4800\u1010\u4800\u1010\u4000\u3006"+ 383 "\u4000\u3006"; 384 385 387 static { 388 { char[] data = A_DATA.toCharArray(); 390 assert (data.length == (8 * 2)); 391 int i = 0, j = 0; 392 while (i < (8 * 2)) { 393 int entry = data[i++] << 16; 394 A[j++] = entry | data[i++]; 395 } 396 } 397 398 } 399 } 400 | Popular Tags |