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