Source Code Cross Referenced for UScript.java in  » Internationalization-Localization » icu4j » com » ibm » icu » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Internationalization Localization » icu4j » com.ibm.icu.lang 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *******************************************************************************
003:         * Copyright (C) 2001-2006, International Business Machines Corporation and         *
004:         * others. All Rights Reserved.                                                *
005:         *******************************************************************************
006:         */package com.ibm.icu.lang;
007:
008:        import com.ibm.icu.impl.ICUResourceBundle;
009:        import com.ibm.icu.impl.UCharacterProperty;
010:        import com.ibm.icu.util.ULocale;
011:        import com.ibm.icu.util.UResourceBundle;
012:
013:        import java.util.Locale;
014:        import java.util.MissingResourceException;
015:
016:        /**
017:         * A class to reflect UTR #24: Script Names
018:         * (based on ISO 15924:2000, "Code for the representation of names of
019:         * scripts").  UTR #24 describes the basis for a new Unicode data file,
020:         * Scripts.txt.
021:         * @stable ICU 2.4
022:         */
023:        public final class UScript {
024:            /**
025:             * Puts a copyright in the .class file
026:             */
027:            private static final String copyrightNotice = "Copyright \u00a92001 IBM Corp.  All rights reserved.";
028:
029:            /**
030:             * Invalid code
031:             * @stable ICU 2.4
032:             */
033:            public static final int INVALID_CODE = -1;
034:            /**
035:             * Common
036:             * @stable ICU 2.4
037:             */
038:            public static final int COMMON = 0; /* Zyyy */
039:            /**
040:             * Inherited
041:             * @stable ICU 2.4
042:             */
043:            public static final int INHERITED = 1; /* Qaai */
044:            /**
045:             * Arabic
046:             * @stable ICU 2.4
047:             */
048:            public static final int ARABIC = 2; /* Arab */
049:            /**
050:             * Armenian
051:             * @stable ICU 2.4
052:             */
053:            public static final int ARMENIAN = 3; /* Armn */
054:            /**
055:             * Bengali
056:             * @stable ICU 2.4
057:             */
058:            public static final int BENGALI = 4; /* Beng */
059:            /**
060:             * Bopomofo
061:             * @stable ICU 2.4
062:             */
063:            public static final int BOPOMOFO = 5; /* Bopo */
064:            /**
065:             * Cherokee
066:             * @stable ICU 2.4
067:             */
068:            public static final int CHEROKEE = 6; /* Cher */
069:            /**
070:             * Coptic
071:             * @stable ICU 2.4
072:             */
073:            public static final int COPTIC = 7; /* Qaac */
074:            /**
075:             * Cyrillic
076:             * @stable ICU 2.4
077:             */
078:            public static final int CYRILLIC = 8; /* Cyrl (Cyrs) */
079:            /**
080:             * Deseret
081:             * @stable ICU 2.4
082:             */
083:            public static final int DESERET = 9; /* Dsrt */
084:            /**
085:             * Devanagari
086:             * @stable ICU 2.4
087:             */
088:            public static final int DEVANAGARI = 10; /* Deva */
089:            /**
090:             * Ethiopic
091:             * @stable ICU 2.4
092:             */
093:            public static final int ETHIOPIC = 11; /* Ethi */
094:            /**
095:             * Georgian
096:             * @stable ICU 2.4
097:             */
098:            public static final int GEORGIAN = 12; /* Geor (Geon; Geoa) */
099:            /**
100:             * Gothic
101:             * @stable ICU 2.4
102:             */
103:            public static final int GOTHIC = 13; /* Goth */
104:            /**
105:             * Greek
106:             * @stable ICU 2.4
107:             */
108:            public static final int GREEK = 14; /* Grek */
109:            /**
110:             * Gujarati
111:             * @stable ICU 2.4
112:             */
113:            public static final int GUJARATI = 15; /* Gujr */
114:            /**
115:             * Gurmukhi
116:             * @stable ICU 2.4
117:             */
118:            public static final int GURMUKHI = 16; /* Guru */
119:            /**
120:             * Han
121:             * @stable ICU 2.4
122:             */
123:            public static final int HAN = 17; /* Hani */
124:            /**
125:             * Hangul
126:             * @stable ICU 2.4
127:             */
128:            public static final int HANGUL = 18; /* Hang */
129:            /**
130:             * Hebrew
131:             * @stable ICU 2.4
132:             */
133:            public static final int HEBREW = 19; /* Hebr */
134:            /**
135:             * Hiragana
136:             * @stable ICU 2.4
137:             */
138:            public static final int HIRAGANA = 20; /* Hira */
139:            /**
140:             * Kannada
141:             * @stable ICU 2.4
142:             */
143:            public static final int KANNADA = 21; /* Knda */
144:            /**
145:             * Katakana
146:             * @stable ICU 2.4
147:             */
148:            public static final int KATAKANA = 22; /* Kana */
149:            /**
150:             * Khmer
151:             * @stable ICU 2.4
152:             */
153:            public static final int KHMER = 23; /* Khmr */
154:            /**
155:             * Lao
156:             * @stable ICU 2.4
157:             */
158:            public static final int LAO = 24; /* Laoo */
159:            /**
160:             * Latin
161:             * @stable ICU 2.4
162:             */
163:            public static final int LATIN = 25; /* Latn (Latf; Latg) */
164:            /**
165:             * Malayalam
166:             * @stable ICU 2.4
167:             */
168:            public static final int MALAYALAM = 26; /* Mlym */
169:            /**
170:             * Mangolian
171:             * @stable ICU 2.4
172:             */
173:            public static final int MONGOLIAN = 27; /* Mong */
174:            /**
175:             * Myammar
176:             * @stable ICU 2.4
177:             */
178:            public static final int MYANMAR = 28; /* Mymr */
179:            /**
180:             * Ogham
181:             * @stable ICU 2.4
182:             */
183:            public static final int OGHAM = 29; /* Ogam */
184:            /**
185:             * Old Itallic
186:             * @stable ICU 2.4
187:             */
188:            public static final int OLD_ITALIC = 30; /* Ital */
189:            /**
190:             * Oriya
191:             * @stable ICU 2.4
192:             */
193:            public static final int ORIYA = 31; /* Orya */
194:            /**
195:             * Runic
196:             * @stable ICU 2.4
197:             */
198:            public static final int RUNIC = 32; /* Runr */
199:            /**
200:             * Sinhala
201:             * @stable ICU 2.4
202:             */
203:            public static final int SINHALA = 33; /* Sinh */
204:            /**
205:             * Syriac
206:             * @stable ICU 2.4
207:             */
208:            public static final int SYRIAC = 34; /* Syrc (Syrj; Syrn; Syre) */
209:            /**
210:             * Tamil
211:             * @stable ICU 2.4
212:             */
213:            public static final int TAMIL = 35; /* Taml */
214:            /**
215:             * Telugu
216:             * @stable ICU 2.4
217:             */
218:            public static final int TELUGU = 36; /* Telu */
219:            /**
220:             * Thana
221:             * @stable ICU 2.4
222:             */
223:            public static final int THAANA = 37; /* Thaa */
224:            /**
225:             * Thai
226:             * @stable ICU 2.4
227:             */
228:            public static final int THAI = 38; /* Thai */
229:            /**
230:             * Tibetan
231:             * @stable ICU 2.4
232:             */
233:            public static final int TIBETAN = 39; /* Tibt */
234:            /**
235:             * Unified Canadian Aboriginal Symbols
236:             * @stable ICU 2.6
237:             */
238:            public static final int CANADIAN_ABORIGINAL = 40; /* Cans */
239:            /**
240:             * Unified Canadian Aboriginal Symbols (alias)
241:             * @stable ICU 2.4
242:             */
243:            public static final int UCAS = CANADIAN_ABORIGINAL; /* Cans */
244:            /**
245:             * Yi syllables
246:             * @stable ICU 2.4
247:             */
248:            public static final int YI = 41; /* Yiii */
249:            /**
250:             * Tagalog
251:             * @stable ICU 2.4
252:             */
253:            public static final int TAGALOG = 42; /* Tglg */
254:            /**
255:             * Hanunooo
256:             * @stable ICU 2.4
257:             */
258:            public static final int HANUNOO = 43; /* Hano */
259:            /**
260:             * Buhid
261:             * @stable ICU 2.4
262:             */
263:            public static final int BUHID = 44; /* Buhd */
264:            /**
265:             * Tagbanwa
266:             * @stable ICU 2.4
267:             */
268:            public static final int TAGBANWA = 45; /* Tagb */
269:            /**
270:             * Braille
271:             * New script in Unicode 4 
272:             * @stable ICU 2.6 
273:             * 
274:             */
275:            public static final int BRAILLE = 46; /* Brai */
276:            /**
277:             * Cypriot
278:             * New script in Unicode 4 
279:             * @stable ICU 2.6 
280:             * 
281:             */
282:            public static final int CYPRIOT = 47; /* Cprt */
283:            /**
284:             * Limbu
285:             * New script in Unicode 4 
286:             * @stable ICU 2.6 
287:             * 
288:             */
289:            public static final int LIMBU = 48; /* Limb */
290:            /**
291:             * Linear B
292:             * New script in Unicode 4 
293:             * @stable ICU 2.6 
294:             * 
295:             */
296:            public static final int LINEAR_B = 49; /* Linb */
297:            /**
298:             * Osmanya
299:             * New script in Unicode 4 
300:             * @stable ICU 2.6 
301:             * 
302:             */
303:            public static final int OSMANYA = 50; /* Osma */
304:            /**
305:             * Shavian
306:             * New script in Unicode 4 
307:             * @stable ICU 2.6 
308:             * 
309:             */
310:            public static final int SHAVIAN = 51; /* Shaw */
311:            /**
312:             * Tai Le
313:             * New script in Unicode 4 
314:             * @stable ICU 2.6 
315:             * 
316:             */
317:            public static final int TAI_LE = 52; /* Tale */
318:            /**
319:             * Ugaritic
320:             * New script in Unicode 4 
321:             * @stable ICU 2.6 
322:             * 
323:             */
324:            public static final int UGARITIC = 53; /* Ugar */
325:            /**
326:             * New script code in Unicode 4.0.1
327:             * @stable ICU 3.0
328:             */
329:            public static final int KATAKANA_OR_HIRAGANA = 54; /*Hrkt */
330:
331:            /* New scripts in Unicode 4.1 @draft ICU 3.4 */
332:
333:            /**
334:             * New script code in Unicode 4.1
335:             * @draft ICU 3.4
336:             * @provisional This API might change or be removed in a future release.
337:             */
338:            public static final int BUGINESE = 55; /* Bugi */
339:            /**
340:             * New script code in Unicode 4.1
341:             * @draft ICU 3.4
342:             * @provisional This API might change or be removed in a future release.
343:             */
344:            public static final int GLAGOLITIC = 56; /* Glag */
345:            /**
346:             * New script code in Unicode 4.1
347:             * @draft ICU 3.4
348:             * @provisional This API might change or be removed in a future release.
349:             */
350:            public static final int KHAROSHTHI = 57; /* Khar */
351:            /**
352:             * New script code in Unicode 4.1
353:             * @draft ICU 3.4
354:             * @provisional This API might change or be removed in a future release.
355:             */
356:            public static final int SYLOTI_NAGRI = 58; /* Sylo */
357:            /**
358:             * New script code in Unicode 4.1
359:             * @draft ICU 3.4
360:             * @provisional This API might change or be removed in a future release.
361:             */
362:            public static final int NEW_TAI_LUE = 59; /* Talu */
363:            /**
364:             * New script code in Unicode 4.1
365:             * @draft ICU 3.4
366:             * @provisional This API might change or be removed in a future release.
367:             */
368:            public static final int TIFINAGH = 60; /* Tfng */
369:            /**
370:             * New script code in Unicode 4.1
371:             * @draft ICU 3.4
372:             * @provisional This API might change or be removed in a future release.
373:             */
374:            public static final int OLD_PERSIAN = 61; /* Xpeo */
375:
376:            /**
377:             * New script codes from ISO 15924 
378:             * @draft ICU 3.6 
379:             * @provisional This API might change or be removed in a future release.
380:             */
381:            public static final int BALINESE = 62; /* Bali */
382:            /**
383:             * New script codes from ISO 15924 
384:             * @draft ICU 3.6 
385:             * @provisional This API might change or be removed in a future release.
386:             */
387:            public static final int BATAK = 63; /* Batk */
388:            /**
389:             * New script codes from ISO 15924 
390:             * @draft ICU 3.6 
391:             * @provisional This API might change or be removed in a future release.
392:             */
393:            public static final int BLISSYMBOLS = 64; /* Blis */
394:            /**
395:             * New script codes from ISO 15924 
396:             * @draft ICU 3.6 
397:             * @provisional This API might change or be removed in a future release.
398:             */
399:            public static final int BRAHMI = 65; /* Brah */
400:            /**
401:             * New script codes from ISO 15924 
402:             * @draft ICU 3.6 
403:             * @provisional This API might change or be removed in a future release.
404:             */
405:            public static final int CHAM = 66; /* Cham */
406:            /**
407:             * New script codes from ISO 15924 
408:             * @draft ICU 3.6 
409:             * @provisional This API might change or be removed in a future release.
410:             */
411:            public static final int CIRTH = 67; /* Cirt */
412:            /**
413:             * New script codes from ISO 15924 
414:             * @draft ICU 3.6 
415:             * @provisional This API might change or be removed in a future release.
416:             */
417:            public static final int OLD_CHURCH_SLAVONIC_CYRILLIC = 68; /* Cyrs */
418:            /**
419:             * New script codes from ISO 15924 
420:             * @draft ICU 3.6 
421:             * @provisional This API might change or be removed in a future release.
422:             */
423:            public static final int DEMOTIC_EGYPTIAN = 69; /* Egyd */
424:            /**
425:             * New script codes from ISO 15924 
426:             * @draft ICU 3.6 
427:             * @provisional This API might change or be removed in a future release.
428:             */
429:            public static final int HIERATIC_EGYPTIAN = 70; /* Egyh */
430:            /**
431:             * New script codes from ISO 15924 
432:             * @draft ICU 3.6 
433:             * @provisional This API might change or be removed in a future release.
434:             */
435:            public static final int EGYPTIAN_HIEROGLYPHS = 71; /* Egyp */
436:            /**
437:             * New script codes from ISO 15924 
438:             * @draft ICU 3.6 
439:             * @provisional This API might change or be removed in a future release.
440:             */
441:            public static final int KHUTSURI = 72; /* Geok */
442:            /**
443:             * New script codes from ISO 15924 
444:             * @draft ICU 3.6 
445:             * @provisional This API might change or be removed in a future release.
446:             */
447:            public static final int SIMPLIFIED_HAN = 73; /* Hans */
448:            /**
449:             * New script codes from ISO 15924 
450:             * @draft ICU 3.6 
451:             * @provisional This API might change or be removed in a future release.
452:             */
453:            public static final int TRADITIONAL_HAN = 74; /* Hant */
454:            /**
455:             * New script codes from ISO 15924 
456:             * @draft ICU 3.6 
457:             * @provisional This API might change or be removed in a future release.
458:             */
459:            public static final int PAHAWH_HMONG = 75; /* Hmng */
460:            /**
461:             * New script codes from ISO 15924 
462:             * @draft ICU 3.6 
463:             * @provisional This API might change or be removed in a future release.
464:             */
465:            public static final int OLD_HUNGARIAN = 76; /* Hung */
466:            /**
467:             * New script codes from ISO 15924 
468:             * @draft ICU 3.6 
469:             * @provisional This API might change or be removed in a future release.
470:             */
471:            public static final int HARAPPAN_INDUS = 77; /* Inds */
472:            /**
473:             * New script codes from ISO 15924 
474:             * @draft ICU 3.6 
475:             * @provisional This API might change or be removed in a future release.
476:             */
477:            public static final int JAVANESE = 78; /* Java */
478:            /**
479:             * New script codes from ISO 15924 
480:             * @draft ICU 3.6 
481:             * @provisional This API might change or be removed in a future release.
482:             */
483:            public static final int KAYAH_LI = 79; /* Kali */
484:            /**
485:             * New script codes from ISO 15924 
486:             * @draft ICU 3.6 
487:             * @provisional This API might change or be removed in a future release.
488:             */
489:            public static final int LATIN_FRAKTUR = 80; /* Latf */
490:            /**
491:             * New script codes from ISO 15924 
492:             * @draft ICU 3.6 
493:             * @provisional This API might change or be removed in a future release.
494:             */
495:            public static final int LATIN_GAELIC = 81; /* Latg */
496:            /**
497:             * New script codes from ISO 15924 
498:             * @draft ICU 3.6 
499:             * @provisional This API might change or be removed in a future release.
500:             */
501:            public static final int LEPCHA = 82; /* Lepc */
502:            /**
503:             * New script codes from ISO 15924 
504:             * @draft ICU 3.6 
505:             * @provisional This API might change or be removed in a future release.
506:             */
507:            public static final int LINEAR_A = 83; /* Lina */
508:            /**
509:             * New script codes from ISO 15924 
510:             * @draft ICU 3.6 
511:             * @provisional This API might change or be removed in a future release.
512:             */
513:            public static final int MANDAEAN = 84; /* Mand */
514:            /**
515:             * New script codes from ISO 15924 
516:             * @draft ICU 3.6 
517:             * @provisional This API might change or be removed in a future release.
518:             */
519:            public static final int MAYAN_HIEROGLYPHS = 85; /* Maya */
520:            /**
521:             * New script codes from ISO 15924 
522:             * @draft ICU 3.6 
523:             * @provisional This API might change or be removed in a future release.
524:             */
525:            public static final int MEROITIC = 86; /* Mero */
526:            /**
527:             * New script codes from ISO 15924 
528:             * @draft ICU 3.6 
529:             * @provisional This API might change or be removed in a future release.
530:             */
531:            public static final int NKO = 87; /* Nkoo */
532:            /**
533:             * New script codes from ISO 15924 
534:             * @draft ICU 3.6 
535:             * @provisional This API might change or be removed in a future release.
536:             */
537:            public static final int ORKHON = 88; /* Orkh */
538:            /**
539:             * New script codes from ISO 15924 
540:             * @draft ICU 3.6 
541:             * @provisional This API might change or be removed in a future release.
542:             */
543:            public static final int OLD_PERMIC = 89; /* Perm */
544:            /**
545:             * New script codes from ISO 15924 
546:             * @draft ICU 3.6 
547:             * @provisional This API might change or be removed in a future release.
548:             */
549:            public static final int PHAGS_PA = 90; /* Phag */
550:            /**
551:             * New script codes from ISO 15924 
552:             * @draft ICU 3.6 
553:             * @provisional This API might change or be removed in a future release.
554:             */
555:            public static final int PHOENICIAN = 91; /* Phnx */
556:            /**
557:             * New script codes from ISO 15924 
558:             * @draft ICU 3.6 
559:             * @provisional This API might change or be removed in a future release.
560:             */
561:            public static final int PHONETIC_POLLARD = 92; /* Plrd */
562:            /**
563:             * New script codes from ISO 15924 
564:             * @draft ICU 3.6 
565:             * @provisional This API might change or be removed in a future release.
566:             */
567:            public static final int RONGORONGO = 93; /* Roro */
568:            /**
569:             * New script codes from ISO 15924 
570:             * @draft ICU 3.6 
571:             * @provisional This API might change or be removed in a future release.
572:             */
573:            public static final int SARATI = 94; /* Sara */
574:            /**
575:             * New script codes from ISO 15924 
576:             * @draft ICU 3.6 
577:             * @provisional This API might change or be removed in a future release.
578:             */
579:            public static final int ESTRANGELO_SYRIAC = 95; /* Syre */
580:            /**
581:             * New script codes from ISO 15924 
582:             * @draft ICU 3.6 
583:             * @provisional This API might change or be removed in a future release.
584:             */
585:            public static final int WESTERN_SYRIAC = 96; /* Syrj */
586:            /**
587:             * New script codes from ISO 15924 
588:             * @draft ICU 3.6 
589:             * @provisional This API might change or be removed in a future release.
590:             */
591:            public static final int EASTERN_SYRIAC = 97; /* Syrn */
592:            /**
593:             * New script codes from ISO 15924 
594:             * @draft ICU 3.6 
595:             * @provisional This API might change or be removed in a future release.
596:             */
597:            public static final int TENGWAR = 98; /* Teng */
598:            /**
599:             * New script codes from ISO 15924 
600:             * @draft ICU 3.6 
601:             * @provisional This API might change or be removed in a future release.
602:             */
603:            public static final int VAI = 99; /* Vaii */
604:            /**
605:             * New script codes from ISO 15924 
606:             * @draft ICU 3.6 
607:             * @provisional This API might change or be removed in a future release.
608:             */
609:            public static final int VISIBLE_SPEECH = 100;/* Visp */
610:            /**
611:             * New script codes from ISO 15924 
612:             * @draft ICU 3.6 
613:             * @provisional This API might change or be removed in a future release.
614:             */
615:            public static final int CUNEIFORM = 101;/* Xsux */
616:            /**
617:             * New script codes from ISO 15924 
618:             * @draft ICU 3.6 
619:             * @provisional This API might change or be removed in a future release.
620:             */
621:            public static final int UNWRITTEN_LANGUAGES = 102;/* Zxxx */
622:            /**
623:             * New script codes from ISO 15924 
624:             * @draft ICU 3.6 
625:             * @provisional This API might change or be removed in a future release.
626:             */
627:            public static final int UNKNOWN = 103;/* Zzzz *//* Unknown="Code for uncoded script", for unassigned code points */
628:
629:            /* Private use codes from Qaaa - Qabx are not supported*/
630:
631:            /**
632:             * Limit
633:             * @stable ICU 2.4
634:             */
635:            public static final int CODE_LIMIT = 104;
636:
637:            private static final int SCRIPT_MASK = 0x0000007f;
638:            private static final UCharacterProperty prop = UCharacterProperty
639:                    .getInstance();
640:            private static final String kLocaleScript = "LocaleScript";
641:
642:            //private static final String INVALID_NAME = "Invalid";
643:            /**
644:             * Helper function to find the code from locale.
645:             * @param locale The locale.
646:             */
647:            private static int[] findCodeFromLocale(ULocale locale) {
648:                ICUResourceBundle rb;
649:                try {
650:                    rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(
651:                            ICUResourceBundle.ICU_BASE_NAME, locale);
652:                } catch (MissingResourceException e) {
653:                    return null;
654:                }
655:
656:                // if rb is not a strict fallback of the requested locale, return null
657:                //if(!LocaleUtility.isFallbackOf(rb.getULocale().toString(), locale.toString())){
658:                //    return null;
659:                //}
660:                //non existent locale check
661:                if (rb.getLoadingStatus() == ICUResourceBundle.FROM_DEFAULT
662:                        && !locale.equals(ULocale.getDefault())) {
663:                    return null;
664:                }
665:                ICUResourceBundle sub = rb.get(kLocaleScript);
666:
667:                int[] result = new int[sub.getSize()];
668:                int w = 0;
669:                for (int i = 0; i < result.length; ++i) {
670:                    int code = UCharacter.getPropertyValueEnum(
671:                            UProperty.SCRIPT, sub.getString(i));
672:                    result[w++] = code;
673:
674:                }
675:
676:                if (w < result.length) {
677:                    throw new IllegalStateException("bad locale data, listed "
678:                            + result.length + " scripts but found only " + w);
679:                }
680:
681:                return result;
682:            }
683:
684:            /**
685:             * Gets a script codes associated with the given locale or ISO 15924 abbreviation or name.
686:             * Returns MALAYAM given "Malayam" OR "Mlym".
687:             * Returns LATIN given "en" OR "en_US"
688:             * @param locale Locale
689:             * @return The script codes array. null if the the code cannot be found.
690:             * @stable ICU 2.4
691:             */
692:            public static final int[] getCode(Locale locale) {
693:                return findCodeFromLocale(ULocale.forLocale(locale));
694:            }
695:
696:            /**
697:             * Gets a script codes associated with the given locale or ISO 15924 abbreviation or name.
698:             * Returns MALAYAM given "Malayam" OR "Mlym".
699:             * Returns LATIN given "en" OR "en_US"
700:             * @param locale ULocale
701:             * @return The script codes array. null if the the code cannot be found.
702:             * @stable ICU 3.0
703:             */
704:            public static final int[] getCode(ULocale locale) {
705:                return findCodeFromLocale(locale);
706:            }
707:
708:            /**
709:             * Gets a script codes associated with the given locale or ISO 15924 abbreviation or name.
710:             * Returns MALAYAM given "Malayam" OR "Mlym".
711:             * Returns LATIN given "en" OR "en_US"
712:             *
713:             * <p>Note: To search by short or long script alias only, use
714:             * UCharacater.getPropertyValueEnum(UProperty.SCRIPT, alias)
715:             * instead.  This does a fast lookup with no access of the locale
716:             * data.
717:             * @param nameOrAbbrOrLocale name of the script or ISO 15924 code or locale
718:             * @return The script codes array. null if the the code cannot be found.
719:             * @stable ICU 2.4
720:             */
721:            public static final int[] getCode(String nameOrAbbrOrLocale) {
722:                try {
723:                    return new int[] { UCharacter.getPropertyValueEnum(
724:                            UProperty.SCRIPT, nameOrAbbrOrLocale) };
725:                } catch (IllegalArgumentException e) {
726:                    return findCodeFromLocale(new ULocale(nameOrAbbrOrLocale));
727:                }
728:            }
729:
730:            /**
731:             * Gets a script codes associated with the given ISO 15924 abbreviation or name.
732:             * Returns MALAYAM given "Malayam" OR "Mlym".
733:             *
734:             * @param nameOrAbbr name of the script or ISO 15924 code
735:             * @return The script code value or INVALID_CODE if the code cannot be found.
736:             * @internal
737:             * @deprecated This API is ICU internal only.
738:             */
739:            public static final int getCodeFromName(String nameOrAbbr) {
740:                try {
741:                    return UCharacter.getPropertyValueEnum(UProperty.SCRIPT,
742:                            nameOrAbbr);
743:                } catch (IllegalArgumentException e) {
744:                    return INVALID_CODE;
745:                }
746:            }
747:
748:            /**
749:             * Gets the script code associated with the given codepoint.
750:             * Returns UScript.MALAYAM given 0x0D02
751:             * @param codepoint UChar32 codepoint
752:             * @return The script code
753:             * @stable ICU 2.4
754:             */
755:            public static final int getScript(int codepoint) {
756:                if (codepoint >= UCharacter.MIN_VALUE
757:                        & codepoint <= UCharacter.MAX_VALUE) {
758:                    return (prop.getAdditional(codepoint, 0) & SCRIPT_MASK);
759:                } else {
760:                    throw new IllegalArgumentException(Integer
761:                            .toString(codepoint));
762:                }
763:            }
764:
765:            /**
766:             * Gets a script name associated with the given script code.
767:             * Returns  "Malayam" given MALAYAM
768:             * @param scriptCode int script code
769:             * @return script name as a string in full as given in TR#24
770:             * @stable ICU 2.4
771:             */
772:            public static final String getName(int scriptCode) {
773:                return UCharacter.getPropertyValueName(UProperty.SCRIPT,
774:                        scriptCode, UProperty.NameChoice.LONG);
775:            }
776:
777:            /**
778:             * Gets a script name associated with the given script code.
779:             * Returns  "Mlym" given MALAYAM
780:             * @param scriptCode int script code
781:             * @return script abbreviated name as a string  as given in TR#24
782:             * @stable ICU 2.4
783:             */
784:            public static final String getShortName(int scriptCode) {
785:                return UCharacter.getPropertyValueName(UProperty.SCRIPT,
786:                        scriptCode, UProperty.NameChoice.SHORT);
787:            }
788:
789:            ///CLOVER:OFF
790:            /**
791:             *  Private Constructor. Never default construct
792:             */
793:            private UScript() {
794:            }
795:            ///CLOVER:ON
796:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.