LocaleExtensions.java revision 2ae130017183d2f66d55bf0ca51f8da3294644fd
12ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* GENERATED SOURCE. DO NOT MODIFY. */
22ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/*
32ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *******************************************************************************
42ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Copyright (C) 2009-2010, International Business Machines Corporation and    *
52ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * others. All Rights Reserved.                                                *
62ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller *******************************************************************************
72ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */
82ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpackage android.icu.impl.locale;
92ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Collections;
112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Map;
122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Map.Entry;
132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Set;
142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.SortedMap;
152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.TreeMap;
162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.TreeSet;
172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.impl.locale.InternalLocaleBuilder.CaseInsensitiveChar;
192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.impl.locale.InternalLocaleBuilder.CaseInsensitiveString;
202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpublic class LocaleExtensions {
232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private SortedMap<Character, Extension> _map;
252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private String _id;
262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private static final SortedMap<Character, Extension> EMPTY_MAP =
282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Collections.unmodifiableSortedMap(new TreeMap<Character, Extension>());
292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final LocaleExtensions EMPTY_EXTENSIONS;
312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final LocaleExtensions CALENDAR_JAPANESE;
322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static final LocaleExtensions NUMBER_THAI;
332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    static {
352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        EMPTY_EXTENSIONS = new LocaleExtensions();
362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        EMPTY_EXTENSIONS._id = "";
372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        EMPTY_EXTENSIONS._map = EMPTY_MAP;
382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        CALENDAR_JAPANESE = new LocaleExtensions();
402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        CALENDAR_JAPANESE._id = "u-ca-japanese";
412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        CALENDAR_JAPANESE._map = new TreeMap<Character, Extension>();
422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        CALENDAR_JAPANESE._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.CA_JAPANESE);
432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        NUMBER_THAI = new LocaleExtensions();
452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        NUMBER_THAI._id = "u-nu-thai";
462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        NUMBER_THAI._map = new TreeMap<Character, Extension>();
472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        NUMBER_THAI._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.NU_THAI);
482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private LocaleExtensions() {
512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    /*
542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     * Package local constructor, only used by InternalLocaleBuilder.
552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller     */
562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    LocaleExtensions(Map<CaseInsensitiveChar, String> extensions,
572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            Set<CaseInsensitiveString> uattributes, Map<CaseInsensitiveString, String> ukeywords) {
582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        boolean hasExtension = (extensions != null && extensions.size() > 0);
592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        boolean hasUAttributes = (uattributes != null && uattributes.size() > 0);
602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        boolean hasUKeywords = (ukeywords != null && ukeywords.size() > 0);
612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (!hasExtension && !hasUAttributes && !hasUKeywords) {
632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            _map = EMPTY_MAP;
642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            _id = "";
652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return;
662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        // Build extension map
692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        _map = new TreeMap<Character, Extension>();
702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (hasExtension) {
712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            for (Entry<CaseInsensitiveChar, String> ext : extensions.entrySet()) {
722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                char key = AsciiUtil.toLower(ext.getKey().value());
732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                String value = ext.getValue();
742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                if (LanguageTag.isPrivateusePrefixChar(key)) {
762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    // we need to exclude special variant in privuateuse, e.g. "x-abc-lvariant-DEF"
772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    value = InternalLocaleBuilder.removePrivateuseVariant(value);
782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    if (value == null) {
792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                        continue;
802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    }
812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                }
822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                Extension e = new Extension(key, AsciiUtil.toLowerString(value));
842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                _map.put(Character.valueOf(key), e);
852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (hasUAttributes || hasUKeywords) {
892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            TreeSet<String> uaset = null;
902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            TreeMap<String, String> ukmap = null;
912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            if (hasUAttributes) {
932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                uaset = new TreeSet<String>();
942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                for (CaseInsensitiveString cis : uattributes) {
952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    uaset.add(AsciiUtil.toLowerString(cis.value()));
962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                }
972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            if (hasUKeywords) {
1002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                ukmap = new TreeMap<String, String>();
1012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                for (Entry<CaseInsensitiveString, String> kwd : ukeywords.entrySet()) {
1022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    String key = AsciiUtil.toLowerString(kwd.getKey().value());
1032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    String type = AsciiUtil.toLowerString(kwd.getValue());
1042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    ukmap.put(key, type);
1052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                }
1062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
1072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            UnicodeLocaleExtension ule = new UnicodeLocaleExtension(uaset, ukmap);
1092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            _map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), ule);
1102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
1112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (_map.size() == 0) {
1132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            // this could happen when only privuateuse with special variant
1142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            _map = EMPTY_MAP;
1152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            _id = "";
1162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        } else {
1172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            _id = toID(_map);
1182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
1192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public Set<Character> getKeys() {
1222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return Collections.unmodifiableSet(_map.keySet());
1232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public Extension getExtension(Character key) {
1262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue())));
1272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public String getExtensionValue(Character key) {
1302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Extension ext = _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue())));
1312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (ext == null) {
1322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return null;
1332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
1342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return ext.getValue();
1352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public Set<String> getUnicodeLocaleAttributes() {
1382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON));
1392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (ext == null) {
1402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return Collections.emptySet();
1412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
1422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        assert (ext instanceof UnicodeLocaleExtension);
1432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return ((UnicodeLocaleExtension)ext).getUnicodeLocaleAttributes();
1442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public Set<String> getUnicodeLocaleKeys() {
1472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON));
1482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (ext == null) {
1492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return Collections.emptySet();
1502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
1512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        assert (ext instanceof UnicodeLocaleExtension);
1522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return ((UnicodeLocaleExtension)ext).getUnicodeLocaleKeys();
1532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public String getUnicodeLocaleType(String unicodeLocaleKey) {
1562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON));
1572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (ext == null) {
1582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return null;
1592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
1602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        assert (ext instanceof UnicodeLocaleExtension);
1612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return ((UnicodeLocaleExtension)ext).getUnicodeLocaleType(AsciiUtil.toLowerString(unicodeLocaleKey));
1622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public boolean isEmpty() {
1652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return _map.isEmpty();
1662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static boolean isValidKey(char c) {
1692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return LanguageTag.isExtensionSingletonChar(c) || LanguageTag.isPrivateusePrefixChar(c);
1702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public static boolean isValidUnicodeLocaleKey(String ukey) {
1732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return UnicodeLocaleExtension.isKey(ukey);
1742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
1762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    private static String toID(SortedMap<Character, Extension> map) {
1772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        StringBuilder buf = new StringBuilder();
1782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        Extension privuse = null;
1792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        for (Entry<Character, Extension> entry : map.entrySet()) {
1802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            char singleton = entry.getKey().charValue();
1812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            Extension extension = entry.getValue();
1822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            if (LanguageTag.isPrivateusePrefixChar(singleton)) {
1832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                privuse = extension;
1842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            } else {
1852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                if (buf.length() > 0) {
1862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                    buf.append(LanguageTag.SEP);
1872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                }
1882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                buf.append(extension);
1892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
1902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
1912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (privuse != null) {
1922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            if (buf.length() > 0) {
1932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller                buf.append(LanguageTag.SEP);
1942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            }
1952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            buf.append(privuse);
1962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
1972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return buf.toString();
1982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
1992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public String toString() {
2022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return _id;
2032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
2042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public String getID() {
2062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return _id;
2072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
2082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public int hashCode() {
2102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return _id.hashCode();
2112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
2122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller
2132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    public boolean equals(Object other) {
2142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (this == other) {
2152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return true;
2162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
2172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        if (!(other instanceof LocaleExtensions)) {
2182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller            return false;
2192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        }
2202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller        return this._id.equals(((LocaleExtensions)other)._id);
2212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller    }
2222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller}
223