]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/main/classes/core/src/com/ibm/icu/lang/UScript.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / main / classes / core / src / com / ibm / icu / lang / UScript.java
1 /**\r
2 *******************************************************************************\r
3 * Copyright (C) 2001-2010 International Business Machines Corporation and     *\r
4 * others. All Rights Reserved.                                                *\r
5 *******************************************************************************\r
6 */\r
7 \r
8 package com.ibm.icu.lang;\r
9 \r
10 import java.util.Locale;\r
11 import java.util.MissingResourceException;\r
12 \r
13 import com.ibm.icu.impl.ICUResourceBundle;\r
14 import com.ibm.icu.impl.UCharacterProperty;\r
15 import com.ibm.icu.util.ULocale;\r
16 import com.ibm.icu.util.UResourceBundle;\r
17 \r
18 /**\r
19  * A class to reflect UTR #24: Script Names\r
20  * (based on ISO 15924:2000, "Code for the representation of names of\r
21  * scripts").  UTR #24 describes the basis for a new Unicode data file,\r
22  * Scripts.txt.\r
23  * @stable ICU 2.4\r
24  */\r
25 public final class UScript {\r
26     /**\r
27      * Invalid code\r
28      * @stable ICU 2.4\r
29      */\r
30     public static final int INVALID_CODE = -1;\r
31     /**\r
32      * Common\r
33      * @stable ICU 2.4\r
34      */\r
35     public static final int COMMON       =  0;  /* Zyyy */\r
36     /**\r
37      * Inherited\r
38      * @stable ICU 2.4\r
39      */\r
40     public static final int INHERITED    =  1;  /* Zinh */ /* "Code for inherited script", for non-spacing combining marks; also Qaai */\r
41     /**\r
42      * Arabic\r
43      * @stable ICU 2.4\r
44      */\r
45     public static final int ARABIC       =  2;  /* Arab */\r
46     /**\r
47      * Armenian\r
48      * @stable ICU 2.4\r
49      */\r
50     public static final int ARMENIAN     =  3;  /* Armn */\r
51     /**\r
52      * Bengali\r
53      * @stable ICU 2.4\r
54      */\r
55     public static final int BENGALI      =  4;  /* Beng */\r
56     /**\r
57      * Bopomofo\r
58      * @stable ICU 2.4\r
59      */\r
60     public static final int BOPOMOFO     =  5;  /* Bopo */\r
61     /**\r
62      * Cherokee\r
63      * @stable ICU 2.4\r
64      */\r
65     public static final int CHEROKEE     =  6;  /* Cher */\r
66     /**\r
67      * Coptic\r
68      * @stable ICU 2.4\r
69      */\r
70     public static final int COPTIC       =  7;  /* Qaac */\r
71     /**\r
72      * Cyrillic\r
73      * @stable ICU 2.4\r
74      */\r
75     public static final int CYRILLIC     =  8;  /* Cyrl (Cyrs) */\r
76     /**\r
77      * Deseret\r
78      * @stable ICU 2.4\r
79      */\r
80     public static final int DESERET      =  9;  /* Dsrt */\r
81     /**\r
82      * Devanagari\r
83      * @stable ICU 2.4\r
84      */\r
85     public static final int DEVANAGARI   = 10;  /* Deva */\r
86     /**\r
87      * Ethiopic\r
88      * @stable ICU 2.4\r
89      */\r
90     public static final int ETHIOPIC     = 11;  /* Ethi */\r
91     /**\r
92      * Georgian\r
93      * @stable ICU 2.4\r
94      */\r
95     public static final int GEORGIAN     = 12;  /* Geor (Geon; Geoa) */\r
96     /**\r
97      * Gothic\r
98      * @stable ICU 2.4\r
99      */\r
100     public static final int GOTHIC       = 13;  /* Goth */\r
101     /**\r
102      * Greek\r
103      * @stable ICU 2.4\r
104      */\r
105     public static final int GREEK        = 14;  /* Grek */\r
106     /**\r
107      * Gujarati\r
108      * @stable ICU 2.4\r
109      */\r
110     public static final int GUJARATI     = 15;  /* Gujr */\r
111     /**\r
112      * Gurmukhi\r
113      * @stable ICU 2.4\r
114      */\r
115     public static final int GURMUKHI     = 16;  /* Guru */\r
116     /**\r
117      * Han\r
118      * @stable ICU 2.4\r
119      */\r
120     public static final int HAN          = 17;  /* Hani */\r
121     /**\r
122      * Hangul\r
123      * @stable ICU 2.4\r
124      */\r
125     public static final int HANGUL       = 18;  /* Hang */\r
126     /**\r
127      * Hebrew\r
128      * @stable ICU 2.4\r
129      */\r
130     public static final int HEBREW       = 19;  /* Hebr */\r
131     /**\r
132      * Hiragana\r
133      * @stable ICU 2.4\r
134      */\r
135     public static final int HIRAGANA     = 20;  /* Hira */\r
136     /**\r
137      * Kannada\r
138      * @stable ICU 2.4\r
139      */\r
140     public static final int KANNADA      = 21;  /* Knda */\r
141     /**\r
142      * Katakana\r
143      * @stable ICU 2.4\r
144      */\r
145     public static final int KATAKANA     = 22;  /* Kana */\r
146     /**\r
147      * Khmer\r
148      * @stable ICU 2.4\r
149      */\r
150     public static final int KHMER        = 23;  /* Khmr */\r
151     /**\r
152      * Lao\r
153      * @stable ICU 2.4\r
154      */\r
155     public static final int LAO          = 24;  /* Laoo */\r
156     /**\r
157      * Latin\r
158      * @stable ICU 2.4\r
159      */\r
160     public static final int LATIN        = 25;  /* Latn (Latf; Latg) */\r
161     /**\r
162      * Malayalam\r
163      * @stable ICU 2.4\r
164      */\r
165     public static final int MALAYALAM    = 26;  /* Mlym */\r
166     /**\r
167      * Mangolian\r
168      * @stable ICU 2.4\r
169      */\r
170     public static final int MONGOLIAN    = 27;  /* Mong */\r
171     /**\r
172      * Myammar\r
173      * @stable ICU 2.4\r
174      */\r
175     public static final int MYANMAR      = 28;  /* Mymr */\r
176     /**\r
177      * Ogham\r
178      * @stable ICU 2.4\r
179      */\r
180     public static final int OGHAM        = 29;  /* Ogam */\r
181     /**\r
182      * Old Itallic\r
183      * @stable ICU 2.4\r
184      */\r
185     public static final int OLD_ITALIC   = 30;  /* Ital */\r
186     /**\r
187      * Oriya\r
188      * @stable ICU 2.4\r
189      */\r
190     public static final int ORIYA        = 31;  /* Orya */\r
191     /**\r
192      * Runic\r
193      * @stable ICU 2.4\r
194      */\r
195     public static final int RUNIC        = 32;  /* Runr */\r
196     /**\r
197      * Sinhala\r
198      * @stable ICU 2.4\r
199      */\r
200     public static final int SINHALA      = 33;  /* Sinh */\r
201     /**\r
202      * Syriac\r
203      * @stable ICU 2.4\r
204      */\r
205     public static final int SYRIAC       = 34;  /* Syrc (Syrj; Syrn; Syre) */\r
206     /**\r
207      * Tamil\r
208      * @stable ICU 2.4\r
209      */\r
210     public static final int TAMIL        = 35;  /* Taml */\r
211     /**\r
212      * Telugu\r
213      * @stable ICU 2.4\r
214      */\r
215     public static final int TELUGU       = 36;  /* Telu */\r
216     /**\r
217      * Thana\r
218      * @stable ICU 2.4\r
219      */\r
220     public static final int THAANA       = 37;  /* Thaa */\r
221     /**\r
222      * Thai\r
223      * @stable ICU 2.4\r
224      */\r
225     public static final int THAI         = 38;  /* Thai */\r
226     /**\r
227      * Tibetan\r
228      * @stable ICU 2.4\r
229      */\r
230     public static final int TIBETAN      = 39;  /* Tibt */\r
231     /**\r
232      * Unified Canadian Aboriginal Symbols\r
233      * @stable ICU 2.6\r
234      */\r
235     public static final int CANADIAN_ABORIGINAL = 40;  /* Cans */\r
236     /**\r
237      * Unified Canadian Aboriginal Symbols (alias)\r
238      * @stable ICU 2.4\r
239      */\r
240     public static final int UCAS         = CANADIAN_ABORIGINAL;  /* Cans */\r
241     /**\r
242      * Yi syllables\r
243      * @stable ICU 2.4\r
244      */\r
245     public static final int YI           = 41;  /* Yiii */\r
246     /**\r
247      * Tagalog\r
248      * @stable ICU 2.4\r
249      */\r
250     public static final int TAGALOG      = 42;  /* Tglg */\r
251     /**\r
252      * Hanunooo\r
253      * @stable ICU 2.4\r
254      */\r
255     public static final int HANUNOO      = 43;  /* Hano */\r
256     /**\r
257      * Buhid\r
258      * @stable ICU 2.4\r
259      */\r
260     public static final int BUHID        = 44;  /* Buhd */\r
261     /**\r
262      * Tagbanwa\r
263      * @stable ICU 2.4\r
264      */\r
265     public static final int TAGBANWA     = 45;  /* Tagb */\r
266     /**\r
267      * Braille\r
268      * Script in Unicode 4 \r
269      * @stable ICU 2.6 \r
270      * \r
271      */ \r
272     public static final int BRAILLE      = 46;  /* Brai */\r
273     /**\r
274      * Cypriot\r
275      * Script in Unicode 4 \r
276      * @stable ICU 2.6 \r
277      * \r
278      */  \r
279     public static final int CYPRIOT              = 47;  /* Cprt */ \r
280     /**\r
281      * Limbu\r
282      * Script in Unicode 4 \r
283      * @stable ICU 2.6 \r
284      * \r
285      */       \r
286     public static final int LIMBU                = 48;  /* Limb */ \r
287     /**\r
288      * Linear B\r
289      * Script in Unicode 4 \r
290      * @stable ICU 2.6 \r
291      * \r
292      */ \r
293     public static final int LINEAR_B     = 49;  /* Linb */ \r
294     /**\r
295      * Osmanya\r
296      * Script in Unicode 4 \r
297      * @stable ICU 2.6 \r
298      * \r
299      */ \r
300     public static final int OSMANYA              = 50;  /* Osma */ \r
301     /**\r
302      * Shavian\r
303      * Script in Unicode 4 \r
304      * @stable ICU 2.6 \r
305      * \r
306      */ \r
307     public static final int SHAVIAN              = 51;  /* Shaw */ \r
308     /**\r
309      * Tai Le\r
310      * Script in Unicode 4 \r
311      * @stable ICU 2.6 \r
312      * \r
313      */ \r
314     public static final int TAI_LE               = 52;  /* Tale */ \r
315     /**\r
316      * Ugaritic\r
317      * Script in Unicode 4 \r
318      * @stable ICU 2.6 \r
319      * \r
320      */ \r
321     public static final int UGARITIC     = 53;  /* Ugar */ \r
322     /**\r
323      * Script in Unicode 4.0.1\r
324      * @stable ICU 3.0\r
325      */\r
326     public static final int KATAKANA_OR_HIRAGANA = 54;  /*Hrkt */\r
327 \r
328     /**\r
329      * Script in Unicode 4.1\r
330      * @stable ICU 3.4\r
331      */\r
332     public static final int BUGINESE = 55;           /* Bugi */\r
333     /**\r
334      * Script in Unicode 4.1\r
335      * @stable ICU 3.4\r
336      */\r
337     public static final int GLAGOLITIC = 56;         /* Glag */\r
338     /**\r
339      * Script in Unicode 4.1\r
340      * @stable ICU 3.4\r
341      */\r
342     public static final int KHAROSHTHI = 57;         /* Khar */\r
343     /**\r
344      * Script in Unicode 4.1\r
345      * @stable ICU 3.4\r
346      */\r
347     public static final int SYLOTI_NAGRI = 58;       /* Sylo */\r
348     /**\r
349      * Script in Unicode 4.1\r
350      * @stable ICU 3.4\r
351      */\r
352     public static final int NEW_TAI_LUE = 59;        /* Talu */\r
353     /**\r
354      * Script in Unicode 4.1\r
355      * @stable ICU 3.4\r
356      */\r
357     public static final int TIFINAGH = 60;           /* Tfng */\r
358     /**\r
359      * Script in Unicode 4.1\r
360      * @stable ICU 3.4\r
361      */\r
362     public static final int OLD_PERSIAN = 61;        /* Xpeo */\r
363 \r
364 \r
365     /**\r
366      * ISO 15924 script code\r
367      * @stable ICU 3.6\r
368      */\r
369     public static final int BALINESE                      = 62; /* Bali */\r
370     /**\r
371      * ISO 15924 script code\r
372      * @stable ICU 3.6\r
373      */\r
374     public static final int BATAK                         = 63; /* Batk */\r
375     /**\r
376      * ISO 15924 script code\r
377      * @stable ICU 3.6\r
378      */\r
379     public static final int BLISSYMBOLS                   = 64; /* Blis */\r
380     /**\r
381      * ISO 15924 script code\r
382      * @stable ICU 3.6\r
383      */\r
384     public static final int BRAHMI                        = 65; /* Brah */\r
385     /**\r
386      * ISO 15924 script code\r
387      * @stable ICU 3.6\r
388      */\r
389     public static final int CHAM                          = 66; /* Cham */\r
390     /**\r
391      * ISO 15924 script code\r
392      * @stable ICU 3.6\r
393      */\r
394     public static final int CIRTH                         = 67; /* Cirt */\r
395     /**\r
396      * ISO 15924 script code\r
397      * @stable ICU 3.6\r
398      */\r
399     public static final int OLD_CHURCH_SLAVONIC_CYRILLIC  = 68; /* Cyrs */\r
400     /**\r
401      * ISO 15924 script code\r
402      * @stable ICU 3.6\r
403      */\r
404     public static final int DEMOTIC_EGYPTIAN              = 69; /* Egyd */\r
405     /**\r
406      * ISO 15924 script code\r
407      * @stable ICU 3.6\r
408      */\r
409     public static final int HIERATIC_EGYPTIAN             = 70; /* Egyh */\r
410     /**\r
411      * ISO 15924 script code\r
412      * @stable ICU 3.6\r
413      */\r
414     public static final int EGYPTIAN_HIEROGLYPHS          = 71; /* Egyp */\r
415     /**\r
416      * ISO 15924 script code\r
417      * @stable ICU 3.6\r
418      */\r
419     public static final int KHUTSURI                      = 72; /* Geok */\r
420     /**\r
421      * ISO 15924 script code\r
422      * @stable ICU 3.6\r
423      */\r
424     public static final int SIMPLIFIED_HAN                = 73; /* Hans */\r
425     /**\r
426      * ISO 15924 script code\r
427      * @stable ICU 3.6\r
428      */\r
429     public static final int TRADITIONAL_HAN               = 74; /* Hant */\r
430     /**\r
431      * ISO 15924 script code\r
432      * @stable ICU 3.6\r
433      */\r
434     public static final int PAHAWH_HMONG                  = 75; /* Hmng */\r
435     /**\r
436      * ISO 15924 script code\r
437      * @stable ICU 3.6\r
438      */\r
439     public static final int OLD_HUNGARIAN                 = 76; /* Hung */\r
440     /**\r
441      * ISO 15924 script code\r
442      * @stable ICU 3.6\r
443      */\r
444     public static final int HARAPPAN_INDUS                = 77; /* Inds */\r
445     /**\r
446      * ISO 15924 script code\r
447      * @stable ICU 3.6\r
448      */\r
449     public static final int JAVANESE                      = 78; /* Java */\r
450     /**\r
451      * ISO 15924 script code\r
452      * @stable ICU 3.6\r
453      */\r
454     public static final int KAYAH_LI                      = 79; /* Kali */\r
455     /**\r
456      * ISO 15924 script code\r
457      * @stable ICU 3.6\r
458      */\r
459     public static final int LATIN_FRAKTUR                 = 80; /* Latf */\r
460     /**\r
461      * ISO 15924 script code\r
462      * @stable ICU 3.6\r
463      */\r
464     public static final int LATIN_GAELIC                  = 81; /* Latg */\r
465     /**\r
466      * ISO 15924 script code\r
467      * @stable ICU 3.6\r
468      */\r
469     public static final int LEPCHA                        = 82; /* Lepc */\r
470     /**\r
471      * ISO 15924 script code\r
472      * @stable ICU 3.6\r
473      */\r
474     public static final int LINEAR_A                      = 83; /* Lina */\r
475     /**\r
476      * ISO 15924 script code\r
477      * @stable ICU 3.6\r
478      */\r
479     public static final int MANDAEAN                      = 84; /* Mand */\r
480     /**\r
481      * ISO 15924 script code\r
482      * @stable ICU 3.6\r
483      */\r
484     public static final int MAYAN_HIEROGLYPHS             = 85; /* Maya */\r
485     /**\r
486      * ISO 15924 script code\r
487      * @stable ICU 3.6\r
488      */\r
489     public static final int MEROITIC                      = 86; /* Mero */\r
490     /**\r
491      * ISO 15924 script code\r
492      * @stable ICU 3.6\r
493      */\r
494     public static final int NKO                           = 87; /* Nkoo */\r
495     /**\r
496      * ISO 15924 script code\r
497      * @stable ICU 3.6\r
498      */\r
499     public static final int ORKHON                        = 88; /* Orkh */\r
500     /**\r
501      * ISO 15924 script code\r
502      * @stable ICU 3.6\r
503      */\r
504     public static final int OLD_PERMIC                    = 89; /* Perm */\r
505     /**\r
506      * ISO 15924 script code\r
507      * @stable ICU 3.6\r
508      */\r
509     public static final int PHAGS_PA                      = 90; /* Phag */\r
510     /**\r
511      * ISO 15924 script code\r
512      * @stable ICU 3.6\r
513      */\r
514     public static final int PHOENICIAN                    = 91; /* Phnx */\r
515     /**\r
516      * ISO 15924 script code\r
517      * @stable ICU 3.6\r
518      */\r
519     public static final int PHONETIC_POLLARD              = 92; /* Plrd */\r
520     /**\r
521      * ISO 15924 script code\r
522      * @stable ICU 3.6\r
523      */\r
524     public static final int RONGORONGO                    = 93; /* Roro */\r
525     /**\r
526      * ISO 15924 script code\r
527      * @stable ICU 3.6\r
528      */\r
529     public static final int SARATI                        = 94; /* Sara */\r
530     /**\r
531      * ISO 15924 script code\r
532      * @stable ICU 3.6\r
533      */\r
534     public static final int ESTRANGELO_SYRIAC             = 95; /* Syre */\r
535     /**\r
536      * ISO 15924 script code\r
537      * @stable ICU 3.6\r
538      */\r
539     public static final int WESTERN_SYRIAC                = 96; /* Syrj */\r
540     /**\r
541      * ISO 15924 script code\r
542      * @stable ICU 3.6\r
543      */\r
544     public static final int EASTERN_SYRIAC                = 97; /* Syrn */\r
545     /**\r
546      * ISO 15924 script code\r
547      * @stable ICU 3.6\r
548      */\r
549     public static final int TENGWAR                       = 98; /* Teng */\r
550     /**\r
551      * ISO 15924 script code\r
552      * @stable ICU 3.6\r
553      */\r
554     public static final int VAI                           = 99; /* Vaii */\r
555     /**\r
556      * ISO 15924 script code\r
557      * @stable ICU 3.6\r
558      */\r
559     public static final int VISIBLE_SPEECH                = 100;/* Visp */\r
560     /**\r
561      * ISO 15924 script code\r
562      * @stable ICU 3.6\r
563      */\r
564     public static final int CUNEIFORM                     = 101;/* Xsux */\r
565     /**\r
566      * ISO 15924 script code\r
567      * @stable ICU 3.6\r
568      */\r
569     public static final int UNWRITTEN_LANGUAGES           = 102;/* Zxxx */\r
570     /**\r
571      * ISO 15924 script code\r
572      * @stable ICU 3.6\r
573      */\r
574     public static final int UNKNOWN                       = 103;/* Zzzz */ /* Unknown="Code for uncoded script", for unassigned code points */\r
575     \r
576     /* Private use codes from Qaaa - Qabx are not supported*/\r
577     /**\r
578      * ISO 15924 script code\r
579      * @stable ICU 3.8\r
580      */ \r
581     public static final int CARIAN                        = 104;/* Cari */\r
582     /**\r
583      * ISO 15924 script code\r
584      * @stable ICU 3.8\r
585      */\r
586     public static final int JAPANESE                      = 105;/* Jpan */\r
587     /**\r
588      * ISO 15924 script code\r
589      * @stable ICU 3.8\r
590      */\r
591     public static final int LANNA                         = 106;/* Lana */\r
592     /**\r
593      * ISO 15924 script code\r
594      * @stable ICU 3.8\r
595      */\r
596     public static final int LYCIAN                        = 107;/* Lyci */\r
597     /**\r
598      * ISO 15924 script code\r
599      * @stable ICU 3.8\r
600      */\r
601     public static final int LYDIAN                        = 108;/* Lydi */\r
602     /**\r
603      * ISO 15924 script code\r
604      * @stable ICU 3.8\r
605      */\r
606     public static final int OL_CHIKI                      = 109;/* Olck */\r
607     /**\r
608      * ISO 15924 script code\r
609      * @stable ICU 3.8\r
610      */\r
611     public static final int REJANG                        = 110;/* Rjng */\r
612     /**\r
613      * ISO 15924 script code\r
614      * @stable ICU 3.8\r
615      */\r
616     public static final int SAURASHTRA                    = 111;/* Saur */\r
617     /**\r
618      * ISO 15924 script code\r
619      * @stable ICU 3.8\r
620      */\r
621     public static final int SIGN_WRITING                  = 112;/* Sgnw */\r
622     /**\r
623      * ISO 15924 script code\r
624      * @stable ICU 3.8\r
625      */\r
626     public static final int SUNDANESE                     = 113;/* Sund */\r
627     /**\r
628      * ISO 15924 script code\r
629      * @stable ICU 3.8\r
630      */\r
631     public static final int MOON                          = 114;/* Moon */\r
632     /**\r
633      * ISO 15924 script code\r
634      * @stable ICU 3.8\r
635      */\r
636     public static final int MEITEI_MAYEK                  = 115;/* Mtei */\r
637     \r
638     /**\r
639      * ISO 15924 script code\r
640      * @stable ICU 4.0\r
641      */\r
642     public static final int IMPERIAL_ARAMAIC              = 116;/* Armi */\r
643 \r
644     /**\r
645      * ISO 15924 script code\r
646      * @stable ICU 4.0\r
647      */\r
648     public static final int AVESTAN                       = 117;/* Avst */\r
649 \r
650     /**\r
651      * ISO 15924 script code\r
652      * @stable ICU 4.0\r
653      */\r
654     public static final int CHAKMA                        = 118;/* Cakm */\r
655 \r
656     /**\r
657      * ISO 15924 script code\r
658      * @stable ICU 4.0\r
659      */\r
660     public static final int KOREAN                        = 119;/* Kore */\r
661 \r
662     /**\r
663      * ISO 15924 script code\r
664      * @stable ICU 4.0\r
665      */\r
666     public static final int KAITHI                        = 120;/* Kthi */\r
667 \r
668     /**\r
669      * ISO 15924 script code\r
670      * @stable ICU 4.0\r
671      */\r
672     public static final int MANICHAEAN                    = 121;/* Mani */\r
673 \r
674     /**\r
675      * ISO 15924 script code\r
676      * @stable ICU 4.0\r
677      */\r
678     public static final int INSCRIPTIONAL_PAHLAVI         = 122;/* Phli */\r
679 \r
680     /**\r
681      * ISO 15924 script code\r
682      * @stable ICU 4.0\r
683      */\r
684     public static final int PSALTER_PAHLAVI               = 123;/* Phlp */\r
685 \r
686     /**\r
687      * ISO 15924 script code\r
688      * @stable ICU 4.0\r
689      */\r
690     public static final int BOOK_PAHLAVI                  = 124;/* Phlv */\r
691 \r
692     /**\r
693      * ISO 15924 script code\r
694      * @stable ICU 4.0\r
695      */\r
696     public static final int INSCRIPTIONAL_PARTHIAN        = 125;/* Prti */\r
697 \r
698     /**\r
699      * ISO 15924 script code\r
700      * @stable ICU 4.0\r
701      */\r
702     public static final int SAMARITAN                     = 126;/* Samr */\r
703 \r
704     /**\r
705      * ISO 15924 script code\r
706      * @stable ICU 4.0\r
707      */\r
708     public static final int TAI_VIET                      = 127;/* Tavt */\r
709 \r
710     /**\r
711      * ISO 15924 script code\r
712      * @stable ICU 4.0\r
713      */\r
714     public static final int MATHEMATICAL_NOTATION         = 128;/* Zmth */\r
715 \r
716     /**\r
717      * ISO 15924 script code\r
718      * @stable ICU 4.0\r
719      */\r
720     public static final int SYMBOLS                       = 129;/* Zsym */\r
721 \r
722     /**\r
723      * ISO 15924 script code\r
724      * @stable ICU 4.4\r
725      */\r
726     public static final int BAMUM                         = 130;/* Bamu */\r
727     /**\r
728      * ISO 15924 script code\r
729      * @stable ICU 4.4\r
730      */\r
731     public static final int LISU                          = 131;/* Lisu */\r
732     /**\r
733      * ISO 15924 script code\r
734      * @stable ICU 4.4\r
735      */\r
736     public static final int NAKHI_GEBA                    = 132;/* Nkgb */\r
737     /**\r
738      * ISO 15924 script code\r
739      * @stable ICU 4.4\r
740      */\r
741     public static final int OLD_SOUTH_ARABIAN             = 133;/* Sarb */\r
742 \r
743     /**\r
744      * Limit\r
745      * @stable ICU 2.4\r
746      */\r
747     public static final int CODE_LIMIT   = 134;\r
748 \r
749     private static final String kLocaleScript = "LocaleScript";\r
750     \r
751     //private static final String INVALID_NAME = "Invalid";\r
752     /**\r
753      * Helper function to find the code from locale.\r
754      * @param locale The locale.\r
755      */\r
756     private static int[] findCodeFromLocale(ULocale locale) {\r
757         ICUResourceBundle rb;\r
758         \r
759         try {\r
760             rb = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, locale);\r
761         } catch (MissingResourceException e) {\r
762             /* This part seems to never be called since "UResourceBundle.getBundleInstance"\r
763              * corrects this by setting to ICUResourceBundle.FROM_DEFAULT\r
764              * when such an invalid locale is passed.\r
765              */\r
766             ///CLOVER:OFF\r
767             return null;\r
768             ///CLOVER:ON\r
769         }\r
770         \r
771         rb = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, locale);\r
772         \r
773         // if rb is not a strict fallback of the requested locale, return null\r
774         //if(!LocaleUtility.isFallbackOf(rb.getULocale().toString(), locale.toString())){\r
775         //    return null;\r
776         //}\r
777         //non existent locale check\r
778         if(rb.getLoadingStatus()==ICUResourceBundle.FROM_DEFAULT && ! locale.equals(ULocale.getDefault())){\r
779             return null;\r
780         }\r
781         UResourceBundle sub = rb.get(kLocaleScript);\r
782         \r
783         int[] result = new int[sub.getSize()];\r
784         int w = 0;\r
785         for (int i = 0; i < result.length; ++i) {\r
786             int code = UCharacter.getPropertyValueEnum(UProperty.SCRIPT,\r
787                                                        sub.getString(i));\r
788             result[w++] = code;\r
789 \r
790         }\r
791 \r
792         if (w < result.length) {\r
793             throw new IllegalStateException("bad locale data, listed " + \r
794                  result.length + " scripts but found only " + w);\r
795         }\r
796 \r
797         return result;\r
798     }\r
799 \r
800     /**\r
801      * Gets a script codes associated with the given locale or ISO 15924 abbreviation or name.\r
802      * Returns MALAYAM given "Malayam" OR "Mlym".\r
803      * Returns LATIN given "en" OR "en_US"\r
804      * @param locale Locale\r
805      * @return The script codes array. null if the the code cannot be found.\r
806      * @stable ICU 2.4\r
807      */\r
808     public static final int[] getCode(Locale locale){\r
809         return findCodeFromLocale(ULocale.forLocale(locale));\r
810     }\r
811     /**\r
812      * Gets a script codes associated with the given locale or ISO 15924 abbreviation or name.\r
813      * Returns MALAYAM given "Malayam" OR "Mlym".\r
814      * Returns LATIN given "en" OR "en_US"\r
815      * @param locale ULocale\r
816      * @return The script codes array. null if the the code cannot be found.\r
817      * @stable ICU 3.0\r
818      */\r
819     public static final int[] getCode(ULocale locale){\r
820         return findCodeFromLocale(locale);\r
821     }\r
822     /**\r
823      * Gets a script codes associated with the given locale or ISO 15924 abbreviation or name.\r
824      * Returns MALAYAM given "Malayam" OR "Mlym".\r
825      * Returns LATIN given "en" OR "en_US"\r
826      *\r
827      * <p>Note: To search by short or long script alias only, use\r
828      * UCharacater.getPropertyValueEnum(UProperty.SCRIPT, alias)\r
829      * instead.  This does a fast lookup with no access of the locale\r
830      * data.\r
831      * @param nameOrAbbrOrLocale name of the script or ISO 15924 code or locale\r
832      * @return The script codes array. null if the the code cannot be found.\r
833      * @stable ICU 2.4\r
834      */\r
835     public static final int[] getCode(String nameOrAbbrOrLocale){\r
836         try {\r
837             return new int[] {\r
838                 UCharacter.getPropertyValueEnum(UProperty.SCRIPT,\r
839                                                 nameOrAbbrOrLocale)\r
840             };\r
841         } catch (IllegalArgumentException e) {\r
842             return findCodeFromLocale(new ULocale(nameOrAbbrOrLocale));\r
843         }\r
844     }\r
845 \r
846     /**\r
847      * Gets a script codes associated with the given ISO 15924 abbreviation or name.\r
848      * Returns MALAYAM given "Malayam" OR "Mlym".\r
849      *\r
850      * @param nameOrAbbr name of the script or ISO 15924 code\r
851      * @return The script code value or INVALID_CODE if the code cannot be found.\r
852      * @internal\r
853      * @deprecated This API is ICU internal only.\r
854      */\r
855     public static final int getCodeFromName(String nameOrAbbr) {\r
856         try {\r
857             return UCharacter.getPropertyValueEnum(UProperty.SCRIPT,\r
858                                                    nameOrAbbr);\r
859         } catch (IllegalArgumentException e) {\r
860             return INVALID_CODE;\r
861         }\r
862     }\r
863 \r
864     /**\r
865      * Gets the script code associated with the given codepoint.\r
866      * Returns UScript.MALAYAM given 0x0D02\r
867      * @param codepoint UChar32 codepoint\r
868      * @return The script code\r
869      * @stable ICU 2.4\r
870      */\r
871     public static final int getScript(int codepoint){\r
872         if (codepoint >= UCharacter.MIN_VALUE & codepoint <= UCharacter.MAX_VALUE) {\r
873             return (UCharacterProperty.INSTANCE.getAdditional(codepoint,0) & UCharacter.SCRIPT_MASK_);\r
874         }else{\r
875             throw new IllegalArgumentException(Integer.toString(codepoint));\r
876         }\r
877     }\r
878 \r
879     /**\r
880      * Gets a script name associated with the given script code.\r
881      * Returns  "Malayam" given MALAYAM\r
882      * @param scriptCode int script code\r
883      * @return script name as a string in full as given in TR#24\r
884      * @stable ICU 2.4\r
885      */\r
886     public static final String getName(int scriptCode){\r
887         return UCharacter.getPropertyValueName(UProperty.SCRIPT,\r
888                                                scriptCode,\r
889                                                UProperty.NameChoice.LONG);\r
890     }\r
891 \r
892     /**\r
893      * Gets a script name associated with the given script code.\r
894      * Returns  "Mlym" given MALAYAM\r
895      * @param scriptCode int script code\r
896      * @return script abbreviated name as a string  as given in TR#24\r
897      * @stable ICU 2.4\r
898      */\r
899     public static final String getShortName(int scriptCode){\r
900         return UCharacter.getPropertyValueName(UProperty.SCRIPT,\r
901                                                scriptCode,\r
902                                                UProperty.NameChoice.SHORT);\r
903     }\r
904     ///CLOVER:OFF\r
905     /**\r
906      *  Private Constructor. Never default construct\r
907      */\r
908     private UScript(){}\r
909     ///CLOVER:ON\r
910 }\r