38 |
|
|
39 |
package java.lang; |
package java.lang; |
40 |
|
|
41 |
import java.util.*; |
import java.io.Serializable; |
42 |
import java.io.*; |
import java.io.File; |
43 |
|
import java.io.DataInputStream; |
44 |
|
import java.io.FileInputStream; |
45 |
|
import java.io.RandomAccessFile; |
46 |
|
import java.io.IOException; |
47 |
import gnu.java.lang.ClassLoaderHelper; |
import gnu.java.lang.ClassLoaderHelper; |
48 |
|
|
49 |
/** |
/** |
50 |
* Wrapper class for the primitive char data type. In addition, |
* Wrapper class for the primitive char data type. In addition, |
51 |
* this class allows one to retrieve property information and |
* this class allows one to retrieve property information and |
52 |
* perform transformations on the 38,000+ characters in the |
* perform transformations on the 57,707 defined characters in the |
53 |
* Unicode Standard, Version 2. java.lang.Character is designed |
* Unicode Standard, Version 3.0.0. java.lang.Character is designed |
54 |
* to be very dynamic, and as such, it retrieves information on |
* to be very dynamic, and as such, it retrieves information on |
55 |
* the Unicode character set from a separate database, which |
* the Unicode character set from a separate database, which |
56 |
* can be easily upgraded. |
* can be easily upgraded. |
58 |
* <p>For predicates, boundaries are used to describe |
* <p>For predicates, boundaries are used to describe |
59 |
* the set of characters for which the method will return true. |
* the set of characters for which the method will return true. |
60 |
* This syntax uses fairly normal regular expression notation. |
* This syntax uses fairly normal regular expression notation. |
61 |
* See 5.13 of the Unicode Standard, Version 2.0, for the |
* See 5.13 of the Unicode Standard, Version 3.0, for the |
62 |
* boundary specification. |
* boundary specification. |
63 |
* |
* |
|
* <p><b>TODO: Update this class to Unicode Standard Version 3.0</b> |
|
|
* |
|
64 |
* <p>See <a href="http://www.unicode.org">http://www.unicode.org</a> |
* <p>See <a href="http://www.unicode.org">http://www.unicode.org</a> |
65 |
* for more information on the Unicode Standard. |
* for more information on the Unicode Standard. |
66 |
* |
* |
71 |
public final class Character implements Serializable, Comparable |
public final class Character implements Serializable, Comparable |
72 |
{ |
{ |
73 |
/** |
/** |
74 |
* Constants to define subsets of the Unicode standard. |
* A subset of Unicode blocks. |
|
* All character blocks are part of the Unicode 2 standard, unless |
|
|
* otherwise noted. |
|
75 |
* |
* |
76 |
* @author Paul N. Fisher |
* @author Paul N. Fisher |
77 |
* @author Eric Blake <ebb9@email.byu.edu> |
* @author Eric Blake <ebb9@email.byu.edu> |
79 |
*/ |
*/ |
80 |
public static class Subset |
public static class Subset |
81 |
{ |
{ |
82 |
|
/** The name of the subset. */ |
83 |
|
private final String name; |
84 |
|
|
85 |
/** |
/** |
86 |
* The start of the subset. |
* Construct a new subset of characters. |
87 |
|
* |
88 |
|
* @param name the name of the subset |
89 |
|
* @throws NullPointerException if name is null |
90 |
*/ |
*/ |
91 |
private char start; |
protected Subset(String name) |
92 |
|
{ |
93 |
|
this.name = name.toString(); |
94 |
|
} |
95 |
|
|
96 |
/** |
/** |
97 |
* The end of the subset. |
* Compares two Subsets for equality. This is <code>final</code>, and |
98 |
|
* restricts the comparison on the <code>==</code> operator, so it returns |
99 |
|
* true only for the same object. |
100 |
|
* |
101 |
|
* @param o the object to compare |
102 |
|
* @return true if o is this |
103 |
*/ |
*/ |
104 |
private char end; |
public final boolean equals(Object o) |
105 |
|
{ |
106 |
|
return o == this; |
107 |
|
} |
108 |
|
|
109 |
/** |
/** |
110 |
* The number of defined subsets. |
* Makes the original hashCode of Object final, to be consistent with |
111 |
|
* equals. |
112 |
|
* |
113 |
|
* @return the hash code for this object |
114 |
*/ |
*/ |
115 |
private static final int NUM_SUBSETS = 66; |
public final int hashCode() |
116 |
|
{ |
117 |
|
return super.hashCode(); |
118 |
|
} |
119 |
|
|
120 |
/** |
/** |
121 |
* The defined subsets. |
* Returns the name of the subset. |
122 |
|
* |
123 |
|
* @return the name |
124 |
*/ |
*/ |
125 |
private static final Subset sets[] = new Subset[NUM_SUBSETS]; |
public final String toString() |
126 |
|
{ |
127 |
|
return name; |
128 |
|
} |
129 |
|
} // class Subset |
130 |
|
|
131 |
|
/** |
132 |
|
* A family of character subsets in the Unicode specification. A character |
133 |
|
* is in at most one of these blocks. |
134 |
|
* |
135 |
|
* This class was generated by doc/unicode/unicode-blocks.pl. |
136 |
|
* |
137 |
|
* @since 1.2 |
138 |
|
*/ |
139 |
|
public static final class UnicodeBlock extends Subset |
140 |
|
{ |
141 |
|
/** The start of the subset. */ |
142 |
|
private final char start; |
143 |
|
|
144 |
|
/** The end of the subset. */ |
145 |
|
private final char end; |
146 |
|
|
147 |
|
/** |
148 |
|
* Constructor for strictly defined blocks. |
149 |
|
* |
150 |
|
* @param start the start character of the range |
151 |
|
* @param end the end character of the range |
152 |
|
* @param name the block name |
153 |
|
*/ |
154 |
|
private UnicodeBlock(char start, char end, String name) |
155 |
|
{ |
156 |
|
super(name); |
157 |
|
this.start = start; |
158 |
|
this.end = end; |
159 |
|
} |
160 |
|
|
161 |
/** |
/** |
162 |
* Returns the Unicode character block which a character belongs to. |
* Returns the Unicode character block which a character belongs to. |
163 |
* |
* |
164 |
* @param ch the character to look up |
* @param ch the character to look up |
165 |
* @return the set it belongs to, or null |
* @return the set it belongs to, or null if it is not in one |
166 |
*/ |
*/ |
167 |
private static Subset getBlock(char ch) |
public static UnicodeBlock of(char ch) |
168 |
{ |
{ |
169 |
// do a simple binary search for the correct block |
// Special case, since SPECIALS contains two ranges. |
170 |
|
if (ch == '\uFEFF') |
171 |
|
return SPECIALS; |
172 |
|
// Simple binary search for the correct block. |
173 |
int low = 0; |
int low = 0; |
174 |
int hi = sets.length - 1; |
int hi = sets.length - 1; |
|
int mid = 0; |
|
175 |
while (low <= hi) |
while (low <= hi) |
176 |
{ |
{ |
177 |
mid = (low + hi) >> 1; |
int mid = (low + hi) >> 1; |
178 |
Subset b = sets[mid]; |
UnicodeBlock b = sets[mid]; |
179 |
if (ch < b.start) |
if (ch < b.start) |
180 |
hi = mid - 1; |
hi = mid - 1; |
181 |
else if (ch > b.end) |
else if (ch > b.end) |
187 |
} |
} |
188 |
|
|
189 |
/** |
/** |
190 |
* Constructor for strictly defined normative blocks. |
* Basic Latin. |
191 |
* |
* '\u0000' - '\u007F'. |
|
* @param num the position of this set |
|
|
* @param start the start character of the range |
|
|
* @param end the end character of the range |
|
192 |
*/ |
*/ |
193 |
private Subset(int num, char start, char end) |
public final static UnicodeBlock BASIC_LATIN |
194 |
{ |
= new UnicodeBlock('\u0000', '\u007F', |
195 |
this.start = start; |
"BASIC_LATIN"); |
|
this.end = end; |
|
|
sets[num] = this; |
|
|
} |
|
196 |
|
|
197 |
/** |
/** |
198 |
* Constructor for strictly defined blocks. |
* Latin-1 Supplement. |
199 |
* |
* '\u0080' - '\u00FF'. |
|
* @param start the start character of the range |
|
|
* @param end the end character of the range |
|
200 |
*/ |
*/ |
201 |
private Subset(char start, char end) |
public final static UnicodeBlock LATIN_1_SUPPLEMENT |
202 |
{ |
= new UnicodeBlock('\u0080', '\u00FF', |
203 |
this.start = start; |
"LATIN_1_SUPPLEMENT"); |
|
this.end = end; |
|
|
} |
|
204 |
|
|
205 |
/** |
/** |
206 |
* Constructor for loosely defined CJK blocks |
* Latin Extended-A. |
207 |
|
* '\u0100' - '\u017F'. |
208 |
*/ |
*/ |
209 |
private Subset() { } |
public final static UnicodeBlock LATIN_EXTENDED_A |
210 |
|
= new UnicodeBlock('\u0100', '\u017F', |
211 |
|
"LATIN_EXTENDED_A"); |
212 |
|
|
213 |
/** |
/** |
214 |
* U+0000 - U+007F. |
* Latin Extended-B. |
215 |
|
* '\u0180' - '\u024F'. |
216 |
*/ |
*/ |
217 |
public final static Subset BASIC_LATIN |
public final static UnicodeBlock LATIN_EXTENDED_B |
218 |
= new Subset(0, '\u0000', '\u007F'); |
= new UnicodeBlock('\u0180', '\u024F', |
219 |
|
"LATIN_EXTENDED_B"); |
220 |
|
|
221 |
/** |
/** |
222 |
* U+0080 - U+00FF. |
* IPA Extensions. |
223 |
|
* '\u0250' - '\u02AF'. |
224 |
*/ |
*/ |
225 |
public final static Subset LATIN_1_SUPPLEMENT |
public final static UnicodeBlock IPA_EXTENSIONS |
226 |
= new Subset(1, '\u0080', '\u00FF'); |
= new UnicodeBlock('\u0250', '\u02AF', |
227 |
|
"IPA_EXTENSIONS"); |
228 |
|
|
229 |
/** |
/** |
230 |
* U+0100 - U+017F. |
* Spacing Modifier Letters. |
231 |
|
* '\u02B0' - '\u02FF'. |
232 |
*/ |
*/ |
233 |
public final static Subset LATIN_EXTENDED_A |
public final static UnicodeBlock SPACING_MODIFIER_LETTERS |
234 |
= new Subset(2, '\u0100', '\u017F'); |
= new UnicodeBlock('\u02B0', '\u02FF', |
235 |
|
"SPACING_MODIFIER_LETTERS"); |
236 |
|
|
237 |
/** |
/** |
238 |
* U+0180 - U+024F. |
* Combining Diacritical Marks. |
239 |
|
* '\u0300' - '\u036F'. |
240 |
*/ |
*/ |
241 |
public final static Subset LATIN_EXTENDED_B |
public final static UnicodeBlock COMBINING_DIACRITICAL_MARKS |
242 |
= new Subset(3, '\u0180', '\u024F'); |
= new UnicodeBlock('\u0300', '\u036F', |
243 |
|
"COMBINING_DIACRITICAL_MARKS"); |
244 |
|
|
245 |
/** |
/** |
246 |
* U+0250 - U+02AF. |
* Greek. |
247 |
|
* '\u0370' - '\u03FF'. |
248 |
*/ |
*/ |
249 |
public final static Subset IPA_EXTENSIONS |
public final static UnicodeBlock GREEK |
250 |
= new Subset(4,'\u0250', '\u02AF'); |
= new UnicodeBlock('\u0370', '\u03FF', |
251 |
|
"GREEK"); |
252 |
|
|
253 |
/** |
/** |
254 |
* U+02B0 - U+02FF. |
* Cyrillic. |
255 |
|
* '\u0400' - '\u04FF'. |
256 |
*/ |
*/ |
257 |
public final static Subset SPACING_MODIFIER_LETTERS |
public final static UnicodeBlock CYRILLIC |
258 |
= new Subset(5, '\u02B0', '\u02FF'); |
= new UnicodeBlock('\u0400', '\u04FF', |
259 |
|
"CYRILLIC"); |
260 |
|
|
261 |
/** |
/** |
262 |
* U+0300 - U+036F. |
* Armenian. |
263 |
|
* '\u0530' - '\u058F'. |
264 |
*/ |
*/ |
265 |
public final static Subset COMBINING_DIACRITICAL_MARKS |
public final static UnicodeBlock ARMENIAN |
266 |
= new Subset(6, '\u0300', '\u036F'); |
= new UnicodeBlock('\u0530', '\u058F', |
267 |
|
"ARMENIAN"); |
268 |
|
|
269 |
/** |
/** |
270 |
* U+0370 - U+03FF. |
* Hebrew. |
271 |
|
* '\u0590' - '\u05FF'. |
272 |
*/ |
*/ |
273 |
public final static Subset GREEK |
public final static UnicodeBlock HEBREW |
274 |
= new Subset(7, '\u0370', '\u03FF'); |
= new UnicodeBlock('\u0590', '\u05FF', |
275 |
|
"HEBREW"); |
276 |
|
|
277 |
/** |
/** |
278 |
* U+0400 - U+04FF. |
* Arabic. |
279 |
|
* '\u0600' - '\u06FF'. |
280 |
*/ |
*/ |
281 |
public final static Subset CYRILLIC |
public final static UnicodeBlock ARABIC |
282 |
= new Subset(8, '\u0400', '\u04FF'); |
= new UnicodeBlock('\u0600', '\u06FF', |
283 |
|
"ARABIC"); |
284 |
|
|
285 |
/** |
/** |
286 |
* U+0530 - U+058F. |
* Syriac. |
287 |
|
* '\u0700' - '\u074F'. |
288 |
|
* @since 1.4 |
289 |
*/ |
*/ |
290 |
public final static Subset ARMENIAN |
public final static UnicodeBlock SYRIAC |
291 |
= new Subset(9, '\u0530', '\u058F'); |
= new UnicodeBlock('\u0700', '\u074F', |
292 |
|
"SYRIAC"); |
293 |
|
|
294 |
/** |
/** |
295 |
* U+0590 - U+05FF. |
* Thaana. |
296 |
|
* '\u0780' - '\u07BF'. |
297 |
|
* @since 1.4 |
298 |
*/ |
*/ |
299 |
public final static Subset HEBREW |
public final static UnicodeBlock THAANA |
300 |
= new Subset(10, '\u0590', '\u05FF'); |
= new UnicodeBlock('\u0780', '\u07BF', |
301 |
|
"THAANA"); |
302 |
|
|
303 |
/** |
/** |
304 |
* U+0600 - U+06FF. |
* Devanagari. |
305 |
|
* '\u0900' - '\u097F'. |
306 |
*/ |
*/ |
307 |
public final static Subset ARABIC |
public final static UnicodeBlock DEVANAGARI |
308 |
= new Subset(11, '\u0600', '\u06FF'); |
= new UnicodeBlock('\u0900', '\u097F', |
309 |
|
"DEVANAGARI"); |
310 |
|
|
311 |
/** |
/** |
312 |
* U+0900 - U+097F. |
* Bengali. |
313 |
|
* '\u0980' - '\u09FF'. |
314 |
*/ |
*/ |
315 |
public final static Subset DEVANAGARI |
public final static UnicodeBlock BENGALI |
316 |
= new Subset(12, '\u0900', '\u097F'); |
= new UnicodeBlock('\u0980', '\u09FF', |
317 |
|
"BENGALI"); |
318 |
|
|
319 |
/** |
/** |
320 |
* U+0980 - U+09FF. |
* Gurmukhi. |
321 |
|
* '\u0A00' - '\u0A7F'. |
322 |
*/ |
*/ |
323 |
public final static Subset BENGALI |
public final static UnicodeBlock GURMUKHI |
324 |
= new Subset(13, '\u0980', '\u09FF'); |
= new UnicodeBlock('\u0A00', '\u0A7F', |
325 |
|
"GURMUKHI"); |
326 |
|
|
327 |
/** |
/** |
328 |
* U+0A00 - U+0A7F. |
* Gujarati. |
329 |
|
* '\u0A80' - '\u0AFF'. |
330 |
*/ |
*/ |
331 |
public final static Subset GURMUKHI |
public final static UnicodeBlock GUJARATI |
332 |
= new Subset(14, '\u0A00', '\u0A7F'); |
= new UnicodeBlock('\u0A80', '\u0AFF', |
333 |
|
"GUJARATI"); |
334 |
|
|
335 |
/** |
/** |
336 |
* U+0A80 - U+0AFF. |
* Oriya. |
337 |
|
* '\u0B00' - '\u0B7F'. |
338 |
*/ |
*/ |
339 |
public final static Subset GUJARATI |
public final static UnicodeBlock ORIYA |
340 |
= new Subset(15, '\u0A80', '\u0AFF'); |
= new UnicodeBlock('\u0B00', '\u0B7F', |
341 |
|
"ORIYA"); |
342 |
|
|
343 |
/** |
/** |
344 |
* U+0B00 - U+0B7F. |
* Tamil. |
345 |
|
* '\u0B80' - '\u0BFF'. |
346 |
*/ |
*/ |
347 |
public final static Subset ORIYA |
public final static UnicodeBlock TAMIL |
348 |
= new Subset(16, '\u0B00', '\u0B7F'); |
= new UnicodeBlock('\u0B80', '\u0BFF', |
349 |
|
"TAMIL"); |
350 |
|
|
351 |
/** |
/** |
352 |
* U+0B80 - U+0BFF. |
* Telugu. |
353 |
|
* '\u0C00' - '\u0C7F'. |
354 |
*/ |
*/ |
355 |
public final static Subset TAMIL |
public final static UnicodeBlock TELUGU |
356 |
= new Subset(17, '\u0B80', '\u0BFF'); |
= new UnicodeBlock('\u0C00', '\u0C7F', |
357 |
|
"TELUGU"); |
358 |
|
|
359 |
/** |
/** |
360 |
* U+0C00 - U+0C7F. |
* Kannada. |
361 |
|
* '\u0C80' - '\u0CFF'. |
362 |
*/ |
*/ |
363 |
public final static Subset TELUGU |
public final static UnicodeBlock KANNADA |
364 |
= new Subset(18, '\u0C00', '\u0C7F'); |
= new UnicodeBlock('\u0C80', '\u0CFF', |
365 |
|
"KANNADA"); |
366 |
|
|
367 |
/** |
/** |
368 |
* U+0C80 - U+0CFF. |
* Malayalam. |
369 |
|
* '\u0D00' - '\u0D7F'. |
370 |
*/ |
*/ |
371 |
public final static Subset KANNADA |
public final static UnicodeBlock MALAYALAM |
372 |
= new Subset(19, '\u0C80', '\u0CFF'); |
= new UnicodeBlock('\u0D00', '\u0D7F', |
373 |
|
"MALAYALAM"); |
374 |
|
|
375 |
/** |
/** |
376 |
* U+0D00 - U+0D7F. |
* Sinhala. |
377 |
|
* '\u0D80' - '\u0DFF'. |
378 |
|
* @since 1.4 |
379 |
*/ |
*/ |
380 |
public final static Subset MALAYALAM |
public final static UnicodeBlock SINHALA |
381 |
= new Subset(20, '\u0D00', '\u0D7F'); |
= new UnicodeBlock('\u0D80', '\u0DFF', |
382 |
|
"SINHALA"); |
383 |
|
|
384 |
/** |
/** |
385 |
* U+0E00 - U+0E7F. |
* Thai. |
386 |
|
* '\u0E00' - '\u0E7F'. |
387 |
*/ |
*/ |
388 |
public final static Subset THAI |
public final static UnicodeBlock THAI |
389 |
= new Subset(21, '\u0E00', '\u0E7F'); |
= new UnicodeBlock('\u0E00', '\u0E7F', |
390 |
|
"THAI"); |
391 |
|
|
392 |
/** |
/** |
393 |
* U+0E80 - U+0EFF. |
* Lao. |
394 |
|
* '\u0E80' - '\u0EFF'. |
395 |
*/ |
*/ |
396 |
public final static Subset LAO |
public final static UnicodeBlock LAO |
397 |
= new Subset(22, '\u0E80', '\u0EFF'); |
= new UnicodeBlock('\u0E80', '\u0EFF', |
398 |
|
"LAO"); |
399 |
|
|
400 |
/** |
/** |
401 |
* U+0F00 - U+0FBF. |
* Tibetan. |
402 |
|
* '\u0F00' - '\u0FFF'. |
403 |
*/ |
*/ |
404 |
public final static Subset TIBETAN |
public final static UnicodeBlock TIBETAN |
405 |
= new Subset(23, '\u0F00', '\u0FBF'); |
= new UnicodeBlock('\u0F00', '\u0FFF', |
406 |
|
"TIBETAN"); |
407 |
|
|
408 |
/** |
/** |
409 |
* U+10A0 - U+10FF. |
* Myanmar. |
410 |
|
* '\u1000' - '\u109F'. |
411 |
|
* @since 1.4 |
412 |
*/ |
*/ |
413 |
public final static Subset GEORGIAN |
public final static UnicodeBlock MYANMAR |
414 |
= new Subset(24, '\u10A0', '\u10FF'); |
= new UnicodeBlock('\u1000', '\u109F', |
415 |
|
"MYANMAR"); |
416 |
|
|
417 |
/** |
/** |
418 |
* U+1100 - U+11FF. |
* Georgian. |
419 |
|
* '\u10A0' - '\u10FF'. |
420 |
*/ |
*/ |
421 |
public final static Subset HANGUL_JAMO |
public final static UnicodeBlock GEORGIAN |
422 |
= new Subset(25, '\u1100', '\u11FF'); |
= new UnicodeBlock('\u10A0', '\u10FF', |
423 |
|
"GEORGIAN"); |
424 |
|
|
425 |
/** |
/** |
426 |
* U+1E00 - U+1EFF. |
* Hangul Jamo. |
427 |
|
* '\u1100' - '\u11FF'. |
428 |
*/ |
*/ |
429 |
public final static Subset LATIN_EXTENDED_ADDITIONAL |
public final static UnicodeBlock HANGUL_JAMO |
430 |
= new Subset(26, '\u1E00', '\u1EFF'); |
= new UnicodeBlock('\u1100', '\u11FF', |
431 |
|
"HANGUL_JAMO"); |
432 |
|
|
433 |
/** |
/** |
434 |
* U+1F00 - U+1FFF. |
* Ethiopic. |
435 |
|
* '\u1200' - '\u137F'. |
436 |
|
* @since 1.4 |
437 |
*/ |
*/ |
438 |
public final static Subset GREEK_EXTENDED |
public final static UnicodeBlock ETHIOPIC |
439 |
= new Subset(27, '\u1F00', '\u1FFF'); |
= new UnicodeBlock('\u1200', '\u137F', |
440 |
|
"ETHIOPIC"); |
441 |
|
|
442 |
/** |
/** |
443 |
* U+2000 - U+206F. |
* Cherokee. |
444 |
|
* '\u13A0' - '\u13FF'. |
445 |
|
* @since 1.4 |
446 |
*/ |
*/ |
447 |
public final static Subset GENERAL_PUNCTUATION |
public final static UnicodeBlock CHEROKEE |
448 |
= new Subset(28, '\u2000', '\u206F'); |
= new UnicodeBlock('\u13A0', '\u13FF', |
449 |
|
"CHEROKEE"); |
450 |
|
|
451 |
/** |
/** |
452 |
* U+2070 - U+209F. |
* Unified Canadian Aboriginal Syllabics. |
453 |
|
* '\u1400' - '\u167F'. |
454 |
|
* @since 1.4 |
455 |
*/ |
*/ |
456 |
public final static Subset SUPERSCRIPTS_AND_SUBSCRIPTS |
public final static UnicodeBlock UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS |
457 |
= new Subset(29, '\u2070', '\u209F'); |
= new UnicodeBlock('\u1400', '\u167F', |
458 |
|
"UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS"); |
459 |
|
|
460 |
/** |
/** |
461 |
* U+20A0 - U+20CF. |
* Ogham. |
462 |
|
* '\u1680' - '\u169F'. |
463 |
|
* @since 1.4 |
464 |
*/ |
*/ |
465 |
public final static Subset CURRENCY_SYMBOLS |
public final static UnicodeBlock OGHAM |
466 |
= new Subset(30, '\u20A0', '\u20CF'); |
= new UnicodeBlock('\u1680', '\u169F', |
467 |
|
"OGHAM"); |
468 |
|
|
469 |
/** |
/** |
470 |
* U+20D0 - U+20FF. |
* Runic. |
471 |
|
* '\u16A0' - '\u16FF'. |
472 |
|
* @since 1.4 |
473 |
*/ |
*/ |
474 |
public final static Subset COMBINING_MARKS_FOR_SYMBOLS |
public final static UnicodeBlock RUNIC |
475 |
= new Subset(31, '\u20D0', '\u20FF'); |
= new UnicodeBlock('\u16A0', '\u16FF', |
476 |
|
"RUNIC"); |
477 |
|
|
478 |
/** |
/** |
479 |
* U+2100 - U+214F. |
* Khmer. |
480 |
|
* '\u1780' - '\u17FF'. |
481 |
|
* @since 1.4 |
482 |
*/ |
*/ |
483 |
public final static Subset LETTERLIKE_SYMBOLS |
public final static UnicodeBlock KHMER |
484 |
= new Subset(32, '\u2100', '\u214F'); |
= new UnicodeBlock('\u1780', '\u17FF', |
485 |
|
"KHMER"); |
486 |
|
|
487 |
/** |
/** |
488 |
* U+2150 - U+218F. |
* Mongolian. |
489 |
|
* '\u1800' - '\u18AF'. |
490 |
|
* @since 1.4 |
491 |
*/ |
*/ |
492 |
public final static Subset NUMBER_FORMS |
public final static UnicodeBlock MONGOLIAN |
493 |
= new Subset(33, '\u2150', '\u218F'); |
= new UnicodeBlock('\u1800', '\u18AF', |
494 |
|
"MONGOLIAN"); |
495 |
|
|
496 |
/** |
/** |
497 |
* U+2190 - U+21FF. |
* Latin Extended Additional. |
498 |
|
* '\u1E00' - '\u1EFF'. |
499 |
*/ |
*/ |
500 |
public final static Subset ARROWS |
public final static UnicodeBlock LATIN_EXTENDED_ADDITIONAL |
501 |
= new Subset(34, '\u2190', '\u21FF'); |
= new UnicodeBlock('\u1E00', '\u1EFF', |
502 |
|
"LATIN_EXTENDED_ADDITIONAL"); |
503 |
|
|
504 |
/** |
/** |
505 |
* U+2200 - U+22FF. |
* Greek Extended. |
506 |
|
* '\u1F00' - '\u1FFF'. |
507 |
*/ |
*/ |
508 |
public final static Subset MATHEMATICAL_OPERATORS |
public final static UnicodeBlock GREEK_EXTENDED |
509 |
= new Subset(35, '\u2200', '\u22FF'); |
= new UnicodeBlock('\u1F00', '\u1FFF', |
510 |
|
"GREEK_EXTENDED"); |
511 |
|
|
512 |
/** |
/** |
513 |
* U+2300 - U+23FF. |
* General Punctuation. |
514 |
|
* '\u2000' - '\u206F'. |
515 |
*/ |
*/ |
516 |
public final static Subset MISCELLANEOUS_TECHNICAL |
public final static UnicodeBlock GENERAL_PUNCTUATION |
517 |
= new Subset(36, '\u2300', '\u23FF'); |
= new UnicodeBlock('\u2000', '\u206F', |
518 |
|
"GENERAL_PUNCTUATION"); |
519 |
|
|
520 |
/** |
/** |
521 |
* U+2400 - U+243F. |
* Superscripts and Subscripts. |
522 |
|
* '\u2070' - '\u209F'. |
523 |
*/ |
*/ |
524 |
public final static Subset CONTROL_PICTURES |
public final static UnicodeBlock SUPERSCRIPTS_AND_SUBSCRIPTS |
525 |
= new Subset(37, '\u2400', '\u243F'); |
= new UnicodeBlock('\u2070', '\u209F', |
526 |
|
"SUPERSCRIPTS_AND_SUBSCRIPTS"); |
527 |
|
|
528 |
/** |
/** |
529 |
* U+2440 - U+245F. |
* Currency Symbols. |
530 |
|
* '\u20A0' - '\u20CF'. |
531 |
*/ |
*/ |
532 |
public final static Subset OPTICAL_CHARACTER_RECOGNITION |
public final static UnicodeBlock CURRENCY_SYMBOLS |
533 |
= new Subset(38, '\u2440', '\u245F'); |
= new UnicodeBlock('\u20A0', '\u20CF', |
534 |
|
"CURRENCY_SYMBOLS"); |
535 |
|
|
536 |
/** |
/** |
537 |
* U+2460 - U+24FF. |
* Combining Marks for Symbols. |
538 |
|
* '\u20D0' - '\u20FF'. |
539 |
*/ |
*/ |
540 |
public final static Subset ENCLOSED_ALPHANUMERICS |
public final static UnicodeBlock COMBINING_MARKS_FOR_SYMBOLS |
541 |
= new Subset(39, '\u2460', '\u24FF'); |
= new UnicodeBlock('\u20D0', '\u20FF', |
542 |
|
"COMBINING_MARKS_FOR_SYMBOLS"); |
543 |
|
|
544 |
/** |
/** |
545 |
* U+2500 - U+257F. |
* Letterlike Symbols. |
546 |
|
* '\u2100' - '\u214F'. |
547 |
*/ |
*/ |
548 |
public final static Subset BOX_DRAWING |
public final static UnicodeBlock LETTERLIKE_SYMBOLS |
549 |
= new Subset(40, '\u2500', '\u257F'); |
= new UnicodeBlock('\u2100', '\u214F', |
550 |
|
"LETTERLIKE_SYMBOLS"); |
551 |
|
|
552 |
/** |
/** |
553 |
* U+2580 - U+259F. |
* Number Forms. |
554 |
|
* '\u2150' - '\u218F'. |
555 |
*/ |
*/ |
556 |
public final static Subset BLOCK_ELEMENTS |
public final static UnicodeBlock NUMBER_FORMS |
557 |
= new Subset(41, '\u2580', '\u259F'); |
= new UnicodeBlock('\u2150', '\u218F', |
558 |
|
"NUMBER_FORMS"); |
559 |
|
|
560 |
/** |
/** |
561 |
* U+25A0 - U+25FF. |
* Arrows. |
562 |
|
* '\u2190' - '\u21FF'. |
563 |
*/ |
*/ |
564 |
public final static Subset GEOMETRIC_SHAPES |
public final static UnicodeBlock ARROWS |
565 |
= new Subset(42, '\u25A0', '\u25FF'); |
= new UnicodeBlock('\u2190', '\u21FF', |
566 |
|
"ARROWS"); |
567 |
|
|
568 |
/** |
/** |
569 |
* U+2600 - U+26FF. |
* Mathematical Operators. |
570 |
|
* '\u2200' - '\u22FF'. |
571 |
*/ |
*/ |
572 |
public final static Subset MISCELLANEOUS_SYMBOLS |
public final static UnicodeBlock MATHEMATICAL_OPERATORS |
573 |
= new Subset(43, '\u2600', '\u26FF'); |
= new UnicodeBlock('\u2200', '\u22FF', |
574 |
|
"MATHEMATICAL_OPERATORS"); |
575 |
|
|
576 |
/** |
/** |
577 |
* U+2700 - U+27BF. |
* Miscellaneous Technical. |
578 |
|
* '\u2300' - '\u23FF'. |
579 |
*/ |
*/ |
580 |
public final static Subset DINGBATS |
public final static UnicodeBlock MISCELLANEOUS_TECHNICAL |
581 |
= new Subset(44, '\u2700', '\u27BF'); |
= new UnicodeBlock('\u2300', '\u23FF', |
582 |
|
"MISCELLANEOUS_TECHNICAL"); |
583 |
|
|
584 |
/** |
/** |
585 |
* U+3000 - U+303F. |
* Control Pictures. |
586 |
|
* '\u2400' - '\u243F'. |
587 |
*/ |
*/ |
588 |
public final static Subset CJK_SYMBOLS_AND_PUNCTUATION |
public final static UnicodeBlock CONTROL_PICTURES |
589 |
= new Subset(45, '\u3000', '\u303F'); |
= new UnicodeBlock('\u2400', '\u243F', |
590 |
|
"CONTROL_PICTURES"); |
591 |
|
|
592 |
/** |
/** |
593 |
* U+3040 - U+309F. |
* Optical Character Recognition. |
594 |
|
* '\u2440' - '\u245F'. |
595 |
*/ |
*/ |
596 |
public final static Subset HIRAGANA |
public final static UnicodeBlock OPTICAL_CHARACTER_RECOGNITION |
597 |
= new Subset(46, '\u3040', '\u309F'); |
= new UnicodeBlock('\u2440', '\u245F', |
598 |
|
"OPTICAL_CHARACTER_RECOGNITION"); |
599 |
|
|
600 |
/** |
/** |
601 |
* U+30A0 - U+30FF. |
* Enclosed Alphanumerics. |
602 |
|
* '\u2460' - '\u24FF'. |
603 |
*/ |
*/ |
604 |
public final static Subset KATAKANA |
public final static UnicodeBlock ENCLOSED_ALPHANUMERICS |
605 |
= new Subset(47, '\u30A0', '\u30FF'); |
= new UnicodeBlock('\u2460', '\u24FF', |
606 |
|
"ENCLOSED_ALPHANUMERICS"); |
607 |
|
|
608 |
/** |
/** |
609 |
* U+3100 - U+312F. |
* Box Drawing. |
610 |
|
* '\u2500' - '\u257F'. |
611 |
*/ |
*/ |
612 |
public final static Subset BOPOMOFO |
public final static UnicodeBlock BOX_DRAWING |
613 |
= new Subset(48, '\u3100', '\u312F'); |
= new UnicodeBlock('\u2500', '\u257F', |
614 |
|
"BOX_DRAWING"); |
615 |
|
|
616 |
/** |
/** |
617 |
* U+3130 - U+318F. |
* Block Elements. |
618 |
|
* '\u2580' - '\u259F'. |
619 |
*/ |
*/ |
620 |
public final static Subset HANGUL_COMPATIBILITY_JAMO |
public final static UnicodeBlock BLOCK_ELEMENTS |
621 |
= new Subset(49, '\u3130', '\u318F'); |
= new UnicodeBlock('\u2580', '\u259F', |
622 |
|
"BLOCK_ELEMENTS"); |
623 |
|
|
624 |
/** |
/** |
625 |
* U+3190 - U+319F. |
* Geometric Shapes. |
626 |
|
* '\u25A0' - '\u25FF'. |
627 |
*/ |
*/ |
628 |
public final static Subset KANBUN |
public final static UnicodeBlock GEOMETRIC_SHAPES |
629 |
= new Subset(50, '\u3190', '\u319F'); |
= new UnicodeBlock('\u25A0', '\u25FF', |
630 |
|
"GEOMETRIC_SHAPES"); |
631 |
|
|
632 |
/** |
/** |
633 |
* U+3200 - U+32FF. |
* Miscellaneous Symbols. |
634 |
|
* '\u2600' - '\u26FF'. |
635 |
*/ |
*/ |
636 |
public final static Subset ENCLOSED_CJK_LETTERS_AND_MONTHS |
public final static UnicodeBlock MISCELLANEOUS_SYMBOLS |
637 |
= new Subset(51, '\u3200', '\u32FF'); |
= new UnicodeBlock('\u2600', '\u26FF', |
638 |
|
"MISCELLANEOUS_SYMBOLS"); |
639 |
|
|
640 |
/** |
/** |
641 |
* U+3300 - U+33FF. |
* Dingbats. |
642 |
|
* '\u2700' - '\u27BF'. |
643 |
*/ |
*/ |
644 |
public final static Subset CJK_COMPATIBILITY |
public final static UnicodeBlock DINGBATS |
645 |
= new Subset(52, '\u3300', '\u33FF'); |
= new UnicodeBlock('\u2700', '\u27BF', |
646 |
|
"DINGBATS"); |
647 |
|
|
648 |
/** |
/** |
649 |
* U+4E00 - U+9FFF. |
* Braille Patterns. |
650 |
|
* '\u2800' - '\u28FF'. |
651 |
|
* @since 1.4 |
652 |
*/ |
*/ |
653 |
public final static Subset CJK_UNIFIED_IDEOGRAPHS |
public final static UnicodeBlock BRAILLE_PATTERNS |
654 |
= new Subset(53, '\u4E00', '\u9FFF'); |
= new UnicodeBlock('\u2800', '\u28FF', |
655 |
|
"BRAILLE_PATTERNS"); |
656 |
|
|
657 |
/** |
/** |
658 |
* U+AC00 - U+D7A3. |
* CJK Radicals Supplement. |
659 |
|
* '\u2E80' - '\u2EFF'. |
660 |
|
* @since 1.4 |
661 |
*/ |
*/ |
662 |
public final static Subset HANGUL_SYLLABLES |
public final static UnicodeBlock CJK_RADICALS_SUPPLEMENT |
663 |
= new Subset(54, '\uAC00', '\uD7A3'); |
= new UnicodeBlock('\u2E80', '\u2EFF', |
664 |
|
"CJK_RADICALS_SUPPLEMENT"); |
665 |
|
|
666 |
/** |
/** |
667 |
* SURROGATES combines the following 3 Unicode character blocks:<br> |
* Kangxi Radicals. |
668 |
* High Surrogates: U+D800 - U+DB7F<br> |
* '\u2F00' - '\u2FDF'. |
669 |
* High Private Use Surrogates: U+DB80 - U+DBFF<br> |
* @since 1.4 |
|
* Low Surrogates: U+DC00 - U+DFFF |
|
670 |
*/ |
*/ |
671 |
public final static Subset SURROGATES |
public final static UnicodeBlock KANGXI_RADICALS |
672 |
= new Subset(55, '\uD800', '\uDFFF'); |
= new UnicodeBlock('\u2F00', '\u2FDF', |
673 |
|
"KANGXI_RADICALS"); |
674 |
|
|
675 |
/** |
/** |
676 |
* U+E000 - U+F8FF. |
* Ideographic Description Characters. |
677 |
|
* '\u2FF0' - '\u2FFF'. |
678 |
|
* @since 1.4 |
679 |
*/ |
*/ |
680 |
public final static Subset PRIVATE_USE |
public final static UnicodeBlock IDEOGRAPHIC_DESCRIPTION_CHARACTERS |
681 |
= new Subset(56, '\uE000', '\uF8FF'); |
= new UnicodeBlock('\u2FF0', '\u2FFF', |
682 |
|
"IDEOGRAPHIC_DESCRIPTION_CHARACTERS"); |
683 |
|
|
684 |
/** |
/** |
685 |
* U+F900 - U+FAFF. |
* CJK Symbols and Punctuation. |
686 |
|
* '\u3000' - '\u303F'. |
687 |
*/ |
*/ |
688 |
public final static Subset CJK_COMPATIBILITY_IDEOGRAPHS |
public final static UnicodeBlock CJK_SYMBOLS_AND_PUNCTUATION |
689 |
= new Subset(57, '\uF900', '\uFAFF'); |
= new UnicodeBlock('\u3000', '\u303F', |
690 |
|
"CJK_SYMBOLS_AND_PUNCTUATION"); |
691 |
|
|
692 |
/** |
/** |
693 |
* U+FB00 - U+FB4F. |
* Hiragana. |
694 |
|
* '\u3040' - '\u309F'. |
695 |
*/ |
*/ |
696 |
public final static Subset ALPHABETIC_PRESENTATION_FORMS |
public final static UnicodeBlock HIRAGANA |
697 |
= new Subset(58, '\uFB00', '\uFB4F'); |
= new UnicodeBlock('\u3040', '\u309F', |
698 |
|
"HIRAGANA"); |
699 |
|
|
700 |
/** |
/** |
701 |
* U+FB50 - U+FDFF. |
* Katakana. |
702 |
|
* '\u30A0' - '\u30FF'. |
703 |
*/ |
*/ |
704 |
public final static Subset ARABIC_PRESENTATION_FORMS_A |
public final static UnicodeBlock KATAKANA |
705 |
= new Subset(59, '\uFB50', '\uFDFF'); |
= new UnicodeBlock('\u30A0', '\u30FF', |
706 |
|
"KATAKANA"); |
707 |
|
|
708 |
/** |
/** |
709 |
* U+FE20 - U+FE2F. |
* Bopomofo. |
710 |
|
* '\u3100' - '\u312F'. |
711 |
*/ |
*/ |
712 |
public final static Subset COMBINING_HALF_MARKS |
public final static UnicodeBlock BOPOMOFO |
713 |
= new Subset(60, '\uFE20', '\uFE2F'); |
= new UnicodeBlock('\u3100', '\u312F', |
714 |
|
"BOPOMOFO"); |
715 |
|
|
716 |
/** |
/** |
717 |
* U+FE30 - U+FE4F. |
* Hangul Compatibility Jamo. |
718 |
|
* '\u3130' - '\u318F'. |
719 |
*/ |
*/ |
720 |
public final static Subset CJK_COMPATIBILITY_FORMS |
public final static UnicodeBlock HANGUL_COMPATIBILITY_JAMO |
721 |
= new Subset(61, '\uFE30', '\uFE4F'); |
= new UnicodeBlock('\u3130', '\u318F', |
722 |
|
"HANGUL_COMPATIBILITY_JAMO"); |
723 |
|
|
724 |
/** |
/** |
725 |
* U+FE50 - U+FE6F. |
* Kanbun. |
726 |
|
* '\u3190' - '\u319F'. |
727 |
*/ |
*/ |
728 |
public final static Subset SMALL_FORM_VARIANTS |
public final static UnicodeBlock KANBUN |
729 |
= new Subset(62, '\uFE50', '\uFE6F'); |
= new UnicodeBlock('\u3190', '\u319F', |
730 |
|
"KANBUN"); |
731 |
|
|
732 |
/** |
/** |
733 |
* U+FE70 - U+FEFF. |
* Bopomofo Extended. |
734 |
|
* '\u31A0' - '\u31BF'. |
735 |
|
* @since 1.4 |
736 |
*/ |
*/ |
737 |
public final static Subset ARABIC_PRESENTATION_FORMS_B |
public final static UnicodeBlock BOPOMOFO_EXTENDED |
738 |
= new Subset(63, '\uFE70', '\uFEFF'); |
= new UnicodeBlock('\u31A0', '\u31BF', |
739 |
|
"BOPOMOFO_EXTENDED"); |
740 |
|
|
741 |
/** |
/** |
742 |
* U+FF00 - U+FFEF. |
* Enclosed CJK Letters and Months. |
743 |
|
* '\u3200' - '\u32FF'. |
744 |
*/ |
*/ |
745 |
public final static Subset HALFWIDTH_AND_FULLWIDTH_FORMS |
public final static UnicodeBlock ENCLOSED_CJK_LETTERS_AND_MONTHS |
746 |
= new Subset(64, '\uFF00', '\uFFEF'); |
= new UnicodeBlock('\u3200', '\u32FF', |
747 |
|
"ENCLOSED_CJK_LETTERS_AND_MONTHS"); |
748 |
|
|
749 |
/** |
/** |
750 |
* SPECIALS combine the following two Unicode character blocks:<br> |
* CJK Compatibility. |
751 |
* SPECIALS: U+FEFF - U+FEFF<br> |
* '\u3300' - '\u33FF'. |
|
* SPECIALS: U+FFF0 - U+FFFF |
|
752 |
*/ |
*/ |
753 |
public final static Subset SPECIALS |
public final static UnicodeBlock CJK_COMPATIBILITY |
754 |
= new Subset(65, '\uFEFF', '\uFFFF'); |
= new UnicodeBlock('\u3300', '\u33FF', |
755 |
|
"CJK_COMPATIBILITY"); |
756 |
|
|
757 |
/** |
/** |
758 |
* All Latin character blocks combined into one. |
* CJK Unified Ideographs Extension A. |
759 |
* Informative block added by Sun. |
* '\u3400' - '\u4DB5'. |
760 |
* U+0000 - U+024F |
* @since 1.4 |
761 |
*/ |
*/ |
762 |
public final static Subset LATIN |
public final static UnicodeBlock CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A |
763 |
= new Subset('\u0000', '\u024F'); |
= new UnicodeBlock('\u3400', '\u4DB5', |
764 |
|
"CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A"); |
765 |
|
|
766 |
/** |
/** |
767 |
* All Latin digits. |
* CJK Unified Ideographs. |
768 |
* Informative block added by Sun. |
* '\u4E00' - '\u9FFF'. |
|
* U+0030 - U+0039 |
|
769 |
*/ |
*/ |
770 |
public final static Subset LATIN_DIGITS |
public final static UnicodeBlock CJK_UNIFIED_IDEOGRAPHS |
771 |
= new Subset('\u0030', '\u0039'); |
= new UnicodeBlock('\u4E00', '\u9FFF', |
772 |
|
"CJK_UNIFIED_IDEOGRAPHS"); |
773 |
|
|
774 |
/** |
/** |
775 |
* Halfwidth Katakana characters. |
* Yi Syllables. |
776 |
* Informative block added by Sun. |
* '\uA000' - '\uA48F'. |
777 |
* U+FF60 - U+FF9F |
* @since 1.4 |
778 |
*/ |
*/ |
779 |
public final static Subset HALFWIDTH_KATAKANA |
public final static UnicodeBlock YI_SYLLABLES |
780 |
= new Subset('\uFF60', '\uFF9F'); |
= new UnicodeBlock('\uA000', '\uA48F', |
781 |
|
"YI_SYLLABLES"); |
782 |
|
|
783 |
/** |
/** |
784 |
* All Han characters used for writing traditional Chinese. |
* Yi Radicals. |
785 |
* Loosely defined as Unicode characters which |
* '\uA490' - '\uA4CF'. |
786 |
* have mappings to CNS 11643 or BigFive. |
* @since 1.4 |
|
* Informative block added by Sun. |
|
787 |
*/ |
*/ |
788 |
public final static Subset TRADITIONAL_HANZI = new Subset(); |
public final static UnicodeBlock YI_RADICALS |
789 |
|
= new UnicodeBlock('\uA490', '\uA4CF', |
790 |
|
"YI_RADICALS"); |
791 |
|
|
792 |
/** |
/** |
793 |
* All Han characters used for writing simplified Chinese. |
* Hangul Syllables. |
794 |
* Loosely defined as Unicode characters which |
* '\uAC00' - '\uD7A3'. |
|
* have mappings to GB 2312. |
|
|
* Informative block added by Sun. |
|
795 |
*/ |
*/ |
796 |
public final static Subset SIMPLIFIED_HANZI = new Subset(); |
public final static UnicodeBlock HANGUL_SYLLABLES |
797 |
|
= new UnicodeBlock('\uAC00', '\uD7A3', |
798 |
|
"HANGUL_SYLLABLES"); |
799 |
|
|
800 |
/** |
/** |
801 |
* All Han characters used for writing Japanese. |
* Surrogates Area. |
802 |
* Loosely defined as Unicode characters which |
* '\uD800' - '\uDFFF'. |
|
* have mappings to JIS X 0208 or JIS X 0212. |
|
|
* Informative block added by Sun. |
|
803 |
*/ |
*/ |
804 |
public final static Subset KANJI = new Subset(); |
public final static UnicodeBlock SURROGATES_AREA |
805 |
|
= new UnicodeBlock('\uD800', '\uDFFF', |
806 |
|
"SURROGATES_AREA"); |
807 |
|
|
808 |
/** |
/** |
809 |
* All Han characters used for writing Korean. |
* Private Use Area. |
810 |
* Loosely defined as Unicode characters which |
* '\uE000' - '\uF8FF'. |
|
* have mappings to KS C 5601. |
|
|
* Informative block added by Sun. |
|
811 |
*/ |
*/ |
812 |
public final static Subset HANJA = new Subset(); |
public final static UnicodeBlock PRIVATE_USE_AREA |
813 |
} // class Subset |
= new UnicodeBlock('\uE000', '\uF8FF', |
814 |
|
"PRIVATE_USE_AREA"); |
815 |
|
|
816 |
/** |
/** |
817 |
* A family of character subsets in the Unicode specification. A character |
* CJK Compatibility Ideographs. |
818 |
* is in at most one of these blocks. |
* '\uF900' - '\uFAFF'. |
819 |
* |
*/ |
820 |
* @since 1.2 |
public final static UnicodeBlock CJK_COMPATIBILITY_IDEOGRAPHS |
821 |
* TODO: Add class UnicodeBlock |
= new UnicodeBlock('\uF900', '\uFAFF', |
822 |
*/ |
"CJK_COMPATIBILITY_IDEOGRAPHS"); |
823 |
// class UnicodeBlock |
|
824 |
|
/** |
825 |
|
* Alphabetic Presentation Forms. |
826 |
|
* '\uFB00' - '\uFB4F'. |
827 |
|
*/ |
828 |
|
public final static UnicodeBlock ALPHABETIC_PRESENTATION_FORMS |
829 |
|
= new UnicodeBlock('\uFB00', '\uFB4F', |
830 |
|
"ALPHABETIC_PRESENTATION_FORMS"); |
831 |
|
|
832 |
|
/** |
833 |
|
* Arabic Presentation Forms-A. |
834 |
|
* '\uFB50' - '\uFDFF'. |
835 |
|
*/ |
836 |
|
public final static UnicodeBlock ARABIC_PRESENTATION_FORMS_A |
837 |
|
= new UnicodeBlock('\uFB50', '\uFDFF', |
838 |
|
"ARABIC_PRESENTATION_FORMS_A"); |
839 |
|
|
840 |
|
/** |
841 |
|
* Combining Half Marks. |
842 |
|
* '\uFE20' - '\uFE2F'. |
843 |
|
*/ |
844 |
|
public final static UnicodeBlock COMBINING_HALF_MARKS |
845 |
|
= new UnicodeBlock('\uFE20', '\uFE2F', |
846 |
|
"COMBINING_HALF_MARKS"); |
847 |
|
|
848 |
|
/** |
849 |
|
* CJK Compatibility Forms. |
850 |
|
* '\uFE30' - '\uFE4F'. |
851 |
|
*/ |
852 |
|
public final static UnicodeBlock CJK_COMPATIBILITY_FORMS |
853 |
|
= new UnicodeBlock('\uFE30', '\uFE4F', |
854 |
|
"CJK_COMPATIBILITY_FORMS"); |
855 |
|
|
856 |
|
/** |
857 |
|
* Small Form Variants. |
858 |
|
* '\uFE50' - '\uFE6F'. |
859 |
|
*/ |
860 |
|
public final static UnicodeBlock SMALL_FORM_VARIANTS |
861 |
|
= new UnicodeBlock('\uFE50', '\uFE6F', |
862 |
|
"SMALL_FORM_VARIANTS"); |
863 |
|
|
864 |
|
/** |
865 |
|
* Arabic Presentation Forms-B. |
866 |
|
* '\uFE70' - '\uFEFE'. |
867 |
|
*/ |
868 |
|
public final static UnicodeBlock ARABIC_PRESENTATION_FORMS_B |
869 |
|
= new UnicodeBlock('\uFE70', '\uFEFE', |
870 |
|
"ARABIC_PRESENTATION_FORMS_B"); |
871 |
|
|
872 |
|
/** |
873 |
|
* Halfwidth and Fullwidth Forms. |
874 |
|
* '\uFF00' - '\uFFEF'. |
875 |
|
*/ |
876 |
|
public final static UnicodeBlock HALFWIDTH_AND_FULLWIDTH_FORMS |
877 |
|
= new UnicodeBlock('\uFF00', '\uFFEF', |
878 |
|
"HALFWIDTH_AND_FULLWIDTH_FORMS"); |
879 |
|
|
880 |
|
/** |
881 |
|
* Specials. |
882 |
|
* '\uFFF0' - '\uFFFD'. |
883 |
|
*/ |
884 |
|
public final static UnicodeBlock SPECIALS |
885 |
|
= new UnicodeBlock('\uFFF0', '\uFFFD', |
886 |
|
"SPECIALS"); |
887 |
|
|
888 |
|
/** |
889 |
|
* The defined subsets. |
890 |
|
*/ |
891 |
|
private static final UnicodeBlock sets[] = { |
892 |
|
BASIC_LATIN, |
893 |
|
LATIN_1_SUPPLEMENT, |
894 |
|
LATIN_EXTENDED_A, |
895 |
|
LATIN_EXTENDED_B, |
896 |
|
IPA_EXTENSIONS, |
897 |
|
SPACING_MODIFIER_LETTERS, |
898 |
|
COMBINING_DIACRITICAL_MARKS, |
899 |
|
GREEK, |
900 |
|
CYRILLIC, |
901 |
|
ARMENIAN, |
902 |
|
HEBREW, |
903 |
|
ARABIC, |
904 |
|
SYRIAC, |
905 |
|
THAANA, |
906 |
|
DEVANAGARI, |
907 |
|
BENGALI, |
908 |
|
GURMUKHI, |
909 |
|
GUJARATI, |
910 |
|
ORIYA, |
911 |
|
TAMIL, |
912 |
|
TELUGU, |
913 |
|
KANNADA, |
914 |
|
MALAYALAM, |
915 |
|
SINHALA, |
916 |
|
THAI, |
917 |
|
LAO, |
918 |
|
TIBETAN, |
919 |
|
MYANMAR, |
920 |
|
GEORGIAN, |
921 |
|
HANGUL_JAMO, |
922 |
|
ETHIOPIC, |
923 |
|
CHEROKEE, |
924 |
|
UNIFIED_CANADIAN_ABORIGINAL_SYLLABICS, |
925 |
|
OGHAM, |
926 |
|
RUNIC, |
927 |
|
KHMER, |
928 |
|
MONGOLIAN, |
929 |
|
LATIN_EXTENDED_ADDITIONAL, |
930 |
|
GREEK_EXTENDED, |
931 |
|
GENERAL_PUNCTUATION, |
932 |
|
SUPERSCRIPTS_AND_SUBSCRIPTS, |
933 |
|
CURRENCY_SYMBOLS, |
934 |
|
COMBINING_MARKS_FOR_SYMBOLS, |
935 |
|
LETTERLIKE_SYMBOLS, |
936 |
|
NUMBER_FORMS, |
937 |
|
ARROWS, |
938 |
|
MATHEMATICAL_OPERATORS, |
939 |
|
MISCELLANEOUS_TECHNICAL, |
940 |
|
CONTROL_PICTURES, |
941 |
|
OPTICAL_CHARACTER_RECOGNITION, |
942 |
|
ENCLOSED_ALPHANUMERICS, |
943 |
|
BOX_DRAWING, |
944 |
|
BLOCK_ELEMENTS, |
945 |
|
GEOMETRIC_SHAPES, |
946 |
|
MISCELLANEOUS_SYMBOLS, |
947 |
|
DINGBATS, |
948 |
|
BRAILLE_PATTERNS, |
949 |
|
CJK_RADICALS_SUPPLEMENT, |
950 |
|
KANGXI_RADICALS, |
951 |
|
IDEOGRAPHIC_DESCRIPTION_CHARACTERS, |
952 |
|
CJK_SYMBOLS_AND_PUNCTUATION, |
953 |
|
HIRAGANA, |
954 |
|
KATAKANA, |
955 |
|
BOPOMOFO, |
956 |
|
HANGUL_COMPATIBILITY_JAMO, |
957 |
|
KANBUN, |
958 |
|
BOPOMOFO_EXTENDED, |
959 |
|
ENCLOSED_CJK_LETTERS_AND_MONTHS, |
960 |
|
CJK_COMPATIBILITY, |
961 |
|
CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A, |
962 |
|
CJK_UNIFIED_IDEOGRAPHS, |
963 |
|
YI_SYLLABLES, |
964 |
|
YI_RADICALS, |
965 |
|
HANGUL_SYLLABLES, |
966 |
|
SURROGATES_AREA, |
967 |
|
PRIVATE_USE_AREA, |
968 |
|
CJK_COMPATIBILITY_IDEOGRAPHS, |
969 |
|
ALPHABETIC_PRESENTATION_FORMS, |
970 |
|
ARABIC_PRESENTATION_FORMS_A, |
971 |
|
COMBINING_HALF_MARKS, |
972 |
|
CJK_COMPATIBILITY_FORMS, |
973 |
|
SMALL_FORM_VARIANTS, |
974 |
|
ARABIC_PRESENTATION_FORMS_B, |
975 |
|
HALFWIDTH_AND_FULLWIDTH_FORMS, |
976 |
|
SPECIALS, |
977 |
|
}; |
978 |
|
} // class UnicodeBlock |
979 |
|
|
980 |
/** |
/** |
981 |
* The immutable value of this Character. |
* The immutable value of this Character. |
982 |
|
* |
983 |
|
* @serial the value of this Character |
984 |
*/ |
*/ |
985 |
private final char value; |
private final char value; |
986 |
|
|
987 |
/** |
/** |
988 |
* Compatible with JDK 1.0+. |
* Compatible with JDK 1.0+. |
989 |
*/ |
*/ |
990 |
static final long serialVersionUID = 3786198910865385080L; |
private static final long serialVersionUID = 3786198910865385080L; |
991 |
|
|
992 |
/** |
/** |
993 |
* Smallest value allowed for radix arguments in Java. This value is 2. |
* Smallest value allowed for radix arguments in Java. This value is 2. |
1190 |
public static final byte END_PUNCTUATION = 22; |
public static final byte END_PUNCTUATION = 22; |
1191 |
|
|
1192 |
/** |
/** |
1193 |
* TODO: Add INITIAL_QUOTE_PUNCTUATION. |
* Pi = Punctuation, Initial Quote (Informative). |
|
* Pi = ???. |
|
1194 |
* |
* |
1195 |
* @since 1.4 |
* @since 1.4 |
1196 |
*/ |
*/ |
1197 |
|
public static final byte INITIAL_QUOTE_PUNCTUATION = 29; |
1198 |
|
|
1199 |
/** |
/** |
1200 |
* TODO: Add FINAL_QUOTE_PUNCTUATION. |
* Pf = Punctuation, Final Quote (Informative). |
|
* Pf = ???. |
|
1201 |
* |
* |
1202 |
* @since 1.4 |
* @since 1.4 |
1203 |
*/ |
*/ |
1204 |
|
public static final byte FINAL_QUOTE_PUNCTUATION = 30; |
1205 |
|
|
1206 |
/** |
/** |
1207 |
* Po = Punctuation, Other (Informative). |
* Po = Punctuation, Other (Informative). |
1239 |
public static final byte OTHER_SYMBOL = 28; |
public static final byte OTHER_SYMBOL = 28; |
1240 |
|
|
1241 |
/** |
/** |
|
* TODO: Add DIRECTIONALITY_UNDEFINED. |
|
1242 |
* Undefined bidirectional character type. Undefined char values have |
* Undefined bidirectional character type. Undefined char values have |
1243 |
* undefined directionality in the Unicode specification. |
* undefined directionality in the Unicode specification. |
1244 |
* |
* |
1245 |
* @since 1.4 |
* @since 1.4 |
1246 |
*/ |
*/ |
1247 |
|
public static final byte DIRECTIONALITY_UNDEFINED = -1; |
1248 |
|
|
1249 |
/** |
/** |
|
* TODO: Add DIRECTIONALITY_LEFT_TO_RIGHT. |
|
1250 |
* Strong bidirectional character type "L". |
* Strong bidirectional character type "L". |
1251 |
* |
* |
1252 |
* @since 1.4 |
* @since 1.4 |
1253 |
*/ |
*/ |
1254 |
|
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = 0; |
1255 |
|
|
1256 |
/** |
/** |
|
* TODO: Add DIRECTIONALITY_RIGHT_TO_LEFT. |
|
1257 |
* Strong bidirectional character type "R". |
* Strong bidirectional character type "R". |
1258 |
* |
* |
1259 |
* @since 1.4 |
* @since 1.4 |
1260 |
*/ |
*/ |
1261 |
|
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = 1; |
1262 |
|
|
1263 |
/** |
/** |
|
* TODO: Add DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC. |
|
1264 |
* Strong bidirectional character type "AL". |
* Strong bidirectional character type "AL". |
1265 |
* |
* |
1266 |
* @since 1.4 |
* @since 1.4 |
1267 |
*/ |
*/ |
1268 |
|
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = 2; |
1269 |
|
|
1270 |
/** |
/** |
1271 |
* TODO: Add DIRECTIONALITY_EUROPEAN_NUMBER. |
* Weak bidirectional character type "EN". |
|
* Strong bidirectional character type "EN". |
|
1272 |
* |
* |
1273 |
* @since 1.4 |
* @since 1.4 |
1274 |
*/ |
*/ |
1275 |
|
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = 3; |
1276 |
|
|
1277 |
/** |
/** |
1278 |
* TODO: Add DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR. |
* Weak bidirectional character type "ES". |
|
* Strong bidirectional character type "ES". |
|
1279 |
* |
* |
1280 |
* @since 1.4 |
* @since 1.4 |
1281 |
*/ |
*/ |
1282 |
|
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = 4; |
1283 |
|
|
1284 |
/** |
/** |
1285 |
* TODO: Add DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR. |
* Weak bidirectional character type "ET". |
|
* Strong bidirectional character type "ET". |
|
1286 |
* |
* |
1287 |
* @since 1.4 |
* @since 1.4 |
1288 |
*/ |
*/ |
1289 |
|
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = 5; |
1290 |
|
|
1291 |
/** |
/** |
1292 |
* TODO: Add DIRECTIONALITY_ARABIC_NUMBER. |
* Weak bidirectional character type "AN". |
|
* Strong bidirectional character type "AN". |
|
1293 |
* |
* |
1294 |
* @since 1.4 |
* @since 1.4 |
1295 |
*/ |
*/ |
1296 |
|
public static final byte DIRECTIONALITY_ARABIC_NUMBER = 6; |
1297 |
|
|
1298 |
/** |
/** |
1299 |
* TODO: Add DIRECTIONALITY_COMMON_NUMBER_SEPARATOR. |
* Weak bidirectional character type "CS". |
|
* Strong bidirectional character type "CS". |
|
1300 |
* |
* |
1301 |
* @since 1.4 |
* @since 1.4 |
1302 |
*/ |
*/ |
1303 |
|
public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = 7; |
1304 |
|
|
1305 |
/** |
/** |
1306 |
* TODO: Add DIRECTIONALITY_NONSPACING_MARK. |
* Weak bidirectional character type "NSM". |
|
* Strong bidirectional character type "NSM". |
|
1307 |
* |
* |
1308 |
* @since 1.4 |
* @since 1.4 |
1309 |
*/ |
*/ |
1310 |
|
public static final byte DIRECTIONALITY_NONSPACING_MARK = 8; |
1311 |
|
|
1312 |
/** |
/** |
1313 |
* TODO: Add DIRECTIONALITY_BOUNDARY_NEUTRAL. |
* Weak bidirectional character type "BN". |
|
* Strong bidirectional character type "BN". |
|
1314 |
* |
* |
1315 |
* @since 1.4 |
* @since 1.4 |
1316 |
*/ |
*/ |
1317 |
|
public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = 9; |
1318 |
|
|
1319 |
/** |
/** |
1320 |
* TODO: Add DIRECTIONALITY_PARAGRAPH_SEPARATOR. |
* Neutral bidirectional character type "B". |
|
* Strong bidirectional character type "B". |
|
1321 |
* |
* |
1322 |
* @since 1.4 |
* @since 1.4 |
1323 |
*/ |
*/ |
1324 |
|
public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = 10; |
1325 |
|
|
1326 |
/** |
/** |
1327 |
* TODO: Add DIRECTIONALITY_SEGMENT_SEPARATOR. |
* Neutral bidirectional character type "S". |
|
* Strong bidirectional character type "S". |
|
1328 |
* |
* |
1329 |
* @since 1.4 |
* @since 1.4 |
1330 |
*/ |
*/ |
1331 |
|
public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = 11; |
1332 |
|
|
1333 |
/** |
/** |
|
* TODO: Add DIRECTIONALITY_WHITESPACE. |
|
1334 |
* Strong bidirectional character type "WS". |
* Strong bidirectional character type "WS". |
1335 |
* |
* |
1336 |
* @since 1.4 |
* @since 1.4 |
1337 |
*/ |
*/ |
1338 |
|
public static final byte DIRECTIONALITY_WHITESPACE = 12; |
1339 |
|
|
1340 |
/** |
/** |
1341 |
* TODO: Add DIRECTIONALITY_OTHER_NEUTRALS. |
* Neutral bidirectional character type "ON". |
|
* Strong bidirectional character type "ON". |
|
1342 |
* |
* |
1343 |
* @since 1.4 |
* @since 1.4 |
1344 |
*/ |
*/ |
1345 |
|
public static final byte DIRECTIONALITY_OTHER_NEUTRALS = 13; |
1346 |
|
|
1347 |
/** |
/** |
|
* TODO: Add DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING. |
|
1348 |
* Strong bidirectional character type "LRE". |
* Strong bidirectional character type "LRE". |
1349 |
* |
* |
1350 |
* @since 1.4 |
* @since 1.4 |
1351 |
*/ |
*/ |
1352 |
|
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = 14; |
1353 |
|
|
1354 |
/** |
/** |
|
* TODO: Add DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE. |
|
1355 |
* Strong bidirectional character type "LRO". |
* Strong bidirectional character type "LRO". |
1356 |
* |
* |
1357 |
* @since 1.4 |
* @since 1.4 |
1358 |
*/ |
*/ |
1359 |
|
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = 15; |
1360 |
|
|
1361 |
/** |
/** |
|
* TODO: Add DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING. |
|
1362 |
* Strong bidirectional character type "RLE". |
* Strong bidirectional character type "RLE". |
1363 |
* |
* |
1364 |
* @since 1.4 |
* @since 1.4 |
1365 |
*/ |
*/ |
1366 |
|
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = 16; |
1367 |
|
|
1368 |
/** |
/** |
|
* TODO: Add DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE. |
|
1369 |
* Strong bidirectional character type "RLO". |
* Strong bidirectional character type "RLO". |
1370 |
* |
* |
1371 |
* @since 1.4 |
* @since 1.4 |
1372 |
*/ |
*/ |
1373 |
|
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = 17; |
1374 |
|
|
1375 |
/** |
/** |
1376 |
* TODO: Add DIRECTIONALITY_POP_DIRECTIONAL_FORMAT. |
* Weak bidirectional character type "PDF". |
|
* Strong bidirectional character type "PDF". |
|
1377 |
* |
* |
1378 |
* @since 1.4 |
* @since 1.4 |
1379 |
*/ |
*/ |
1380 |
|
public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = 18; |
1381 |
|
|
1382 |
/** |
/** Stores unicode blocks in gnu/java/locale/block.uni. */ |
1383 |
* Stores unicode blocks in gnu/java/locale/character.uni. |
private static final Block blocks[]; |
|
*/ |
|
|
static Block blocks[]; |
|
1384 |
|
|
1385 |
/** |
/** Stores titlecase information in gnu/java/locale/titlecase.uni. */ |
1386 |
* Stores titlecase blocks in gnu/java/locale/titlecase.uni. |
private static final char tcs[][]; |
|
*/ |
|
|
static char tcs[][]; |
|
1387 |
|
|
1388 |
/** |
/** Stores unicode data in gnu/java/locale/character.uni. */ |
1389 |
* Stores unicode data in gnu/java/locale/character.uni. |
private static final byte[] unicodeData; |
|
*/ |
|
|
static byte[] unicodeData; |
|
1390 |
|
|
1391 |
/** |
/** Caches the most recently used CharAttr. */ |
1392 |
* Caches the most recently used CharAttr. |
private static CharAttr cachedCharAttr; |
1393 |
*/ |
|
1394 |
static CharAttr cachedCharAttr; |
/** The size of a block in gnu/java/locale/block.uni. */ |
1395 |
|
private static final int BLOCK_SIZE = 6; |
1396 |
|
|
1397 |
|
/** The size of an attribute in gnu/java/locale/character.uni. */ |
1398 |
|
private static final int ATTR_SIZE = 8; |
1399 |
|
|
1400 |
/** |
/** |
1401 |
* Open up the Unicode attribute database and read the index into memory. |
* Open up the Unicode attribute database and read the index into memory. |
1402 |
* TODO: How are these resource files generated? |
* These files were generated by doc/unicode/unicode-muncher.pl. |
1403 |
*/ |
*/ |
1404 |
static |
static |
1405 |
{ |
{ |
1410 |
File tcFile = ClassLoaderHelper.getSystemResourceAsFile( |
File tcFile = ClassLoaderHelper.getSystemResourceAsFile( |
1411 |
"/gnu/java/locale/titlecase.uni"); |
"/gnu/java/locale/titlecase.uni"); |
1412 |
if (cFile == null || blockFile == null || tcFile == null) |
if (cFile == null || blockFile == null || tcFile == null) |
1413 |
throw new Error("Cannot locate Unicode attribute database."); |
throw new InternalError("Cannot locate Unicode attribute database."); |
1414 |
|
|
1415 |
blocks = new Block[(int) blockFile.length() / 9]; |
blocks = new Block[(int) blockFile.length() / BLOCK_SIZE]; |
1416 |
try |
try |
1417 |
{ |
{ |
1418 |
DataInputStream blockIS |
DataInputStream blockIS |
1421 |
{ |
{ |
1422 |
char start = blockIS.readChar(); |
char start = blockIS.readChar(); |
1423 |
char end = blockIS.readChar(); |
char end = blockIS.readChar(); |
1424 |
boolean compressed = blockIS.readUnsignedByte() != 0; |
short offset = blockIS.readShort(); |
1425 |
int offset = blockIS.readInt(); |
blocks[i] = new Block(start, end, offset); |
|
blocks[i] = new Block(start, end, compressed, offset); |
|
1426 |
} |
} |
1427 |
} |
} |
1428 |
catch (IOException e) |
catch (IOException e) |
1429 |
{ |
{ |
1430 |
throw new Error("Error reading block file: " + e); |
throw new InternalError("Error reading block file: " + e); |
1431 |
} |
} |
1432 |
|
|
1433 |
tcs = new char[(int) tcFile.length() / 4][2]; |
tcs = new char[(int) tcFile.length() / 4][2]; |
1443 |
} |
} |
1444 |
catch (IOException e) |
catch (IOException e) |
1445 |
{ |
{ |
1446 |
throw new Error("Error reading titlecase file: " + e); |
throw new InternalError("Error reading titlecase file: " + e); |
1447 |
} |
} |
1448 |
|
|
1449 |
try |
try |
1450 |
{ |
{ |
1451 |
RandomAccessFile charFile = new RandomAccessFile(cFile, "r"); |
RandomAccessFile charFile = new RandomAccessFile(cFile, "r"); |
1452 |
unicodeData = new byte[(int)charFile.length()]; |
unicodeData = new byte[(int) charFile.length()]; |
1453 |
charFile.readFully(unicodeData, 0, unicodeData.length); |
charFile.readFully(unicodeData, 0, unicodeData.length); |
1454 |
} |
} |
1455 |
catch (IOException e) |
catch (IOException e) |
1456 |
{ |
{ |
1457 |
throw new Error("Unable to open Unicode character attribute file: " |
throw new InternalError("Error reading Unicode attribute file: " |
1458 |
+ e); |
+ e); |
1459 |
} |
} |
1460 |
|
|
1461 |
cachedCharAttr = new CharAttr('\0', false, CONTROL, 65535, '\0', '\0'); |
cachedCharAttr = new CharAttr('\0', false, CONTROL, -1, '\0', '\0', |
1462 |
|
DIRECTIONALITY_BOUNDARY_NEUTRAL, false); |
1463 |
} |
} |
1464 |
|
|
1465 |
/** |
/** |
1466 |
* Grabs a character out of the Unicode attribute database. |
* Grabs a character out of the Unicode attribute database. See |
1467 |
|
* doc/unicode/unicode.database.format for details of the fields. |
1468 |
* |
* |
1469 |
* @param ch the character to look up |
* @param ch the character to look up |
1470 |
* @return the character's CharAttr |
* @return the character's CharAttr |
1475 |
if (cached.ch == ch) |
if (cached.ch == ch) |
1476 |
return cached; |
return cached; |
1477 |
|
|
1478 |
int i = getBlock(ch); |
Block b = getBlock(ch); |
1479 |
if (i == -1) |
if (b == null) |
1480 |
return new CharAttr(ch, false, UNASSIGNED, 65535, ch, ch); |
return cachedCharAttr = new CharAttr(ch, false, UNASSIGNED, -1, ch, ch, |
1481 |
Block b = blocks[i]; |
DIRECTIONALITY_UNDEFINED, false); |
1482 |
int offset = b.compressed ? b.offset : (b.offset + (ch - b.start) * 7); |
int offset = b.compressed ? b.offset |
1483 |
int byte7 = unicodeData[offset] & 0xFF; |
: (b.offset + (ch - b.start) * ATTR_SIZE); |
1484 |
boolean noBreakSpace = (byte7 >> 5 & 0x1) == 1; |
byte flags = unicodeData[offset]; |
1485 |
int category = byte7 & 0x1F; |
boolean noBreakSpace = (flags & 0x20) == 0x20; |
1486 |
int numericalDecimalValue = (((unicodeData[offset+1] & 0xFF) << 8) |
byte category = (byte) (flags & 0x1F); |
1487 |
+ (unicodeData[offset+2] & 0xFF)); |
// numericValue, uppercase, and lowercase are signed in unicode.uni. |
1488 |
char uppercase = (char)(((unicodeData[offset+3] & 0xFF) << 8) |
int numericValue = (unicodeData[offset + 1] << 8) |
1489 |
+ (unicodeData[offset+4] & 0xFF)); |
| (unicodeData[offset + 2] & 0xFF); |
1490 |
char lowercase = (char)(((unicodeData[offset+5] & 0xFF) << 8) |
char uppercase = (char) (ch - ((unicodeData[offset + 3] << 8) |
1491 |
+ (unicodeData[offset+6] & 0xFF)); |
| (unicodeData[offset + 4] & 0xFF))); |
1492 |
|
char lowercase = (char) (ch - ((unicodeData[offset + 5] << 8) |
1493 |
CharAttr ca = new CharAttr(ch, noBreakSpace, category, |
| (unicodeData[offset + 6] & 0xFF))); |
1494 |
numericalDecimalValue, uppercase, lowercase); |
if (b.compressed && numericValue >= 0) |
1495 |
cachedCharAttr = ca; |
numericValue += ch - b.start; |
1496 |
return ca; |
byte directionality = unicodeData[offset + 7]; |
1497 |
|
boolean mirrored = (flags & 0x40) == 0x40; |
1498 |
|
|
1499 |
|
return cachedCharAttr = new CharAttr(ch, noBreakSpace, category, |
1500 |
|
numericValue, uppercase, lowercase, |
1501 |
|
directionality, mirrored); |
1502 |
} |
} |
1503 |
|
|
1504 |
/** |
/** |
1505 |
* Locates which block a character's information resides in. |
* Locates which block a character's information resides in. |
1506 |
* |
* |
1507 |
* @param ch the character to look up |
* @param ch the character to look up |
1508 |
* @return the block index, or -1 |
* @return the block, or null |
1509 |
*/ |
*/ |
1510 |
private static int getBlock(char ch) |
private static Block getBlock(char ch) |
1511 |
{ |
{ |
1512 |
// simple binary search |
// Simple binary search. |
1513 |
int low = 0; |
int low = 0; |
1514 |
int hi = blocks.length - 1; |
int hi = blocks.length - 1; |
|
int mid = 0; |
|
1515 |
while (low <= hi) |
while (low <= hi) |
1516 |
{ |
{ |
1517 |
mid = (low + hi) >> 1; |
int mid = (low + hi) >> 1; |
1518 |
Block b = blocks[mid]; |
Block b = blocks[mid]; |
1519 |
if (ch < b.start) |
if (ch < b.start) |
1520 |
hi = mid - 1; |
hi = mid - 1; |
1521 |
else if (ch > b.end) |
else if (ch > b.end) |
1522 |
low = mid + 1; |
low = mid + 1; |
1523 |
else |
else |
1524 |
return mid; |
return b; |
1525 |
} |
} |
1526 |
return -1; |
return null; |
1527 |
} |
} |
1528 |
|
|
1529 |
/** |
/** |
1586 |
* @param ch the character to convert |
* @param ch the character to convert |
1587 |
* @return a String containing the character |
* @return a String containing the character |
1588 |
* @since 1.4 |
* @since 1.4 |
|
* TODO: Add this method |
|
1589 |
*/ |
*/ |
1590 |
|
public String toString(char ch) |
1591 |
|
{ |
1592 |
|
return String.valueOf(ch); |
1593 |
|
} |
1594 |
|
|
1595 |
/** |
/** |
1596 |
* Determines if a character is a Unicode lowercase letter. For example, |
* Determines if a character is a Unicode lowercase letter. For example, |
1680 |
*/ |
*/ |
1681 |
public static boolean isDefined(char ch) |
public static boolean isDefined(char ch) |
1682 |
{ |
{ |
1683 |
return getBlock(ch) != -1; |
return getBlock(ch) != null; |
1684 |
} |
} |
1685 |
|
|
1686 |
/** |
/** |
1687 |
* Determines if a character is a Unicode letter. Not all letters have case, |
* Determines if a character is a Unicode letter. Not all letters have case, |
1688 |
* so this may return true when isLowerCase and isUpperCase return false. |
* so this may return true when isLowerCase and isUpperCase return false. |
1689 |
* <br> |
* <br> |
1690 |
* letter = [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl] |
* letter = [Lu]|[Ll]|[Lt]|[Lm]|[Lo] |
|
* TODO: Is [Nl] really part of this group? |
|
1691 |
* |
* |
1692 |
* @param ch character to test |
* @param ch character to test |
1693 |
* @return true if ch is a Unicode letter, else false |
* @return true if ch is a Unicode letter, else false |
1704 |
public static boolean isLetter(char ch) |
public static boolean isLetter(char ch) |
1705 |
{ |
{ |
1706 |
int category = getType(ch); |
int category = getType(ch); |
1707 |
return (category >= UPPERCASE_LETTER && category <= OTHER_LETTER) |
return category >= UPPERCASE_LETTER && category <= OTHER_LETTER; |
|
|| category == LETTER_NUMBER; |
|
1708 |
} |
} |
1709 |
|
|
1710 |
/** |
/** |
1711 |
* Determines if a character is a Unicode letter or a Unicode digit. This |
* Determines if a character is a Unicode letter or a Unicode digit. This |
1712 |
* is the combination of isLetter and isDigit. |
* is the combination of isLetter and isDigit. |
1713 |
* <br> |
* <br> |
1714 |
* letter or digit = [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl]|[Nd] |
* letter or digit = [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nd] |
|
* TODO: Is [Nl] really part of this group? |
|
1715 |
* |
* |
1716 |
* @param ch character to test |
* @param ch character to test |
1717 |
* @return true if ch is a Unicode letter or a Unicode digit, else false |
* @return true if ch is a Unicode letter or a Unicode digit, else false |
1725 |
public static boolean isLetterOrDigit(char ch) |
public static boolean isLetterOrDigit(char ch) |
1726 |
{ |
{ |
1727 |
int category = getType(ch); |
int category = getType(ch); |
1728 |
return (category >= UPPERCASE_LETTER && category <= OTHER_LETTER) |
return (category <= OTHER_LETTER && category >= UPPERCASE_LETTER) |
1729 |
|| category == LETTER_NUMBER || category == DECIMAL_DIGIT_NUMBER; |
|| category == DECIMAL_DIGIT_NUMBER; |
1730 |
} |
} |
1731 |
|
|
1732 |
/** |
/** |
1791 |
public static boolean isJavaIdentifierStart(char ch) |
public static boolean isJavaIdentifierStart(char ch) |
1792 |
{ |
{ |
1793 |
int category = getType(ch); |
int category = getType(ch); |
1794 |
return (category >= UPPERCASE_LETTER && category <= OTHER_LETTER) |
return (category <= OTHER_LETTER && category >= UPPERCASE_LETTER) |
1795 |
|| category == CURRENCY_SYMBOL || category == CONNECTOR_PUNCTUATION; |
|| category == LETTER_NUMBER || category == CURRENCY_SYMBOL |
1796 |
|
|| category == CONNECTOR_PUNCTUATION; |
1797 |
} |
} |
1798 |
|
|
1799 |
/** |
/** |
1805 |
* <br> |
* <br> |
1806 |
* Java identifier extender = |
* Java identifier extender = |
1807 |
* [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl]|[Sc]|[Pc]|[Mn]|[Mc]|[Nd]|[Cf] |
* [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl]|[Sc]|[Pc]|[Mn]|[Mc]|[Nd]|[Cf] |
1808 |
|
* |U+0000-U+0008|U+000E-U+001B|U+007F-U+009F |
1809 |
* |
* |
1810 |
* @param ch character to test |
* @param ch character to test |
1811 |
* @return true if ch can follow the first letter in a Java identifier |
* @return true if ch can follow the first letter in a Java identifier |
1818 |
public static boolean isJavaIdentifierPart(char ch) |
public static boolean isJavaIdentifierPart(char ch) |
1819 |
{ |
{ |
1820 |
int category = getType(ch); |
int category = getType(ch); |
1821 |
return (category >= UPPERCASE_LETTER && category <= OTHER_LETTER) |
if (category == CONTROL) |
1822 |
|| category == LETTER_NUMBER || category == CURRENCY_SYMBOL |
return isIdentifierIgnorable(ch); |
1823 |
|| category == NON_SPACING_MARK || category == COMBINING_SPACING_MARK |
return (category <= NON_SPACING_MARK && category >= UPPERCASE_LETTER) |
1824 |
|| category == DECIMAL_DIGIT_NUMBER || category == CONNECTOR_PUNCTUATION |
|| (category <= LETTER_NUMBER && category >= COMBINING_SPACING_MARK) |
1825 |
|
|| category == CURRENCY_SYMBOL || category == CONNECTOR_PUNCTUATION |
1826 |
|| category == FORMAT; |
|| category == FORMAT; |
1827 |
} |
} |
1828 |
|
|
1842 |
*/ |
*/ |
1843 |
public static boolean isUnicodeIdentifierStart(char ch) |
public static boolean isUnicodeIdentifierStart(char ch) |
1844 |
{ |
{ |
1845 |
// TODO: Fix this implementation when isLetter is fixed. |
int category = getType(ch); |
1846 |
return isLetter(ch); |
return (category <= OTHER_LETTER && category >= UPPERCASE_LETTER) |
1847 |
|
|| category == LETTER_NUMBER; |
1848 |
} |
} |
1849 |
|
|
1850 |
/** |
/** |
1854 |
* isIdentifierIgnorable. |
* isIdentifierIgnorable. |
1855 |
* <br> |
* <br> |
1856 |
* Unicode identifier extender = |
* Unicode identifier extender = |
1857 |
* [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl]|[Mn]|[Mc]|[Nd]|[Pc]|[Cf] |
* [Lu]|[Ll]|[Lt]|[Lm]|[Lo]|[Nl]|[Mn]|[Mc]|[Nd]|[Pc]|[Cf]| |
1858 |
|
* |U+0000-U+0008|U+000E-U+001B|U+007F-U+009F |
1859 |
* |
* |
1860 |
* @param ch character to test |
* @param ch character to test |
1861 |
* @return true if ch can follow the first letter in a Unicode identifier |
* @return true if ch can follow the first letter in a Unicode identifier |
1867 |
*/ |
*/ |
1868 |
public static boolean isUnicodeIdentifierPart(char ch) |
public static boolean isUnicodeIdentifierPart(char ch) |
1869 |
{ |
{ |
|
// TODO: Fixme - should this include CONTROL? |
|
1870 |
int category = getType(ch); |
int category = getType(ch); |
1871 |
return (category >= UPPERCASE_LETTER && category <= OTHER_LETTER) |
if (category == CONTROL) |
1872 |
|| category == LETTER_NUMBER || category == NON_SPACING_MARK |
return isIdentifierIgnorable(ch); |
1873 |
|| category == COMBINING_SPACING_MARK |
return (category <= NON_SPACING_MARK && category >= UPPERCASE_LETTER) |
1874 |
|| category == DECIMAL_DIGIT_NUMBER || category == CONNECTOR_PUNCTUATION |
|| (category <= LETTER_NUMBER && category >= COMBINING_SPACING_MARK) |
1875 |
|| category == FORMAT; |
|| category == CONNECTOR_PUNCTUATION || category == FORMAT; |
1876 |
} |
} |
1877 |
|
|
1878 |
/** |
/** |
1882 |
* <code>'\u001B'</code>, and <code>'\u007F'</code> through |
* <code>'\u001B'</code>, and <code>'\u007F'</code> through |
1883 |
* <code>'\u009F'</code>), and FORMAT characters. |
* <code>'\u009F'</code>), and FORMAT characters. |
1884 |
* <br> |
* <br> |
1885 |
* Unicode identifier ignorable = [Cf] |
* Unicode identifier ignorable = [Cf]|U+0000-U+0008|U+000E-U+001B |
1886 |
* TODO: Should this include CONTROL [Cc]? |
* |U+007F-U+009F |
1887 |
* |
* |
1888 |
* @param ch character to test |
* @param ch character to test |
1889 |
* @return true if ch is ignorable in a Unicode or Java identifier |
* @return true if ch is ignorable in a Unicode or Java identifier |
1893 |
*/ |
*/ |
1894 |
public static boolean isIdentifierIgnorable(char ch) |
public static boolean isIdentifierIgnorable(char ch) |
1895 |
{ |
{ |
1896 |
return getType(ch) == FORMAT; |
return ch <= '\u0008' || (ch <= '\u001B' && ch >= '\u000E') |
1897 |
|
|| (ch <= '\u009F' && ch >= '\u007F') || getType(ch) == FORMAT; |
1898 |
} |
} |
1899 |
|
|
1900 |
/** |
/** |
1912 |
*/ |
*/ |
1913 |
public static char toLowerCase(char ch) |
public static char toLowerCase(char ch) |
1914 |
{ |
{ |
1915 |
return readChar(ch).toLowerCase(); |
return readChar(ch).lowercase; |
1916 |
} |
} |
1917 |
|
|
1918 |
/** |
/** |
1930 |
*/ |
*/ |
1931 |
public static char toUpperCase(char ch) |
public static char toUpperCase(char ch) |
1932 |
{ |
{ |
1933 |
return readChar(ch).toUpperCase(); |
return readChar(ch).uppercase; |
1934 |
} |
} |
1935 |
|
|
1936 |
/** |
/** |
1956 |
/** |
/** |
1957 |
* Converts a character into a digit of the specified radix. If the radix |
* Converts a character into a digit of the specified radix. If the radix |
1958 |
* exceeds MIN_RADIX or MAX_RADIX, or if the result of getNumericValue(ch) |
* exceeds MIN_RADIX or MAX_RADIX, or if the result of getNumericValue(ch) |
1959 |
* exceeds the radix, the result is -1. |
* exceeds the radix, or if ch is not a decimal digit or in the case |
1960 |
|
* insensitive set of 'a'-'z', the result is -1. |
1961 |
* <br> |
* <br> |
1962 |
* character argument boundary = [Nd]|U+0041-U+005A|U+0061-007A |
* character argument boundary = [Nd]|U+0041-U+005A|U+0061-U+007A |
1963 |
|
* |U+FF21-U+FF3A|U+FF41-U+FF5A |
1964 |
* |
* |
1965 |
* @param ch character to convert into a digit |
* @param ch character to convert into a digit |
1966 |
* @param radix radix in which ch is a digit |
* @param radix radix in which ch is a digit |
1976 |
if (radix < MIN_RADIX || radix > MAX_RADIX) |
if (radix < MIN_RADIX || radix > MAX_RADIX) |
1977 |
return -1; |
return -1; |
1978 |
CharAttr attr = readChar(ch); |
CharAttr attr = readChar(ch); |
1979 |
if (attr.getType() == DECIMAL_DIGIT_NUMBER |
int category = attr.category; |
1980 |
&& attr.getNumericValue() < radix) |
if (category == DECIMAL_DIGIT_NUMBER || category == LOWERCASE_LETTER |
1981 |
return attr.getNumericValue(); |
|| category == UPPERCASE_LETTER) |
1982 |
if (ch >= 'A' && ch <= 'Z' && ch < radix + 'A' - 10) |
{ |
1983 |
return ch - 'A' + 10; |
int digit = attr.numericValue; |
1984 |
if (ch >= 'a' && ch <= 'z' && ch < radix + 'a' - 10) |
return (digit >= 0 && digit < radix) ? digit : -1; |
1985 |
return ch - 'a' + 10; |
} |
1986 |
return -1; |
return -1; |
1987 |
} |
} |
1988 |
|
|
2001 |
* If the character has a numeric value property which is not representable |
* If the character has a numeric value property which is not representable |
2002 |
* as a nonnegative integer, such as a fraction, -2 is returned. |
* as a nonnegative integer, such as a fraction, -2 is returned. |
2003 |
* |
* |
2004 |
|
* character argument boundary = [Nd]|[Nl]|[No]|U+0041-U+005A|U+0061-U+007A |
2005 |
|
* |U+FF21-U+FF3A|U+FF41-U+FF5A |
2006 |
|
* |
2007 |
* @param ch character from which the numeric value property will |
* @param ch character from which the numeric value property will |
2008 |
* be retrieved |
* be retrieved |
2009 |
* @return the numeric value property of ch, or -1 if it does not exist, or |
* @return the numeric value property of ch, or -1 if it does not exist, or |
2015 |
*/ |
*/ |
2016 |
public static int getNumericValue(char ch) |
public static int getNumericValue(char ch) |
2017 |
{ |
{ |
2018 |
return readChar(ch).getNumericValue(); |
return readChar(ch).numericValue; |
2019 |
} |
} |
2020 |
|
|
2021 |
/** |
/** |
2033 |
*/ |
*/ |
2034 |
public static boolean isSpace(char ch) |
public static boolean isSpace(char ch) |
2035 |
{ |
{ |
2036 |
return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\f' || ch == '\r'; |
return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' || ch == '\f'; |
2037 |
} |
} |
2038 |
|
|
2039 |
/** |
/** |
2040 |
* Determines if a character is a Unicode space character. This includes |
* Determines if a character is a Unicode space character. This includes |
2041 |
* SPACE_SEPARATOR, LINE_SEPARATOR, and PARAGRAPH_SEPARATOR. |
* SPACE_SEPARATOR, LINE_SEPARATOR, and PARAGRAPH_SEPARATOR. |
2042 |
* <br> |
* <br> |
2043 |
* Unicode space = [Zs] |
* Unicode space = [Zs]|[Zp]|[Zl] |
|
* TODO: This should include [Zp] and [Zl]. |
|
2044 |
* |
* |
2045 |
* @param ch character to test |
* @param ch character to test |
2046 |
* @return true if ch is a Unicode space, else false |
* @return true if ch is a Unicode space, else false |
2049 |
*/ |
*/ |
2050 |
public static boolean isSpaceChar(char ch) |
public static boolean isSpaceChar(char ch) |
2051 |
{ |
{ |
2052 |
return getType(ch) == SPACE_SEPARATOR; |
int category = readChar(ch).category; |
2053 |
|
return category >= SPACE_SEPARATOR && category <= PARAGRAPH_SEPARATOR; |
2054 |
} |
} |
2055 |
|
|
2056 |
/** |
/** |
2072 |
*/ |
*/ |
2073 |
public static boolean isWhitespace(char ch) |
public static boolean isWhitespace(char ch) |
2074 |
{ |
{ |
2075 |
|
if ((ch <= '\r' && ch >= '\u0009') || (ch <= '\u001F' && ch >= '\u001C')) |
2076 |
|
return true; |
2077 |
CharAttr attr = readChar(ch); |
CharAttr attr = readChar(ch); |
2078 |
int category = attr.getType(); |
int category = attr.category; |
2079 |
return (category == SPACE_SEPARATOR && ! attr.isNoBreakSpace()) |
return (category == SPACE_SEPARATOR && ! attr.noBreakSpace) |
2080 |
|| category == LINE_SEPARATOR || category == PARAGRAPH_SEPARATOR |
|| category == LINE_SEPARATOR || category == PARAGRAPH_SEPARATOR; |
|
|| (ch >= '\u0009' && ch <= '\r') |
|
|
|| (ch >= '\u001C' && ch <= '\u001F'); |
|
2081 |
} |
} |
2082 |
|
|
2083 |
/** |
/** |
2084 |
* Determines if a character has the ISO Control property. |
* Determines if a character has the ISO Control property. |
2085 |
* <br> |
* <br> |
2086 |
* ISO Control = U+0000-U+001F|U+0074-U+0094 |
* ISO Control = [Cc] |
2087 |
* |
* |
2088 |
* @param ch character to test |
* @param ch character to test |
2089 |
* @return true if ch is an ISO Control character, else false |
* @return true if ch is an ISO Control character, else false |
2093 |
*/ |
*/ |
2094 |
public static boolean isISOControl(char ch) |
public static boolean isISOControl(char ch) |
2095 |
{ |
{ |
2096 |
return (ch >= '\u0000' && ch <= '\u001F') |
return getType(ch) == CONTROL; |
|
|| (ch >= '\u007F' && ch <= '\u009F'); |
|
2097 |
} |
} |
2098 |
|
|
2099 |
/** |
/** |
2129 |
* @see #MATH_SYMBOL |
* @see #MATH_SYMBOL |
2130 |
* @see #CURRENCY_SYMBOL |
* @see #CURRENCY_SYMBOL |
2131 |
* @see #MODIFIER_SYMBOL |
* @see #MODIFIER_SYMBOL |
2132 |
|
* @see #INITIAL_QUOTE_PUNCTUATION |
2133 |
|
* @see #FINAL_QUOTE_PUNCTUATION |
2134 |
* @since 1.1 |
* @since 1.1 |
2135 |
*/ |
*/ |
2136 |
public static int getType(char ch) |
public static int getType(char ch) |
2137 |
{ |
{ |
2138 |
return readChar(ch).getType(); |
return readChar(ch).category; |
2139 |
} |
} |
2140 |
|
|
2141 |
/** |
/** |
2157 |
{ |
{ |
2158 |
if (radix < MIN_RADIX || radix > MAX_RADIX || |
if (radix < MIN_RADIX || radix > MAX_RADIX || |
2159 |
digit < 0 || digit >= radix) |
digit < 0 || digit >= radix) |
2160 |
return '\u0000'; |
return '\0'; |
2161 |
return (char) (digit < 10 ? ('0' + digit) : ('a' + digit - 10)); |
return (char) (digit < 10 ? ('0' + digit) : ('a' - 10 + digit)); |
2162 |
} |
} |
2163 |
|
|
2164 |
/** |
/** |
2165 |
* Returns the Unicode directionality property of the character. This |
* Returns the Unicode directionality property of the character. This |
2166 |
* is used in the visual ordering of text. |
* is used in the visual ordering of text. |
|
* TODO: Add this method. |
|
2167 |
* |
* |
2168 |
* @param ch the character to look up |
* @param ch the character to look up |
2169 |
* @return the directionality constant, or DIRECTIONALITY_UNDEFINED |
* @return the directionality constant, or DIRECTIONALITY_UNDEFINED |
2189 |
* @see #DIRECTIONALITY_POP_DIRECTIONAL_FORMAT |
* @see #DIRECTIONALITY_POP_DIRECTIONAL_FORMAT |
2190 |
* @since 1.4 |
* @since 1.4 |
2191 |
*/ |
*/ |
2192 |
|
public static byte getDirectionality(char ch) |
2193 |
|
{ |
2194 |
|
return readChar(ch).directionality; |
2195 |
|
} |
2196 |
|
|
2197 |
/** |
/** |
2198 |
* Determines whether the character is mirrored according to Unicode. For |
* Determines whether the character is mirrored according to Unicode. For |
2199 |
* example, <code>\u0028</code> (LEFT PARENTHESIS) appears as '(' in |
* example, <code>\u0028</code> (LEFT PARENTHESIS) appears as '(' in |
2200 |
* left-to-right text, but ')' in right-to-left text. |
* left-to-right text, but ')' in right-to-left text. |
|
* TODO: Add this method. |
|
2201 |
* |
* |
2202 |
* @param ch the character to look up |
* @param ch the character to look up |
2203 |
* @return true if the character is mirrored |
* @return true if the character is mirrored |
2204 |
* @since 1.4 |
* @since 1.4 |
2205 |
*/ |
*/ |
2206 |
|
public static boolean isMirrored(char ch) |
2207 |
|
{ |
2208 |
|
return readChar(ch).mirrored; |
2209 |
|
} |
2210 |
|
|
2211 |
/** |
/** |
2212 |
* Compares another Character to this Character, numerically. |
* Compares another Character to this Character, numerically. |
2241 |
} |
} |
2242 |
|
|
2243 |
/** |
/** |
2244 |
* Determines the Unicode character block that a character belongs to. |
* Represents an entry in gnu/java/locale/block.uni. |
|
* TODO: This should not be public API. |
|
|
* |
|
|
* @param ch character for which the Unicode character block will |
|
|
* be retrieved |
|
|
* @return the Unicode character block which ch belongs to, or null |
|
|
* if ch does not belong to any Unicode character block |
|
|
* @see Subset |
|
|
*/ |
|
|
public static Character.Subset getUnicodeBlock(char ch) |
|
|
{ |
|
|
return Character.Subset.getBlock(ch); |
|
|
} |
|
|
} //class Character |
|
|
|
|
|
/** |
|
|
* Represents an entry in block.uni. |
|
|
* TODO: This should be a private nested class of Character, as it is not |
|
|
* public in java.lang. |
|
|
*/ |
|
|
final class Block |
|
|
{ |
|
|
/** The start character of a compressed block. */ |
|
|
char start; |
|
|
/** The end character of a compressed block. */ |
|
|
char end; |
|
|
/** True if the block represents multiple characters. */ |
|
|
boolean compressed; |
|
|
/** The offset of the block. */ |
|
|
int offset; |
|
|
|
|
|
/** |
|
|
* Construct a block. |
|
|
* @param start the start character |
|
|
* @param end the end character |
|
|
* @param compressed if the block is compressed |
|
|
* @param offset the offset of the block |
|
|
*/ |
|
|
Block(char start, char end, boolean compressed, int offset) |
|
|
{ |
|
|
this.start = start; |
|
|
this.end = end; |
|
|
this.compressed = compressed; |
|
|
this.offset = offset; |
|
|
} |
|
|
} |
|
|
|
|
|
/** |
|
|
* Represents all the attributes stored for a character. |
|
|
* TODO: This should be a private nested class of Character, as it is not |
|
|
* public in java.lang. |
|
|
*/ |
|
|
final class CharAttr |
|
|
{ |
|
|
/** If the character is a non-breaking space. */ |
|
|
boolean noBreakSpace; |
|
|
/** The character category. */ |
|
|
int category; |
|
|
/** The character value. */ |
|
|
int numericalDecimalValue; |
|
|
/** The uppercase version of the character. */ |
|
|
char uppercase; |
|
|
/** The lowercase version of the character. */ |
|
|
char lowercase; |
|
|
/** The character of this attribute. */ |
|
|
char ch; |
|
|
|
|
|
/** |
|
|
* Construct the attributes for a character. |
|
|
* @param ch the character |
|
|
* @param noBreakSpace if it is a non-breaking space |
|
|
* @param category its category |
|
|
* @param numericalDecimalValue its value |
|
|
* @param uppercase the uppercase version |
|
|
* @param lowercase the lowercase version |
|
2245 |
*/ |
*/ |
2246 |
CharAttr(char ch, boolean noBreakSpace, int category, |
private static final class Block |
|
int numericalDecimalValue, |
|
|
char uppercase, char lowercase) |
|
2247 |
{ |
{ |
2248 |
this.noBreakSpace = noBreakSpace; |
/** The start character of a compressed block. */ |
2249 |
this.category = category; |
final char start; |
2250 |
this.numericalDecimalValue = numericalDecimalValue; |
/** The end character of a compressed block. */ |
2251 |
this.uppercase = uppercase; |
final char end; |
2252 |
this.lowercase = lowercase; |
/** True if the block represents multiple characters. */ |
2253 |
this.ch = ch; |
final boolean compressed; |
2254 |
} |
/** The offset of the block. */ |
2255 |
|
final int offset; |
2256 |
/** |
|
2257 |
* Check if the character is a non-breaking space. |
/** |
2258 |
* @return true if non-breaking |
* Construct a block. |
2259 |
*/ |
* @param start the start character |
2260 |
boolean isNoBreakSpace() |
* @param end the end character |
2261 |
{ |
* @param offset the offset and compression of the block: the most |
2262 |
return noBreakSpace; |
* significant bit is the compression, the remainder are the offset |
2263 |
} |
*/ |
2264 |
|
Block(char start, char end, short offset) |
2265 |
/** |
{ |
2266 |
* Return the value of the character. |
this.start = start; |
2267 |
* @return -1 if there is no value, -2 if the value is not a positive |
this.end = end; |
2268 |
* integer, or the actual value |
this.compressed = offset < 0; |
2269 |
*/ |
this.offset = offset & Short.MAX_VALUE; |
2270 |
int getNumericValue() |
} |
2271 |
{ |
} // class Block |
|
if (numericalDecimalValue == 65535) |
|
|
return -1; |
|
|
if (numericalDecimalValue == 65534) |
|
|
return -2; |
|
|
return numericalDecimalValue; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Return the character category. |
|
|
* @return the category |
|
|
*/ |
|
|
int getType() |
|
|
{ |
|
|
return category; |
|
|
} |
|
|
|
|
|
/** |
|
|
* Return the uppercase version. |
|
|
* @return the uppercase version, or this character |
|
|
*/ |
|
|
char toUpperCase() |
|
|
{ |
|
|
return (uppercase != 0) ? uppercase : ch; |
|
|
} |
|
2272 |
|
|
2273 |
/** |
/** |
2274 |
* Return the lowercase version. |
* Represents all the attributes stored for a character. |
|
* @return the lowercase version, or this character |
|
2275 |
*/ |
*/ |
2276 |
char toLowerCase() |
private static final class CharAttr |
2277 |
{ |
{ |
2278 |
return (lowercase != 0) ? lowercase : ch; |
/** The character of this attribute. */ |
2279 |
} |
final char ch; |
2280 |
} |
/** If the character is a non-breaking space. */ |
2281 |
|
final boolean noBreakSpace; |
2282 |
|
/** The character category. */ |
2283 |
|
final int category; |
2284 |
|
/** The character value. */ |
2285 |
|
final int numericValue; |
2286 |
|
/** The uppercase version of the character. */ |
2287 |
|
final char uppercase; |
2288 |
|
/** The lowercase version of the character. */ |
2289 |
|
final char lowercase; |
2290 |
|
/** The directionality of the character. */ |
2291 |
|
final byte directionality; |
2292 |
|
/** Whether the character is mirrored. */ |
2293 |
|
final boolean mirrored; |
2294 |
|
|
2295 |
|
/** |
2296 |
|
* Construct the attributes for a character. |
2297 |
|
* @param ch the character |
2298 |
|
* @param noBreakSpace if it is a non-breaking space |
2299 |
|
* @param category its category |
2300 |
|
* @param numericValue its value, or -1 (none), -2 (not representable) |
2301 |
|
* @param uppercase the uppercase version, or '\0' |
2302 |
|
* @param lowercase the lowercase version, or '\0' |
2303 |
|
* @param directionality the directionality |
2304 |
|
* @param mirrored if it is mirrored |
2305 |
|
*/ |
2306 |
|
CharAttr(char ch, boolean noBreakSpace, byte category, int numericValue, |
2307 |
|
char uppercase, char lowercase, byte directionality, |
2308 |
|
boolean mirrored) |
2309 |
|
{ |
2310 |
|
this.ch = ch; |
2311 |
|
this.noBreakSpace = noBreakSpace; |
2312 |
|
this.category = category; |
2313 |
|
this.numericValue = numericValue; |
2314 |
|
this.uppercase = uppercase == '\0' ? ch : uppercase; |
2315 |
|
this.lowercase = lowercase == '\0' ? ch : lowercase; |
2316 |
|
this.directionality = directionality; |
2317 |
|
this.mirrored = mirrored; |
2318 |
|
} |
2319 |
|
} // class CharAttr |
2320 |
|
} //class Character |