ULocale.java 43 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.agl.util;

import com.adobe.agl.impl.ICUResourceBundle;
import com.adobe.agl.impl.SimpleCache;
import com.adobe.agl.util.UResourceBundle;

import java.io.Serializable;
import java.lang.ref.SoftReference;
import java.util.*;

public final class ULocale
implements Serializable {
    public static final ULocale ENGLISH = new ULocale("en", Locale.ENGLISH);
    public static final ULocale FRENCH = new ULocale("fr", Locale.FRENCH);
    public static final ULocale GERMAN = new ULocale("de", Locale.GERMAN);
    public static final ULocale ITALIAN = new ULocale("it", Locale.ITALIAN);
    public static final ULocale JAPANESE = new ULocale("ja", Locale.JAPANESE);
    public static final ULocale KOREAN = new ULocale("ko", Locale.KOREAN);
    public static final ULocale CHINESE = new ULocale("zh", Locale.CHINESE);
    public static final ULocale SIMPLIFIED_CHINESE = new ULocale("zh_Hans", Locale.CHINESE);
    public static final ULocale TRADITIONAL_CHINESE = new ULocale("zh_Hant", Locale.CHINESE);
    public static final ULocale FRANCE = new ULocale("fr_FR", Locale.FRANCE);
    public static final ULocale GERMANY = new ULocale("de_DE", Locale.GERMANY);
    public static final ULocale ITALY = new ULocale("it_IT", Locale.ITALY);
    public static final ULocale JAPAN = new ULocale("ja_JP", Locale.JAPAN);
    public static final ULocale KOREA = new ULocale("ko_KR", Locale.KOREA);
    public static final ULocale CHINA;
    public static final ULocale PRC;
    public static final ULocale TAIWAN;
    public static final ULocale UK;
    public static final ULocale US;
    public static final ULocale CANADA;
    public static final ULocale CANADA_FRENCH;
    private static final Locale EMPTY_LOCALE;
    public static final ULocale ROOT;
    private static final SimpleCache CACHE;
    private transient Locale locale;
    private String localeID;
    private static String[] _languages;
    private static String[] _replacementLanguages;
    private static String[] _obsoleteLanguages;
    private static String[] _languages3;
    private static String[] _obsoleteLanguages3;
    private static String[] _countries;
    private static String[] _deprecatedCountries;
    private static String[] _replacementCountries;
    private static String[] _obsoleteCountries;
    private static String[] _countries3;
    private static String[] _obsoleteCountries3;
    private static final String[][] _javaLocaleMap;
    private static SoftReference nameCacheRef;
    private static Locale defaultLocale;
    private static ULocale defaultULocale;
    public static Type ACTUAL_LOCALE;
    public static Type VALID_LOCALE;

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    private static void initLanguageTables() {
        if (_languages != null) return;
        String[] tempLanguages = new String[]{"aa", "ab", "ace", "ach", "ada", "ady", "ae", "af", "afa", "afh", "ak", "akk", "ale", "alg", "am", "an", "ang", "apa", "ar", "arc", "arn", "arp", "art", "arw", "as", "ast", "ath", "aus", "av", "awa", "ay", "az", "ba", "bad", "bai", "bal", "ban", "bas", "bat", "be", "bej", "bem", "ber", "bg", "bh", "bho", "bi", "bik", "bin", "bla", "bm", "bn", "bnt", "bo", "br", "bra", "bs", "btk", "bua", "bug", "byn", "ca", "cad", "cai", "car", "cau", "ce", "ceb", "cel", "ch", "chb", "chg", "chk", "chm", "chn", "cho", "chp", "chr", "chy", "cmc", "co", "cop", "cpe", "cpf", "cpp", "cr", "crh", "crp", "cs", "csb", "cu", "cus", "cv", "cy", "da", "dak", "dar", "day", "de", "del", "den", "dgr", "din", "doi", "dra", "dsb", "dua", "dum", "dv", "dyu", "dz", "ee", "efi", "egy", "eka", "el", "elx", "en", "enm", "eo", "es", "et", "eu", "ewo", "fa", "fan", "fat", "ff", "fi", "fiu", "fj", "fo", "fon", "fr", "frm", "fro", "fur", "fy", "ga", "gaa", "gay", "gba", "gd", "gem", "gez", "gil", "gl", "gmh", "gn", "goh", "gon", "gor", "got", "grb", "grc", "gu", "gv", "gwi", "ha", "hai", "haw", "he", "hi", "hil", "him", "hit", "hmn", "ho", "hr", "hsb", "ht", "hu", "hup", "hy", "hz", "ia", "iba", "id", "ie", "ig", "ii", "ijo", "ik", "ilo", "inc", "ine", "inh", "io", "ira", "iro", "is", "it", "iu", "ja", "jbo", "jpr", "jrb", "jv", "ka", "kaa", "kab", "kac", "kam", "kar", "kaw", "kbd", "kg", "kha", "khi", "kho", "ki", "kj", "kk", "kl", "km", "kmb", "kn", "ko", "kok", "kos", "kpe", "kr", "krc", "kro", "kru", "ks", "ku", "kum", "kut", "kv", "kw", "ky", "la", "lad", "lah", "lam", "lb", "lez", "lg", "li", "ln", "lo", "lol", "loz", "lt", "lu", "lua", "lui", "lun", "luo", "lus", "lv", "mad", "mag", "mai", "mak", "man", "map", "mas", "mdf", "mdr", "men", "mg", "mga", "mh", "mi", "mic", "min", "mis", "mk", "mkh", "ml", "mn", "mnc", "mni", "mno", "mo", "moh", "mos", "mr", "ms", "mt", "mul", "mun", "mus", "mwr", "my", "myn", "myv", "na", "nah", "nai", "nap", "nb", "nd", "nds", "ne", "new", "ng", "nia", "nic", "niu", "nl", "nn", "no", "nog", "non", "nr", "nso", "nub", "nv", "nwc", "ny", "nym", "nyn", "nyo", "nzi", "oc", "oj", "om", "or", "os", "osa", "ota", "oto", "pa", "paa", "pag", "pal", "pam", "pap", "pau", "peo", "phi", "phn", "pi", "pl", "pon", "pra", "pro", "ps", "pt", "qu", "raj", "rap", "rar", "rm", "rn", "ro", "roa", "rom", "ru", "rup", "rw", "sa", "sad", "sah", "sai", "sal", "sam", "sas", "sat", "sc", "sco", "sd", "se", "sel", "sem", "sg", "sga", "sgn", "shn", "si", "sid", "sio", "sit", "sk", "sl", "sla", "sm", "sma", "smi", "smj", "smn", "sms", "sn", "snk", "so", "sog", "son", "sq", "sr", "srr", "ss", "ssa", "st", "su", "suk", "sus", "sux", "sv", "sw", "syr", "ta", "tai", "te", "tem", "ter", "tet", "tg", "th", "ti", "tig", "tiv", "tk", "tkl", "tl", "tlh", "tli", "tmh", "tn", "to", "tog", "tpi", "tr", "ts", "tsi", "tt", "tum", "tup", "tut", "tvl", "tw", "ty", "tyv", "udm", "ug", "uga", "uk", "umb", "und", "ur", "uz", "vai", "ve", "vi", "vo", "vot", "wa", "wak", "wal", "war", "was", "wen", "wo", "xal", "xh", "yao", "yap", "yi", "yo", "ypk", "za", "zap", "zen", "zh", "znd", "zu", "zun"};
        String[] tempReplacementLanguages = new String[]{"id", "he", "yi", "jv", "sr", "nb"};
        String[] tempObsoleteLanguages = new String[]{"in", "iw", "ji", "jw", "sh", "no"};
        String[] tempLanguages3 = new String[]{"aar", "abk", "ace", "ach", "ada", "ady", "ave", "afr", "afa", "afh", "aka", "akk", "ale", "alg", "amh", "arg", "ang", "apa", "ara", "arc", "arn", "arp", "art", "arw", "asm", "ast", "ath", "aus", "ava", "awa", "aym", "aze", "bak", "bad", "bai", "bal", "ban", "bas", "bat", "bel", "bej", "bem", "ber", "bul", "bih", "bho", "bis", "bik", "bin", "bla", "bam", "ben", "bnt", "bod", "bre", "bra", "bos", "btk", "bua", "bug", "byn", "cat", "cad", "cai", "car", "cau", "che", "ceb", "cel", "cha", "chb", "chg", "chk", "chm", "chn", "cho", "chp", "chr", "chy", "cmc", "cos", "cop", "cpe", "cpf", "cpp", "cre", "crh", "crp", "ces", "csb", "chu", "cus", "chv", "cym", "dan", "dak", "dar", "day", "deu", "del", "den", "dgr", "din", "doi", "dra", "dsb", "dua", "dum", "div", "dyu", "dzo", "ewe", "efi", "egy", "eka", "ell", "elx", "eng", "enm", "epo", "spa", "est", "eus", "ewo", "fas", "fan", "fat", "ful", "fin", "fiu", "fij", "fao", "fon", "fra", "frm", "fro", "fur", "fry", "gle", "gaa", "gay", "gba", "gla", "gem", "gez", "gil", "glg", "gmh", "grn", "goh", "gon", "gor", "got", "grb", "grc", "guj", "glv", "gwi", "hau", "hai", "haw", "heb", "hin", "hil", "him", "hit", "hmn", "hmo", "hrv", "hsb", "hat", "hun", "hup", "hye", "her", "ina", "iba", "ind", "ile", "ibo", "iii", "ijo", "ipk", "ilo", "inc", "ine", "inh", "ido", "ira", "iro", "isl", "ita", "iku", "jpn", "jbo", "jpr", "jrb", "jaw", "kat", "kaa", "kab", "kac", "kam", "kar", "kaw", "kbd", "kon", "kha", "khi", "kho", "kik", "kua", "kaz", "kal", "khm", "kmb", "kan", "kor", "kok", "kos", "kpe", "kau", "krc", "kro", "kru", "kas", "kur", "kum", "kut", "kom", "cor", "kir", "lat", "lad", "lah", "lam", "ltz", "lez", "lug", "lim", "lin", "lao", "lol", "loz", "lit", "lub", "lua", "lui", "lun", "luo", "lus", "lav", "mad", "mag", "mai", "mak", "man", "map", "mas", "mdf", "mdr", "men", "mlg", "mga", "mah", "mri", "mic", "min", "mis", "mkd", "mkh", "mal", "mon", "mnc", "mni", "mno", "mol", "moh", "mos", "mar", "msa", "mlt", "mul", "mun", "mus", "mwr", "mya", "myn", "myv", "nau", "nah", "nai", "nap", "nob", "nde", "nds", "nep", "new", "ndo", "nia", "nic", "niu", "nld", "nno", "nor", "nog", "non", "nbl", "nso", "nub", "nav", "nwc", "nya", "nym", "nyn", "nyo", "nzi", "oci", "oji", "orm", "ori", "oss", "osa", "ota", "oto", "pan", "paa", "pag", "pal", "pam", "pap", "pau", "peo", "phi", "phn", "pli", "pol", "pon", "pra", "pro", "pus", "por", "que", "raj", "rap", "rar", "roh", "run", "ron", "roa", "rom", "rus", "rup", "kin", "san", "sad", "sah", "sai", "sal", "sam", "sas", "sat", "srd", "sco", "snd", "sme", "sel", "sem", "sag", "sga", "sgn", "shn", "sin", "sid", "sio", "sit", "slk", "slv", "sla", "smo", "sma", "smi", "smj", "smn", "sms", "sna", "snk", "som", "sog", "son", "sqi", "srp", "srr", "ssw", "ssa", "sot", "sun", "suk", "sus", "sux", "swe", "swa", "syr", "tam", "tai", "tel", "tem", "ter", "tet", "tgk", "tha", "tir", "tig", "tiv", "tuk", "tkl", "tgl", "tlh", "tli", "tmh", "tsn", "ton", "tog", "tpi", "tur", "tso", "tsi", "tat", "tum", "tup", "tut", "tvl", "twi", "tah", "tyv", "udm", "uig", "uga", "ukr", "umb", "und", "urd", "uzb", "vai", "ven", "vie", "vol", "vot", "wln", "wak", "wal", "war", "was", "wen", "wol", "xal", "xho", "yao", "yap", "yid", "yor", "ypk", "zha", "zap", "zen", "zho", "znd", "zul", "zun"};
        String[] tempObsoleteLanguages3 = new String[]{"ind", "heb", "yid", "jaw", "srp"};
        Class class_ = ULocale.class;
        Class class_2 = class_;
        synchronized (class_) {
            if (_languages != null) return;
            {
                _languages = tempLanguages;
                _replacementLanguages = tempReplacementLanguages;
                _obsoleteLanguages = tempObsoleteLanguages;
                _languages3 = tempLanguages3;
                _obsoleteLanguages3 = tempObsoleteLanguages3;
            }
            // ** MonitorExit[var5_5] (shouldn't be in output)
            return;
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    private static void initCountryTables() {
        if (_countries != null) return;
        String[] tempCountries = new String[]{"AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "ZA", "ZM", "ZW"};
        String[] tempObsoleteCountries = new String[]{"FX", "CS", "RO", "TP", "YU", "ZR"};
        String[] tempDeprecatedCountries = new String[]{"BU", "CS", "DY", "FX", "HV", "NH", "RH", "TP", "YU", "ZR"};
        String[] tempReplacementCountries = new String[]{"MM", "RS", "BJ", "FR", "BF", "VU", "ZW", "TL", "RS", "CD"};
        String[] tempCountries3 = new String[]{"AND", "ARE", "AFG", "ATG", "AIA", "ALB", "ARM", "ANT", "AGO", "ATA", "ARG", "ASM", "AUT", "AUS", "ABW", "ALA", "AZE", "BIH", "BRB", "BGD", "BEL", "BFA", "BGR", "BHR", "BDI", "BEN", "BLM", "BMU", "BRN", "BOL", "BRA", "BHS", "BTN", "BVT", "BWA", "BLR", "BLZ", "CAN", "CCK", "COD", "CAF", "COG", "CHE", "CIV", "COK", "CHL", "CMR", "CHN", "COL", "CRI", "CUB", "CPV", "CXR", "CYP", "CZE", "DEU", "DJI", "DNK", "DMA", "DOM", "DZA", "ECU", "EST", "EGY", "ESH", "ERI", "ESP", "ETH", "FIN", "FJI", "FLK", "FSM", "FRO", "FRA", "GAB", "GBR", "GRD", "GEO", "GUF", "GGY", "GHA", "GIB", "GRL", "GMB", "GIN", "GLP", "GNQ", "GRC", "SGS", "GTM", "GUM", "GNB", "GUY", "HKG", "HMD", "HND", "HRV", "HTI", "HUN", "IDN", "IRL", "ISR", "IMN", "IND", "IOT", "IRQ", "IRN", "ISL", "ITA", "JEY", "JAM", "JOR", "JPN", "KEN", "KGZ", "KHM", "KIR", "COM", "KNA", "PRK", "KOR", "KWT", "CYM", "KAZ", "LAO", "LBN", "LCA", "LIE", "LKA", "LBR", "LSO", "LTU", "LUX", "LVA", "LBY", "MAR", "MCO", "MDA", "MNE", "MAF", "MDG", "MHL", "MKD", "MLI", "MMR", "MNG", "MAC", "MNP", "MTQ", "MRT", "MSR", "MLT", "MUS", "MDV", "MWI", "MEX", "MYS", "MOZ", "NAM", "NCL", "NER", "NFK", "NGA", "NIC", "NLD", "NOR", "NPL", "NRU", "NIU", "NZL", "OMN", "PAN", "PER", "PYF", "PNG", "PHL", "PAK", "POL", "SPM", "PCN", "PRI", "PSE", "PRT", "PLW", "PRY", "QAT", "REU", "ROU", "SRB", "RUS", "RWA", "SAU", "SLB", "SYC", "SDN", "SWE", "SGP", "SHN", "SVN", "SJM", "SVK", "SLE", "SMR", "SEN", "SOM", "SUR", "STP", "SLV", "SYR", "SWZ", "TCA", "TCD", "ATF", "TGO", "THA", "TJK", "TKL", "TLS", "TKM", "TUN", "TON", "TUR", "TTO", "TUV", "TWN", "TZA", "UKR", "UGA", "UMI", "USA", "URY", "UZB", "VAT", "VCT", "VEN", "VGB", "VIR", "VNM", "VUT", "WLF", "WSM", "YEM", "MYT", "ZAF", "ZMB", "ZWE"};
        String[] tempObsoleteCountries3 = new String[]{"FXX", "SCG", "ROM", "TMP", "YUG", "ZAR"};
        Class class_ = ULocale.class;
        Class class_2 = class_;
        synchronized (class_) {
            if (_countries != null) return;
            {
                _countries = tempCountries;
                _deprecatedCountries = tempDeprecatedCountries;
                _replacementCountries = tempReplacementCountries;
                _obsoleteCountries = tempObsoleteCountries;
                _countries3 = tempCountries3;
                _obsoleteCountries3 = tempObsoleteCountries3;
            }
            // ** MonitorExit[var6_6] (shouldn't be in output)
            return;
        }
    }

    private ULocale(String localeID, Locale locale) {
        this.localeID = localeID;
        this.locale = locale;
    }

    private ULocale(Locale loc) {
        this.localeID = ULocale.getName(ULocale.forLocale(loc).toString());
        this.locale = loc;
    }

    public static ULocale forLocale(Locale loc) {
        if (loc == null) {
            return null;
        }
        ULocale result = (ULocale)CACHE.get(loc);
        if (result == null) {
            if (defaultULocale != null && loc == ULocale.defaultULocale.locale) {
                result = defaultULocale;
            } else {
                String locStr = loc.toString();
                if (locStr.length() == 0) {
                    result = ROOT;
                } else {
                    for (int i = 0; i < _javaLocaleMap.length; ++i) {
                        if (!_javaLocaleMap[i][0].equals(locStr)) continue;
                        IDParser p = new IDParser(_javaLocaleMap[i][1]);
                        p.setKeywordValue(_javaLocaleMap[i][2], _javaLocaleMap[i][3]);
                        locStr = p.getName();
                        break;
                    }
                    result = new ULocale(locStr, loc);
                }
            }
            CACHE.put(loc, result);
        }
        return result;
    }

    public ULocale(String localeID) {
        this.localeID = ULocale.getName(localeID);
    }

    public Locale toLocale() {
        if (this.locale == null) {
            IDParser p = new IDParser(this.localeID);
            String base = p.getBaseName();
            for (int i = 0; i < _javaLocaleMap.length; ++i) {
                if (!base.equals(_javaLocaleMap[i][1]) && !base.equals(_javaLocaleMap[i][4])) continue;
                if (_javaLocaleMap[i][2] != null) {
                    String val = p.getKeywordValue(_javaLocaleMap[i][2]);
                    if (val == null || !val.equals(_javaLocaleMap[i][3])) continue;
                    p = new IDParser(_javaLocaleMap[i][0]);
                    break;
                }
                p = new IDParser(_javaLocaleMap[i][0]);
                break;
            }
            String[] names = p.getLanguageScriptCountryVariant();
            this.locale = new Locale(names[0], names[2], names[3]);
        }
        return this.locale;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    public static ULocale getDefault() {
        Class class_ = ULocale.class;
        Class class_2 = class_;
        synchronized (class_) {
            Locale currentDefault = Locale.getDefault();
            if (defaultLocale != currentDefault) {
                defaultLocale = currentDefault;
                defaultULocale = new ULocale(defaultLocale);
            }
            // ** MonitorExit[var0] (shouldn't be in output)
            return defaultULocale;
        }
    }

    public Object clone() {
        return this;
    }

    public int hashCode() {
        return this.localeID.hashCode();
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj instanceof String) {
            return this.localeID.equals((String)obj);
        }
        if (obj instanceof ULocale) {
            return this.localeID.equals(((ULocale)obj).localeID);
        }
        return false;
    }

    public String getLanguage() {
        return ULocale.getLanguage(this.localeID);
    }

    public static String getLanguage(String localeID) {
        return new IDParser(localeID).getLanguage();
    }

    public String getScript() {
        return ULocale.getScript(this.localeID);
    }

    public static String getScript(String localeID) {
        return new IDParser(localeID).getScript();
    }

    public String getCountry() {
        return ULocale.getCountry(this.localeID);
    }

    public static String getCountry(String localeID) {
        return new IDParser(localeID).getCountry();
    }

    public String getVariant() {
        return ULocale.getVariant(this.localeID);
    }

    public static String getVariant(String localeID) {
        return new IDParser(localeID).getVariant();
    }

    public ULocale getFallback() {
        if (this.localeID.length() == 0 || this.localeID.charAt(0) == '@') {
            return null;
        }
        return new ULocale(ULocale.getFallbackString(this.localeID), null);
    }

    private static String getFallbackString(String fallback) {
        int start;
        int limit = fallback.indexOf(64);
        if (limit == -1) {
            limit = fallback.length();
        }
        if ((start = fallback.lastIndexOf(95, limit)) == -1) {
            start = 0;
        }
        return fallback.substring(0, start) + fallback.substring(limit);
    }

    public String getBaseName() {
        return ULocale.getBaseName(this.localeID);
    }

    public static String getBaseName(String localeID) {
        if (localeID.indexOf(64) == -1) {
            return localeID;
        }
        return new IDParser(localeID).getBaseName();
    }

    public String getName() {
        return this.localeID;
    }

    public static String getName(String localeID) {
        String name;
        Map<String, String> cache = (Map<String, String>)nameCacheRef.get();
        if (cache == null) {
            cache = Collections.synchronizedMap(new HashMap());
            nameCacheRef = new SoftReference(cache);
        }
        if ((name = (String)cache.get(localeID)) == null) {
            name = new IDParser(localeID).getName();
            cache.put(localeID, name);
        }
        return name;
    }

    public String toString() {
        return this.localeID;
    }

    public String getKeywordValue(String keywordName) {
        return ULocale.getKeywordValue(this.localeID, keywordName);
    }

    public static String getKeywordValue(String localeID, String keywordName) {
        return new IDParser(localeID).getKeywordValue(keywordName);
    }

    private static int findIndex(String[] array, String target) {
        for (int i = 0; i < array.length; ++i) {
            if (!target.equals(array[i])) continue;
            return i;
        }
        return -1;
    }

    public String getISO3Language() {
        return ULocale.getISO3Language(this.localeID);
    }

    public static String getISO3Language(String localeID) {
        ULocale.initLanguageTables();
        String language = ULocale.getLanguage(localeID);
        int offset = ULocale.findIndex(_languages, language);
        if (offset >= 0) {
            return _languages3[offset];
        }
        offset = ULocale.findIndex(_obsoleteLanguages, language);
        if (offset >= 0) {
            return _obsoleteLanguages3[offset];
        }
        return "";
    }

    private static String getTableString(String tableName, String subtableName, String item, ICUResourceBundle bundle) {
        try {
            do {
                ICUResourceBundle table;
                if ("currency".equals(subtableName)) {
                    table = bundle.getWithFallback("Currencies");
                    table = table.getWithFallback(item);
                    return table.getString(1);
                }
                table = bundle.getWithFallback(tableName);
                try {
                    if (subtableName != null) {
                        table = table.getWithFallback(subtableName);
                    }
                    return table.getStringWithFallback(item);
                }
                catch (MissingResourceException e) {
                    String fallbackLocale;
                    if (subtableName == null) {
                        try {
                            String currentName = null;
                            if (tableName.equals("Countries")) {
                                currentName = ULocale.getCurrentCountryID(item);
                            } else if (tableName.equals("Languages")) {
                                currentName = ULocale.getCurrentLanguageID(item);
                            }
                            return table.getStringWithFallback(currentName);
                        }
                        catch (MissingResourceException ex) {
                            // empty catch block
                        }
                    }
                    if ((fallbackLocale = table.getWithFallback("Fallback").getString()).length() == 0) {
                        fallbackLocale = "root";
                    }
                    if (fallbackLocale.equals(table.getULocale().localeID)) {
                        return item;
                    }
                    bundle = (ICUResourceBundle)UResourceBundle.getBundleInstance("com/adobe/agl/impl/data/icudt40b", fallbackLocale);
                    continue;
                }
                break;
            } while (true);
        }
        catch (Exception e) {
            return item;
        }
    }

    static String getCurrentCountryID(String oldID) {
        ULocale.initCountryTables();
        int offset = ULocale.findIndex(_deprecatedCountries, oldID);
        if (offset >= 0) {
            return _replacementCountries[offset];
        }
        return oldID;
    }

    static String getCurrentLanguageID(String oldID) {
        ULocale.initLanguageTables();
        int offset = ULocale.findIndex(_obsoleteLanguages, oldID);
        if (offset >= 0) {
            return _replacementLanguages[offset];
        }
        return oldID;
    }

    public String getDisplayName() {
        return ULocale.getDisplayNameInternal(this.localeID, ULocale.getDefault().localeID);
    }

    public String getDisplayName(ULocale displayLocale) {
        return ULocale.getDisplayNameInternal(this.localeID, displayLocale.localeID);
    }

    private static String getDisplayNameInternal(String localeID, String displayLocaleID) {
        String[] tableNames = new String[]{"Languages", "Scripts", "Countries", "Variants"};
        ICUResourceBundle bundle = (ICUResourceBundle)UResourceBundle.getBundleInstance("com/adobe/agl/impl/data/icudt40b", displayLocaleID);
        StringBuffer buf = new StringBuffer();
        IDParser parser = new IDParser(localeID);
        String[] names = parser.getLanguageScriptCountryVariant();
        boolean haveLanguage = names[0].length() > 0;
        boolean openParen = false;
        for (int i = 0; i < names.length; ++i) {
            String name = names[i];
            if (name.length() <= 0) continue;
            name = ULocale.getTableString(tableNames[i], null, name, bundle);
            if (buf.length() > 0) {
                if (haveLanguage & !openParen) {
                    buf.append(" (");
                    openParen = true;
                } else {
                    buf.append(", ");
                }
            }
            buf.append(name);
        }
        Map m = parser.getKeywordMap();
        if (!m.isEmpty()) {
            Iterator keys = m.entrySet().iterator();
            while (keys.hasNext()) {
                if (buf.length() > 0) {
                    if (haveLanguage & !openParen) {
                        buf.append(" (");
                        openParen = true;
                    } else {
                        buf.append(", ");
                    }
                }
                Map.Entry e = keys.next();
                String key = (String)e.getKey();
                String val = (String)e.getValue();
                buf.append(ULocale.getTableString("Keys", null, key, bundle));
                buf.append("=");
                buf.append(ULocale.getTableString("Types", key, val, bundle));
            }
        }
        if (openParen) {
            buf.append(")");
        }
        return buf.toString();
    }

    static {
        PRC = ULocale.CHINA = new ULocale("zh_Hans_CN", Locale.CHINA);
        TAIWAN = new ULocale("zh_Hant_TW", Locale.TAIWAN);
        UK = new ULocale("en_GB", Locale.UK);
        US = new ULocale("en_US", Locale.US);
        CANADA = new ULocale("en_CA", Locale.CANADA);
        CANADA_FRENCH = new ULocale("fr_CA", Locale.CANADA_FRENCH);
        EMPTY_LOCALE = new Locale("", "");
        ROOT = new ULocale("root", EMPTY_LOCALE);
        CACHE = new SimpleCache();
        _javaLocaleMap = new String[][]{{"ja_JP_JP", "ja_JP", "calendar", "japanese", "ja"}, {"no_NO_NY", "nn_NO", null, null, "nn"}};
        nameCacheRef = new SoftReference(Collections.synchronizedMap(new HashMap()));
        defaultLocale = Locale.getDefault();
        defaultULocale = new ULocale(defaultLocale);
        ACTUAL_LOCALE = new Type();
        VALID_LOCALE = new Type();
    }

    public static final class Type {
        private Type() {
        }
    }

    private static final class IDParser {
        private char[] id;
        private int index;
        private char[] buffer;
        private int blen;
        private boolean canonicalize;
        private boolean hadCountry;
        Map keywords;
        String baseName;

        private IDParser(String localeID) {
            this(localeID, false);
        }

        private IDParser(String localeID, boolean canonicalize) {
            this.id = localeID.toCharArray();
            this.index = 0;
            this.buffer = new char[this.id.length + 5];
            this.blen = 0;
            this.canonicalize = canonicalize;
        }

        private void reset() {
            this.blen = 0;
            this.index = 0;
        }

        private void append(char c) {
            try {
                this.buffer[this.blen] = c;
            }
            catch (IndexOutOfBoundsException e) {
                if (this.buffer.length > 512) {
                    throw e;
                }
                char[] nbuffer = new char[this.buffer.length * 2];
                System.arraycopy(this.buffer, 0, nbuffer, 0, this.buffer.length);
                nbuffer[this.blen] = c;
                this.buffer = nbuffer;
            }
            ++this.blen;
        }

        private void addSeparator() {
            this.append('_');
        }

        private String getString(int start) {
            if (start == this.blen) {
                return "";
            }
            return new String(this.buffer, start, this.blen - start);
        }

        private void set(int pos, String s) {
            this.blen = pos;
            this.append(s);
        }

        private void append(String s) {
            for (int i = 0; i < s.length(); ++i) {
                this.append(s.charAt(i));
            }
        }

        private char next() {
            if (this.index == this.id.length) {
                ++this.index;
                return '\uffff';
            }
            return this.id[this.index++];
        }

        private void skipUntilTerminatorOrIDSeparator() {
            while (!this.isTerminatorOrIDSeparator(this.next())) {
            }
            --this.index;
        }

        private boolean atTerminator() {
            return this.index >= this.id.length || this.isTerminator(this.id[this.index]);
        }

        private boolean isTerminator(char c) {
            return c == '@' || c == '\uffff' || c == '.';
        }

        private boolean isTerminatorOrIDSeparator(char c) {
            return c == '@' || c == '_' || c == '-' || c == '\uffff' || c == '.';
        }

        private boolean haveExperimentalLanguagePrefix() {
            char c;
            if (this.id.length > 2 && ((c = this.id[1]) == '-' || c == '_')) {
                c = this.id[0];
                return c == 'x' || c == 'X' || c == 'i' || c == 'I';
            }
            return false;
        }

        private boolean haveKeywordAssign() {
            for (int i = this.index; i < this.id.length; ++i) {
                if (this.id[i] != '=') continue;
                return true;
            }
            return false;
        }

        private int parseLanguage() {
            char c;
            if (this.haveExperimentalLanguagePrefix()) {
                this.append(Character.toLowerCase(this.id[0]));
                this.append('-');
                this.index = 2;
            }
            while (!this.isTerminatorOrIDSeparator(c = this.next())) {
                this.append(Character.toLowerCase(c));
            }
            --this.index;
            if (this.blen == 3) {
                ULocale.initLanguageTables();
                String lang = this.getString(0);
                int offset = ULocale.findIndex(_languages3, lang);
                if (offset >= 0) {
                    this.set(0, _languages[offset]);
                } else {
                    offset = ULocale.findIndex(_obsoleteLanguages3, lang);
                    if (offset >= 0) {
                        this.set(0, _obsoleteLanguages[offset]);
                    }
                }
            }
            return 0;
        }

        private void skipLanguage() {
            if (this.haveExperimentalLanguagePrefix()) {
                this.index = 2;
            }
            this.skipUntilTerminatorOrIDSeparator();
        }

        private int parseScript() {
            if (!this.atTerminator()) {
                char c;
                int oldIndex = this.index++;
                int oldBlen = this.blen;
                while (!this.isTerminatorOrIDSeparator(c = this.next())) {
                    if (this.blen == oldBlen) {
                        this.addSeparator();
                        this.append(Character.toUpperCase(c));
                        continue;
                    }
                    this.append(Character.toLowerCase(c));
                }
                --this.index;
                if (this.index - oldIndex != 5) {
                    this.index = oldIndex;
                    this.blen = oldBlen;
                } else {
                    ++oldBlen;
                }
                return oldBlen;
            }
            return this.blen;
        }

        private void skipScript() {
            if (!this.atTerminator()) {
                int oldIndex = this.index++;
                this.skipUntilTerminatorOrIDSeparator();
                if (this.index - oldIndex != 5) {
                    this.index = oldIndex;
                }
            }
        }

        private int parseCountry() {
            if (!this.atTerminator()) {
                char c;
                int oldIndex = this.index++;
                int oldBlen = this.blen;
                while (!this.isTerminatorOrIDSeparator(c = this.next())) {
                    if (oldBlen == this.blen) {
                        this.hadCountry = true;
                        this.addSeparator();
                        ++oldBlen;
                    }
                    this.append(Character.toUpperCase(c));
                }
                --this.index;
                int charsAppended = this.blen - oldBlen;
                if (charsAppended != 0) {
                    if (charsAppended < 2 || charsAppended > 3) {
                        this.index = oldIndex;
                        this.blen = --oldBlen;
                        this.hadCountry = false;
                    } else if (charsAppended == 3) {
                        ULocale.initCountryTables();
                        int offset = ULocale.findIndex(_countries3, this.getString(oldBlen));
                        if (offset >= 0) {
                            this.set(oldBlen, _countries[offset]);
                        } else {
                            offset = ULocale.findIndex(_obsoleteCountries3, this.getString(oldBlen));
                            if (offset >= 0) {
                                this.set(oldBlen, _obsoleteCountries[offset]);
                            }
                        }
                    }
                }
                return oldBlen;
            }
            return this.blen;
        }

        private void skipCountry() {
            if (!this.atTerminator()) {
                ++this.index;
                int oldIndex = this.index;
                this.skipUntilTerminatorOrIDSeparator();
                int charsSkipped = this.index - oldIndex;
                if (charsSkipped < 2 || charsSkipped > 3) {
                    this.index = oldIndex;
                }
            }
        }

        private int parseVariant() {
            char c;
            int oldBlen = this.blen;
            boolean start = true;
            boolean needSeparator = true;
            boolean skipping = false;
            while ((c = this.next()) != '\uffff') {
                if (c == '.') {
                    start = false;
                    skipping = true;
                    continue;
                }
                if (c == '@') {
                    if (this.haveKeywordAssign()) break;
                    skipping = false;
                    start = false;
                    needSeparator = true;
                    continue;
                }
                if (start) {
                    start = false;
                    continue;
                }
                if (skipping) continue;
                if (needSeparator) {
                    boolean incOldBlen = this.blen == oldBlen;
                    needSeparator = false;
                    if (incOldBlen && !this.hadCountry) {
                        this.addSeparator();
                        ++oldBlen;
                    }
                    this.addSeparator();
                    if (incOldBlen) {
                        ++oldBlen;
                    }
                }
                if ((c = Character.toUpperCase(c)) == '-' || c == ',') {
                    c = '_';
                }
                this.append(c);
            }
            --this.index;
            return oldBlen;
        }

        public String getLanguage() {
            this.reset();
            return this.getString(this.parseLanguage());
        }

        public String getScript() {
            this.reset();
            this.skipLanguage();
            return this.getString(this.parseScript());
        }

        public String getCountry() {
            this.reset();
            this.skipLanguage();
            this.skipScript();
            return this.getString(this.parseCountry());
        }

        public String getVariant() {
            this.reset();
            this.skipLanguage();
            this.skipScript();
            this.skipCountry();
            return this.getString(this.parseVariant());
        }

        public String[] getLanguageScriptCountryVariant() {
            this.reset();
            return new String[]{this.getString(this.parseLanguage()), this.getString(this.parseScript()), this.getString(this.parseCountry()), this.getString(this.parseVariant())};
        }

        public void parseBaseName() {
            if (this.baseName != null) {
                this.set(0, this.baseName);
            } else {
                this.reset();
                this.parseLanguage();
                this.parseScript();
                this.parseCountry();
                this.parseVariant();
                if (this.blen > 1 && this.buffer[this.blen - 1] == '_') {
                    --this.blen;
                }
            }
        }

        public String getBaseName() {
            if (this.baseName != null) {
                return this.baseName;
            }
            this.parseBaseName();
            return this.getString(0);
        }

        public String getName() {
            this.parseBaseName();
            this.parseKeywords();
            return this.getString(0);
        }

        private boolean setToKeywordStart() {
            for (int i = this.index; i < this.id.length; ++i) {
                if (this.id[i] != '@') continue;
                if (this.canonicalize) {
                    for (int j = ++i; j < this.id.length; ++j) {
                        if (this.id[j] != '=') continue;
                        this.index = i;
                        return true;
                    }
                    break;
                }
                if (++i >= this.id.length) break;
                this.index = i;
                return true;
            }
            return false;
        }

        private static boolean isDoneOrKeywordAssign(char c) {
            return c == '\uffff' || c == '=';
        }

        private static boolean isDoneOrItemSeparator(char c) {
            return c == '\uffff' || c == ';';
        }

        private String getKeyword() {
            int start = this.index;
            while (!IDParser.isDoneOrKeywordAssign(this.next())) {
            }
            --this.index;
            return new String(this.id, start, this.index - start).trim().toLowerCase();
        }

        private String getValue() {
            int start = this.index;
            while (!IDParser.isDoneOrItemSeparator(this.next())) {
            }
            --this.index;
            return new String(this.id, start, this.index - start).trim();
        }

        private Comparator getKeyComparator() {
            Comparator comp = new Comparator(){

                public int compare(Object lhs, Object rhs) {
                    return ((String)lhs).compareTo((String)rhs);
                }
            };
            return comp;
        }

        /*
         * Unable to fully structure code
         * Enabled aggressive block sorting
         * Lifted jumps to return sites
         */
        private Map getKeywordMap() {
            if (this.keywords != null) return this.keywords;
            m = null;
            if (!this.setToKeywordStart()) ** GOTO lbl-1000
            while ((key = this.getKeyword()).length() != 0) {
                c = this.next();
                if (c == '=') ** GOTO lbl10
                if (c == '\uffff') {
                    break;
                }
                ** GOTO lbl17
lbl10: // 1 sources:
                value = this.getValue();
                if (value.length() == 0) ** GOTO lbl17
                if (m != null) ** GOTO lbl15
                m = new TreeMap<String, String>(this.getKeyComparator());
                ** GOTO lbl-1000
lbl15: // 1 sources:
                if (!m.containsKey(key)) lbl-1000: // 2 sources:
                {
                    m.put(key, value);
                }
lbl17: // 5 sources:
                if (this.next() == ';') continue;
            }
            if (m != null) {
                v0 = m;
            } else lbl-1000: // 2 sources:
            {
                v0 = Collections.EMPTY_MAP;
            }
            this.keywords = v0;
            return this.keywords;
        }

        private int parseKeywords() {
            int oldBlen = this.blen;
            Map m = this.getKeywordMap();
            if (!m.isEmpty()) {
                Iterator iter = m.entrySet().iterator();
                boolean first = true;
                while (iter.hasNext()) {
                    this.append(first ? '@' : ';');
                    first = false;
                    Map.Entry e = iter.next();
                    this.append((String)e.getKey());
                    this.append('=');
                    this.append((String)e.getValue());
                }
                if (this.blen != oldBlen) {
                    ++oldBlen;
                }
            }
            return oldBlen;
        }

        public String getKeywordValue(String keywordName) {
            Map m = this.getKeywordMap();
            return m.isEmpty() ? null : (String)m.get(keywordName.trim().toLowerCase());
        }

        public void setKeywordValue(String keywordName, String value) {
            this.setKeywordValue(keywordName, value, true);
        }

        private void setKeywordValue(String keywordName, String value, boolean reset) {
            if (keywordName == null) {
                if (reset) {
                    this.keywords = Collections.EMPTY_MAP;
                }
            } else {
                if ((keywordName = keywordName.trim().toLowerCase()).length() == 0) {
                    throw new IllegalArgumentException("keyword must not be empty");
                }
                if (value != null && (value = value.trim()).length() == 0) {
                    throw new IllegalArgumentException("value must not be empty");
                }
                Map m = this.getKeywordMap();
                if (m.isEmpty()) {
                    if (value != null) {
                        this.keywords = new TreeMap(this.getKeyComparator());
                        this.keywords.put(keywordName, value.trim());
                    }
                } else if (reset || !m.containsKey(keywordName)) {
                    if (value != null) {
                        m.put(keywordName, value);
                    } else {
                        m.remove(keywordName);
                        if (m.isEmpty()) {
                            this.keywords = Collections.EMPTY_MAP;
                        }
                    }
                }
            }
        }

    }

}