12ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* GENERATED SOURCE. DO NOT MODIFY. */ 2f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// © 2016 and later: Unicode, Inc. and others. 3f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert// License & terms of use: http://www.unicode.org/copyright.html#License 42ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/* 52ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ******************************************************************************* 67241d93e30f4c7c527c019cd6ca3a791ca22d9b2Fredrik Roubert * Copyright (C) 1996-2016, International Business Machines Corporation and 72ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * others. All Rights Reserved. 82ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ******************************************************************************* 92ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpackage android.icu.text; 122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.io.IOException; 142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.io.ObjectInputStream; 152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.io.Serializable; 16f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport java.util.ArrayList; 172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.HashMap; 18f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport java.util.HashSet; 19f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport java.util.List; 202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Locale; 212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.Map; 222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.MissingResourceException; 232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport java.util.ResourceBundle; 24f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport java.util.Set; 25f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport java.util.TreeMap; 262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 27f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport android.icu.impl.CacheBase; 282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.impl.CalendarUtil; 29f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport android.icu.impl.ICUData; 302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.impl.ICUResourceBundle; 31f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport android.icu.impl.SoftCache; 32f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport android.icu.impl.UResource; 332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.impl.Utility; 342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.text.TimeZoneNames.NameType; 352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.Calendar; 362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.ICUCloneNotSupportedException; 37f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubertimport android.icu.util.ICUException; 382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.TimeZone; 392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.ULocale; 402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.ULocale.Category; 412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.UResourceBundle; 422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerimport android.icu.util.UResourceBundleIterator; 432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller/** 451537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu enhancement]</strong> ICU's replacement for {@link java.text.DateFormatSymbols}. Methods, fields, and other functionality specific to ICU are labeled '<strong>[icu]</strong>'. 462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p><code>DateFormatSymbols</code> is a public class for encapsulating 482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * localizable date-time formatting data, such as the names of the 492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * months, the names of the days of the week, and the time zone data. 502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormat</code> and <code>SimpleDateFormat</code> both use 512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormatSymbols</code> to encapsulate this information. 522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>Typically you shouldn't use <code>DateFormatSymbols</code> directly. 542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Rather, you are encouraged to create a date-time formatter with the 552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormat</code> class's factory methods: <code>getTimeInstance</code>, 562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>getDateInstance</code>, or <code>getDateTimeInstance</code>. 572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * These methods automatically create a <code>DateFormatSymbols</code> for 582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * the formatter so that you don't have to. After the 592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * formatter is created, you may modify its format pattern using the 602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>setPattern</code> method. For more information about 612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * creating formatters using <code>DateFormat</code>'s factory methods, 622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * see {@link DateFormat}. 632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>If you decide to create a date-time formatter with a specific 652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * format pattern for a specific locale, you can do so with: 662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <blockquote> 672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <pre> 682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * new SimpleDateFormat(aPattern, new DateFormatSymbols(aLocale)). 692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </pre> 702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </blockquote> 712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p><code>DateFormatSymbols</code> objects are clonable. When you obtain 732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * a <code>DateFormatSymbols</code> object, feel free to modify the 742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * date-time formatting data. For instance, you can replace the localized 752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * date-time format pattern characters with the ones that you feel easy 762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * to remember. Or you can change the representative cities 772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * to your favorite ones. 782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>New <code>DateFormatSymbols</code> subclasses may be added to support 802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>SimpleDateFormat</code> for date-time formatting for additional locales. 812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see DateFormat 832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see SimpleDateFormat 842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.SimpleTimeZone 852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @author Chen-Lieh Huang 862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fullerpublic class DateFormatSymbols implements Serializable, Cloneable { 882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // TODO make sure local pattern char string is 18 characters long, 902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // that is, that it encompasses the new 'u' char for 912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // EXTENDED_YEAR. Two options: 1. Make sure resource data is 922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // correct; 2. Make code add in 'u' at end if len == 17. 932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // Constants for context 952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 961537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constant for context. 972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int FORMAT = 0; 992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1011537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constant for context. 1022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int STANDALONE = 1; 1042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1061537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constant for context. NUMERIC context 1072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * is only supported for leapMonthPatterns. 1082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated This API is ICU internal only. 10993cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller * @hide original deprecated declaration 110836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 1132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int NUMERIC = 2; 1142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1161537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constant for context. 1172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated This API is ICU internal only. 11893cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller * @hide original deprecated declaration 119836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 1222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int DT_CONTEXT_COUNT = 3; 1232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // Constants for width 1252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1271537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constant for width. 1282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int ABBREVIATED = 0; 1302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1321537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constant for width. 1332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int WIDE = 1; 1352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1371537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constant for width. 1382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int NARROW = 2; 1402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1421537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constant for width; only supported for weekdays. 1432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int SHORT = 3; 1452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1471537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constant for width. 1482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated This API is ICU internal only. 14993cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller * @hide original deprecated declaration 150836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 1532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static final int DT_WIDTH_COUNT = 4; 1542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1561537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Somewhat temporary constant for leap month pattern type, adequate for Chinese calendar. 157836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final int DT_LEAP_MONTH_PATTERN_FORMAT_WIDE = 0; 1602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1621537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Somewhat temporary constant for leap month pattern type, adequate for Chinese calendar. 163836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final int DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV = 1; 1662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1681537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Somewhat temporary constant for leap month pattern type, adequate for Chinese calendar. 169836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final int DT_LEAP_MONTH_PATTERN_FORMAT_NARROW = 2; 1722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1741537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Somewhat temporary constant for leap month pattern type, adequate for Chinese calendar. 175836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final int DT_LEAP_MONTH_PATTERN_STANDALONE_WIDE = 3; 1782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1801537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Somewhat temporary constant for leap month pattern type, adequate for Chinese calendar. 181836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final int DT_LEAP_MONTH_PATTERN_STANDALONE_ABBREV = 4; 1842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1861537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Somewhat temporary constant for leap month pattern type, adequate for Chinese calendar. 187836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final int DT_LEAP_MONTH_PATTERN_STANDALONE_NARROW = 5; 1902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1921537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Somewhat temporary constant for leap month pattern type, adequate for Chinese calendar. 193836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 1942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final int DT_LEAP_MONTH_PATTERN_NUMERIC = 6; 1962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 1981537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Somewhat temporary constant for month pattern count, adequate for Chinese calendar. 199836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 2002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 2012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final int DT_MONTH_PATTERN_COUNT = 7; 2022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 2041537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> This default time separator is used for formatting when the locale 2052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * doesn't specify any time separator, and always recognized when parsing. 206836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 2072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 2082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final String DEFAULT_TIME_SEPARATOR = ":"; 2092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 2111537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> This alternate time separator is always recognized when parsing. 212836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 2132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 2142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final String ALTERNATE_TIME_SEPARATOR = "."; 2152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 2172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Constructs a DateFormatSymbols object by loading format data from 2182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * resources for the default <code>FORMAT</code> locale. 2192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @throws java.util.MissingResourceException if the resources for the default locale 2212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * cannot be found or cannot be loaded. 2222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see Category#FORMAT 2232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 2242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public DateFormatSymbols() 2252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 2262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this(ULocale.getDefault(Category.FORMAT)); 2272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 2282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 2302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Constructs a DateFormatSymbols object by loading format data from 2312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * resources for the given locale. 2322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @throws java.util.MissingResourceException if the resources for the specified 2342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * locale cannot be found or cannot be loaded. 2352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 2362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public DateFormatSymbols(Locale locale) 2372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 2382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this(ULocale.forLocale(locale)); 2392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 2402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 2421537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constructs a DateFormatSymbols object by loading format data from 2432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * resources for the given ulocale. 2442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @throws java.util.MissingResourceException if the resources for the specified 2462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * locale cannot be found or cannot be loaded. 2472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 2482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public DateFormatSymbols(ULocale locale) 2492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 2502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller initializeData(locale, CalendarUtil.getCalendarType(locale)); 2512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 2522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 2542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns a DateFormatSymbols instance for the default locale. 2552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2561537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu] Note:</strong> Unlike <code>java.text.DateFormatSymbols#getInstance</code>, 2571fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * this method simply returns <code>new android.icu.text.DateFormatSymbols()</code>. 2582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * ICU does not support <code>DateFormatSymbolsProvider</code> introduced in Java 6 2592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * or its equivalent implementation for now. 2602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return A DateFormatSymbols instance. 2622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 2632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static DateFormatSymbols getInstance() { 2642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return new DateFormatSymbols(); 2652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 2662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 2682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns a DateFormatSymbols instance for the given locale. 2692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2701537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu] Note:</strong> Unlike <code>java.text.DateFormatSymbols#getInstance</code>, 2711fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * this method simply returns <code>new android.icu.text.DateFormatSymbols(locale)</code>. 2722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * ICU does not support <code>DateFormatSymbolsProvider</code> introduced in Java 6 2732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * or its equivalent implementation for now. 2742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param locale the locale. 2762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return A DateFormatSymbols instance. 2772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 2782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static DateFormatSymbols getInstance(Locale locale) { 2792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return new DateFormatSymbols(locale); 2802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 2812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 2831537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Returns a DateFormatSymbols instance for the given locale. 2842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2851537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu] Note:</strong> Unlike <code>java.text.DateFormatSymbols#getInstance</code>, 2861fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * this method simply returns <code>new android.icu.text.DateFormatSymbols(locale)</code>. 2872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * ICU does not support <code>DateFormatSymbolsProvider</code> introduced in Java 6 2882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * or its equivalent implementation for now. 2892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param locale the locale. 2912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return A DateFormatSymbols instance. 2922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 2932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static DateFormatSymbols getInstance(ULocale locale) { 2942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return new DateFormatSymbols(locale); 2952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 2962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 2982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns an array of all locales for which the <code>getInstance</code> methods of 2992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this class can return localized instances. 3002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 3011537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu] Note:</strong> Unlike <code>java.text.DateFormatSymbols#getAvailableLocales</code>, 3022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this method simply returns the array of <code>Locale</code>s available in this 3032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * class. ICU does not support <code>DateFormatSymbolsProvider</code> introduced in 3042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Java 6 or its equivalent implementation for now. 3052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 3062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return An array of <code>Locale</code>s for which localized 3072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormatSymbols</code> instances are available. 3082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static Locale[] getAvailableLocales() { 3102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return ICUResourceBundle.getAvailableLocales(); 3112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 3122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3141537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Returns an array of all locales for which the <code>getInstance</code> 3152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * methods of this class can return localized instances. 3162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 3171537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu] Note:</strong> Unlike <code>java.text.DateFormatSymbols#getAvailableLocales</code>, 3182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this method simply returns the array of <code>ULocale</code>s available in this 3192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * class. ICU does not support <code>DateFormatSymbolsProvider</code> introduced in 3202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Java 6 or its equivalent implementation for now. 3212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 3222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return An array of <code>ULocale</code>s for which localized 3232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormatSymbols</code> instances are available. 324836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 3252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static ULocale[] getAvailableULocales() { 3272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return ICUResourceBundle.getAvailableULocales(); 3282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 3292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Era strings. For example: "AD" and "BC". An array of 2 strings, 3322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * indexed by <code>Calendar.BC</code> and <code>Calendar.AD</code>. 3332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 3342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String eras[] = null; 3362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Era name strings. For example: "Anno Domini" and "Before Christ". An array of 2 strings, 3392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * indexed by <code>Calendar.BC</code> and <code>Calendar.AD</code>. 3402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 3412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String eraNames[] = null; 3432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Narrow era names. For example: "A" and "B". An array of 2 strings, 3462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * indexed by <code>Calendar.BC</code> and <code>Calendar.AD</code>. 3472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 3482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String narrowEras[] = null; 3502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Month strings. For example: "January", "February", etc. An array 3532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * of 13 strings (some calendars have 13 months), indexed by 3542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc. 3552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 3562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String months[] = null; 3582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Short month strings. For example: "Jan", "Feb", etc. An array of 3612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 13 strings (some calendars have 13 months), indexed by 3622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc. 3632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 3652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String shortMonths[] = null; 3672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Narrow month strings. For example: "J", "F", etc. An array of 3702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 13 strings (some calendars have 13 months), indexed by 3712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc. 3722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 3742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String narrowMonths[] = null; 3762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Standalone month strings. For example: "January", "February", etc. An array 3792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * of 13 strings (some calendars have 13 months), indexed by 3802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc. 3812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 3822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String standaloneMonths[] = null; 3842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Standalone short month strings. For example: "Jan", "Feb", etc. An array of 3872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 13 strings (some calendars have 13 months), indexed by 3882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc. 3892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 3912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 3922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String standaloneShortMonths[] = null; 3932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 3952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Standalone narrow month strings. For example: "J", "F", etc. An array of 3962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 13 strings (some calendars have 13 months), indexed by 3972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.JANUARY</code>, <code>Calendar.FEBRUARY</code>, etc. 3982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 3992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String standaloneNarrowMonths[] = null; 4022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Format wide weekday strings, for example: "Sunday", "Monday", etc. 4052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of 8 strings, indexed by <code>Calendar.SUNDAY</code>, 4062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 4072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The element <code>weekdays[0]</code> is ignored. 4082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String weekdays[] = null; 4112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * CLDR-style format abbreviated (not short) weekday strings, 4142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for example: "Sun", "Mon", etc. 4152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of 8 strings, indexed by <code>Calendar.SUNDAY</code>, 4162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 4172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The element <code>shortWeekdays[0]</code> is ignored. 4182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String shortWeekdays[] = null; 4212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * CLDR-style format short weekday strings, for example: "Su", "Mo", etc. 4242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of 8 strings, indexed by <code>Calendar.SUNDAY</code>, 4252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 4262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The element <code>shorterWeekdays[0]</code> is ignored. 4272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // Note, serialization restore from pre-ICU-51 will leave this null. 4302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String shorterWeekdays[] = null; 4312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * CLDR-style format narrow weekday strings, for example: "S", "M", etc. 4342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of 8 strings, indexed by <code>Calendar.SUNDAY</code>, 4352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 4362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The element <code>narrowWeekdays[0]</code> is ignored. 4372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String narrowWeekdays[] = null; 4402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Standalone wide weekday strings. For example: "Sunday", "Monday", etc. 4432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of 8 strings, indexed by <code>Calendar.SUNDAY</code>, 4442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 4452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The element <code>standaloneWeekdays[0]</code> is ignored. 4462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String standaloneWeekdays[] = null; 4492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * CLDR-style standalone abbreviated (not short) weekday strings, 4522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for example: "Sun", "Mon", etc. 4532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of 8 strings, indexed by <code>Calendar.SUNDAY</code>, 4542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 4552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The element <code>standaloneShortWeekdays[0]</code> is ignored. 4562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String standaloneShortWeekdays[] = null; 4592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * CLDR-style standalone short weekday strings, for example: "Sun", "Mon", etc. 4622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of 8 strings, indexed by <code>Calendar.SUNDAY</code>, 4632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 4642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The element <code>standaloneShorterWeekdays[0]</code> is ignored. 4652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // Note, serialization restore from pre-ICU-51 will leave this null. 4682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String standaloneShorterWeekdays[] = null; 4692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Standalone narrow weekday strings. For example: "S", "M", etc. An array 4722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * of 8 strings, indexed by <code>Calendar.SUNDAY</code>, 4732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 4742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The element <code>standaloneNarrowWeekdays[0]</code> is ignored. 4752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String standaloneNarrowWeekdays[] = null; 4782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * AM and PM strings. For example: "AM" and "PM". An array of 4812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2 strings, indexed by <code>Calendar.AM</code> and 4822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.PM</code>. 4832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String ampms[] = null; 4862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * narrow AM and PM strings. For example: "a" and "p". An array of 4892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 2 strings, indexed by <code>Calendar.AM</code> and 4902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.PM</code>. 4912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String ampmsNarrow[] = null; 4942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 4952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 4962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Time separator string. For example: ":". 4972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 4982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 4992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private String timeSeparator = null; 5002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Abbreviated quarter names. For example: "Q1", "Q2", "Q3", "Q4". An array 5032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * of 4 strings indexed by the month divided by 3. 5042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 5052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 5062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String shortQuarters[] = null; 5072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Full quarter names. For example: "1st Quarter", "2nd Quarter", "3rd Quarter", 5102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * "4th Quarter". An array of 4 strings, indexed by the month divided by 3. 5112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 5122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 5132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String quarters[] = null; 5142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Standalone abbreviated quarter names. For example: "Q1", "Q2", "Q3", "Q4". An array 5172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * of 4 strings indexed by the month divided by 3. 5182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 5192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 5202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String standaloneShortQuarters[] = null; 5212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Standalone full quarter names. For example: "1st Quarter", "2nd Quarter", "3rd Quarter", 5242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * "4th Quarter". An array of 4 strings, indexed by the month divided by 3. 5252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 5262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 5272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String standaloneQuarters[] = null; 5282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * All leap month patterns, for example "{0}bis". 5312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of DT_MONTH_PATTERN_COUNT strings, indexed by the DT_LEAP_MONTH_PATTERN_XXX value. 5322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 5332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 5342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String leapMonthPatterns[] = null; 5352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Cyclic year names, for example: "jia-zi", "yi-chou", ... "gui-hai". 5382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of (normally) 60 strings, corresponding to cyclic years 1-60 (in Calendar YEAR field). 5392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Currently we only have data for format/abbreviated. 5402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * For the others, just get from format/abbreviated, ignore set. 5412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 5422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 5432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String shortYearNames[] = null; 5442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Cyclic zodiac names, for example: "Rat", "Ox", "Tiger", etc. 5472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of (normally) 12 strings. 5482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Currently we only have data for format/abbreviated. 5492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * For the others, just get from format/abbreviated, ignore set. 5502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 5512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 5522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String shortZodiacNames[] = null; 5532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Localized names of time zones in this locale. This is a 5562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * two-dimensional array of strings of size <em>n</em> by <em>m</em>, 5572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * where <em>m</em> is at least 5 and up to 7. Each of the <em>n</em> rows is an 5582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * entry containing the localized names for a single <code>TimeZone</code>. 5592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Each such row contains (with <code>i</code> ranging from 5602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 0..<em>n</em>-1): 5612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <ul> 5622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><code>zoneStrings[i][0]</code> - time zone ID</li> 5632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><code>zoneStrings[i][1]</code> - long name of zone in standard 5642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * time</li> 5652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><code>zoneStrings[i][2]</code> - short name of zone in 5662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * standard time</li> 5672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><code>zoneStrings[i][3]</code> - long name of zone in daylight 5682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * savings time</li> 5692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><code>zoneStrings[i][4]</code> - short name of zone in daylight 5702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * savings time</li> 5712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><code>zoneStrings[i][5]</code> - location name of zone</li> 5722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><code>zoneStrings[i][6]</code> - long generic name of zone</li> 5732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><code>zoneStrings[i][7]</code> - short generic of zone</li> 57408ae9f2909b2ec37f755dac4372553437e9d7cf6Paul Duffin * </ul> 5752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The zone ID is <em>not</em> localized; it corresponds to the ID 5762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * value associated with a system time zone object. All other entries 5772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * are localized names. If a zone does not implement daylight savings 5782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * time, the daylight savings time names are ignored. 5792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <em>Note:</em>CLDR 1.5 introduced metazone and its historical mappings. 5802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * This simple two-dimensional array is no longer sufficient to represent 5812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * localized names and its historic changes. Since ICU 3.8.1, localized 5822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * zone names extracted from ICU locale data is stored in a ZoneStringFormat 5832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * instance. But we still need to support the old way of customizing 5842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * localized zone names, so we keep this field for the purpose. 5852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.TimeZone 5862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 5872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 5882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private String zoneStrings[][] = null; 5892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Unlocalized date-time pattern characters. For example: 'y', 'd', etc. 5922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * All locales use the same unlocalized pattern characters. 5932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 5941c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert static final String patternChars = "GyMdkHmsSEDFwWahKzYeugAZvcLQqVUOXxrbB"; 5952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 5962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 5972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Localized date-time pattern characters. For example, a locale may 5982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * wish to use 'u' rather than 'y' to represent years in its date format 5992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * pattern strings. 6002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * This string must be exactly 18 characters long, with the index of 6012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * the characters described by <code>DateFormat.ERA_FIELD</code>, 6022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormat.YEAR_FIELD</code>, etc. Thus, if the string were 6032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * "Xz...", then localized patterns would use 'X' for era and 'z' for year. 6042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 6052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 6062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String localPatternChars = null; 6072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 6081c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert /** 6091c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * Localized names for abbreviated (== short) day periods. 6101c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * An array of strings, in the order of DayPeriod constants. 6111c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert */ 6121c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert String abbreviatedDayPeriods[] = null; 6131c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 6141c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert /** 6151c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * Localized names for wide day periods. 6161c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * An array of strings, in the order of DayPeriod constants. 6171c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert */ 6181c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert String wideDayPeriods[] = null; 6191c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 6201c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert /** 6211c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * Localized names for narrow day periods. 6221c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * An array of strings, in the order of DayPeriod constants. 6231c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert */ 6241c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert String narrowDayPeriods[] = null; 6251c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 6261c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert /** 6271c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * Localized names for standalone abbreviated (== short) day periods. 6281c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * An array of strings, in the order of DayPeriod constants. 6291c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert */ 6301c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert String standaloneAbbreviatedDayPeriods[] = null; 6311c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 6321c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert /** 6331c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * Localized names for standalone wide day periods. 6341c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * An array of strings, in the order of DayPeriod constants. 6351c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert */ 6361c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert String standaloneWideDayPeriods[] = null; 6371c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 6381c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert /** 6391c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * Localized names for standalone narrow day periods. 6401c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * An array of strings, in the order of DayPeriod constants. 6411c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert */ 6421c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert String standaloneNarrowDayPeriods[] = null; 6431c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 6442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /* use serialVersionUID from JDK 1.1.4 for interoperability */ 6452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private static final long serialVersionUID = -5987973545549424702L; 6462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 6472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private static final String[][] CALENDAR_CLASSES = { 6482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"GregorianCalendar", "gregorian"}, 6492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"JapaneseCalendar", "japanese"}, 6502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"BuddhistCalendar", "buddhist"}, 6512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"TaiwanCalendar", "roc"}, 6522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"PersianCalendar", "persian"}, 6532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"IslamicCalendar", "islamic"}, 6542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"HebrewCalendar", "hebrew"}, 6552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"ChineseCalendar", "chinese"}, 6562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"IndianCalendar", "indian"}, 6572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"CopticCalendar", "coptic"}, 6582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller {"EthiopicCalendar", "ethiopic"}, 6592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller }; 6602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 6612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 6621537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Constants for capitalization context usage types 6632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * related to date formatting. 664836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 6652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 6662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller enum CapitalizationContextUsage { 6671c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert OTHER, 6681c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert MONTH_FORMAT, /* except narrow */ 6691c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert MONTH_STANDALONE, /* except narrow */ 6701c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert MONTH_NARROW, 6711c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert DAY_FORMAT, /* except narrow */ 6721c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert DAY_STANDALONE, /* except narrow */ 6731c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert DAY_NARROW, 6741c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert ERA_WIDE, 6751c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert ERA_ABBREV, 6761c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert ERA_NARROW, 6771c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert ZONE_LONG, 6781c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert ZONE_SHORT, 6791c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert METAZONE_LONG, 6802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller METAZONE_SHORT 6812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 6822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 6832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** Map from resource key to CapitalizationContextUsage value 6842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 6852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private static final Map<String, CapitalizationContextUsage> contextUsageTypeMap; 6862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static { 6872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap=new HashMap<String, CapitalizationContextUsage>(); 6882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("month-format-except-narrow", CapitalizationContextUsage.MONTH_FORMAT); 6892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("month-standalone-except-narrow", CapitalizationContextUsage.MONTH_STANDALONE); 6902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("month-narrow", CapitalizationContextUsage.MONTH_NARROW); 6912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("day-format-except-narrow", CapitalizationContextUsage.DAY_FORMAT); 6922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("day-standalone-except-narrow", CapitalizationContextUsage.DAY_STANDALONE); 6932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("day-narrow", CapitalizationContextUsage.DAY_NARROW); 6942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("era-name", CapitalizationContextUsage.ERA_WIDE); 6952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("era-abbr", CapitalizationContextUsage.ERA_ABBREV); 6962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("era-narrow", CapitalizationContextUsage.ERA_NARROW); 6972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("zone-long", CapitalizationContextUsage.ZONE_LONG); 6982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("zone-short", CapitalizationContextUsage.ZONE_SHORT); 6992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("metazone-long", CapitalizationContextUsage.METAZONE_LONG); 7002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextUsageTypeMap.put("metazone-short", CapitalizationContextUsage.METAZONE_SHORT); 7012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 7022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 7032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 7042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Capitalization transforms. For each usage type, the first array element indicates 7052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * whether to titlecase for uiListOrMenu context, the second indicates whether to 7062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * titlecase for stand-alone context. 7072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @serial 7082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 7092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller Map<CapitalizationContextUsage,boolean[]> capitalization = null; 7102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 7112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 7122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns era strings. For example: "AD" and "BC". 7132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the era strings. 7142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 7152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getEras() { 7162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(eras); 7172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 7182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 7192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 7202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets era strings. For example: "AD" and "BC". 7212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newEras the new era strings. 7222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 7232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setEras(String[] newEras) { 7242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller eras = duplicate(newEras); 7252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 7262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 7272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 7281537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Returns era name strings. For example: "Anno Domini" and "Before Christ". 7292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the era strings. 7302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 7312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getEraNames() { 7322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(eraNames); 7332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 7342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 7352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 7361537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Sets era name strings. For example: "Anno Domini" and "Before Christ". 7372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newEraNames the new era strings. 7382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 7392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setEraNames(String[] newEraNames) { 7402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller eraNames = duplicate(newEraNames); 7412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 7422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 74322b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer // Android patch (http://b/30464240) start: Add getter for narrow eras. 74422b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer /** 74522b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer * <strong>[icu]</strong> Returns narrow era name strings. For example: "A" and "B". 74622b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer * @return the era strings. 74722b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer * @deprecated This API is ICU internal only. 74822b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer * @hide draft / provisional / internal are hidden on Android 74922b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer */ 75022b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer @Deprecated 75122b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer public String[] getNarrowEras() { 75222b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer return duplicate(narrowEras); 75322b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer } 75422b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer // Android patch end. 75522b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer 7562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 7572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns month strings. For example: "January", "February", etc. 7582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the month strings. 7592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 7602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getMonths() { 7612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(months); 7622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 7632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 7642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 7652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns month strings. For example: "January", "February", etc. 7662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The month context, FORMAT or STANDALONE. 7672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The width or the returned month string, 7682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * either WIDE, ABBREVIATED, or NARROW. 7692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the month strings. 7702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 7712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getMonths(int context, int width) { 7722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String [] returnValue = null; 7732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch (context) { 7742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case FORMAT : 7752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 7762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 7772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = months; 7782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 7792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 7802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : // no month data for this, defaults to ABBREVIATED 7812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = shortMonths; 7822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 7832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 7842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = narrowMonths; 7852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 7862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 7872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 7882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case STANDALONE : 7892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 7902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 7912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = standaloneMonths; 7922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 7932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 7942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : // no month data for this, defaults to ABBREVIATED 7952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = standaloneShortMonths; 7962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 7972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 7982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = standaloneNarrowMonths; 7992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (returnValue == null) { 8042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throw new IllegalArgumentException("Bad context or width argument"); 8052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(returnValue); 8072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 8092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 8102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets month strings. For example: "January", "February", etc. 8112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newMonths the new month strings. 8122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 8132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setMonths(String[] newMonths) { 8142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller months = duplicate(newMonths); 8152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 8172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 8182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets month strings. For example: "January", "February", etc. 8192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newMonths the new month strings. 8202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The formatting context, FORMAT or STANDALONE. 8212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The width of the month string, 8222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * either WIDE, ABBREVIATED, or NARROW. 8232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 8242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setMonths(String[] newMonths, int context, int width) { 8252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch (context) { 8262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case FORMAT : 8272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 8282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 8292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller months = duplicate(newMonths); 8302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 8322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shortMonths = duplicate(newMonths); 8332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 8352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller narrowMonths = duplicate(newMonths); 8362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller default : // HANDLE SHORT, etc. 8382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case STANDALONE : 8422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 8432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 8442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneMonths = duplicate(newMonths); 8452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 8472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneShortMonths = duplicate(newMonths); 8482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 8502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneNarrowMonths = duplicate(newMonths); 8512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller default : // HANDLE SHORT, etc. 8532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 8562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 8592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 8602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns short month strings. For example: "Jan", "Feb", etc. 8612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the short month strings. 8622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 8632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getShortMonths() { 8642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(shortMonths); 8652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 8672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 8682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets short month strings. For example: "Jan", "Feb", etc. 8692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newShortMonths the new short month strings. 8702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 8712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setShortMonths(String[] newShortMonths) { 8722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shortMonths = duplicate(newShortMonths); 8732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 8752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 8762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns wide weekday strings. For example: "Sunday", "Monday", etc. 8772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the weekday strings. Use <code>Calendar.SUNDAY</code>, 8782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. to index the result array. 8792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 8802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getWeekdays() { 8812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(weekdays); 8822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 8832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 8842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 8852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns weekday strings. For example: "Sunday", "Monday", etc. 8862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the weekday strings. Use <code>Calendar.SUNDAY</code>, 8872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. to index the result array. 8882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context Formatting context, either FORMAT or STANDALONE. 8892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width Width of strings to be returned, either 8902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * WIDE, ABBREVIATED, SHORT, or NARROW 8912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 8922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getWeekdays(int context, int width) { 8932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String [] returnValue = null; 8942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch (context) { 8952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case FORMAT : 8962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 8972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 8982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = weekdays; 8992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 9012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = shortWeekdays; 9022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : 9042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = (shorterWeekdays != null)? shorterWeekdays: shortWeekdays; 9052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 9072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = narrowWeekdays; 9082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case STANDALONE : 9122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 9132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 9142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = standaloneWeekdays; 9152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 9172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = standaloneShortWeekdays; 9182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : 9202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = (standaloneShorterWeekdays != null)? standaloneShorterWeekdays: standaloneShortWeekdays; 9212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 9232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = standaloneNarrowWeekdays; 9242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (returnValue == null) { 9292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throw new IllegalArgumentException("Bad context or width argument"); 9302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(returnValue); 9322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 9342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 9352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets weekday strings. For example: "Sunday", "Monday", etc. 9362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newWeekdays The new weekday strings. 9372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The formatting context, FORMAT or STANDALONE. 9382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The width of the strings, 9392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * either WIDE, ABBREVIATED, SHORT, or NARROW. 9402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 9412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setWeekdays(String[] newWeekdays, int context, int width) { 9422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch (context) { 9432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case FORMAT : 9442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 9452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 9462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller weekdays = duplicate(newWeekdays); 9472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 9492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shortWeekdays = duplicate(newWeekdays); 9502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : 9522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shorterWeekdays = duplicate(newWeekdays); 9532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 9552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller narrowWeekdays = duplicate(newWeekdays); 9562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case STANDALONE : 9602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 9612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 9622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneWeekdays = duplicate(newWeekdays); 9632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 9652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneShortWeekdays = duplicate(newWeekdays); 9662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : 9682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneShorterWeekdays = duplicate(newWeekdays); 9692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 9712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneNarrowWeekdays = duplicate(newWeekdays); 9722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 9752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 9782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 9792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets wide weekday strings. For example: "Sunday", "Monday", etc. 9802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newWeekdays the new weekday strings. The array should 9812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * be indexed by <code>Calendar.SUNDAY</code>, 9822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 9832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 9842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setWeekdays(String[] newWeekdays) { 9852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller weekdays = duplicate(newWeekdays); 9862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 9882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 9892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns abbreviated weekday strings; for example: "Sun", "Mon", etc. 9902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * (Note: the method name is misleading; it does not get the CLDR-style 9911c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * "short" weekday strings, e.g. "Su", "Mo", etc.) 9922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the abbreviated weekday strings. Use <code>Calendar.SUNDAY</code>, 9932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. to index the result array. 9942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 9952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getShortWeekdays() { 9962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(shortWeekdays); 9972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 9982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 9992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 10002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets abbreviated weekday strings; for example: "Sun", "Mon", etc. 10012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * (Note: the method name is misleading; it does not set the CLDR-style 10021c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * "short" weekday strings, e.g. "Su", "Mo", etc.) 10032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newAbbrevWeekdays the new abbreviated weekday strings. The array should 10042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * be indexed by <code>Calendar.SUNDAY</code>, 10052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>Calendar.MONDAY</code>, etc. 10062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 10072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setShortWeekdays(String[] newAbbrevWeekdays) { 10082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shortWeekdays = duplicate(newAbbrevWeekdays); 10092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 10111537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Returns quarter strings. For example: "1st Quarter", "2nd Quarter", etc. 10122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The quarter context, FORMAT or STANDALONE. 10132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The width or the returned quarter string, 10142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * either WIDE or ABBREVIATED. There are no NARROW quarters. 10152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the quarter strings. 10162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 10172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getQuarters(int context, int width) { 10182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String [] returnValue = null; 10192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch (context) { 10202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case FORMAT : 10212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 10222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 10232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = quarters; 10242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 10262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : // no quarter data for this, defaults to ABBREVIATED 10272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = shortQuarters; 10282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 10302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = null; 10312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 10352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case STANDALONE : 10362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 10372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 10382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = standaloneQuarters; 10392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 10412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : // no quarter data for this, defaults to ABBREVIATED 10422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = standaloneShortQuarters; 10432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW: 10452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller returnValue = null; 10462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (returnValue == null) { 10512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throw new IllegalArgumentException("Bad context or width argument"); 10522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(returnValue); 10542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 10562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 10571537b2f39245c07b00aa78c3600f7aebcb172490Neil Fuller * <strong>[icu]</strong> Sets quarter strings. For example: "1st Quarter", "2nd Quarter", etc. 10582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newQuarters the new quarter strings. 10592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The formatting context, FORMAT or STANDALONE. 10602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The width of the quarter string, 10612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * either WIDE or ABBREVIATED. There are no NARROW quarters. 10622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 10632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setQuarters(String[] newQuarters, int context, int width) { 10642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch (context) { 10652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case FORMAT : 10662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 10672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 10682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller quarters = duplicate(newQuarters); 10692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 10712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shortQuarters = duplicate(newQuarters); 10722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 10742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller //narrowQuarters = duplicate(newQuarters); 10752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller default : // HANDLE SHORT, etc. 10772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case STANDALONE : 10812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 10822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 10832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneQuarters = duplicate(newQuarters); 10842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 10862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneShortQuarters = duplicate(newQuarters); 10872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 10892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller //standaloneNarrowQuarters = duplicate(newQuarters); 10902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller default : // HANDLE SHORT, etc. 10922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 10952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 10972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 10982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 10992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns cyclic year name strings if the calendar has them, 11002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for example: "jia-zi", "yi-chou", etc. 11012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The usage context: FORMAT, STANDALONE. 11022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The requested name width: WIDE, ABBREVIATED, SHORT, NARROW. 11032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return The year name strings, or null if they are not 11042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * available for this calendar. 11052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 11062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getYearNames(int context, int width) { 11072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // context & width ignored for now, one set of names for all uses 11082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (shortYearNames != null) { 11092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(shortYearNames); 11102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return null; 11122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 11142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 11152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets cyclic year name strings, for example: "jia-zi", "yi-chou", etc. 11162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param yearNames The new cyclic year name strings. 11172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). 11182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported). 11192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 11202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setYearNames(String[] yearNames, int context, int width) { 11212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (context == FORMAT && width == ABBREVIATED) { 11222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shortYearNames = duplicate(yearNames); 11232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 11262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 11272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns calendar zodiac name strings if the calendar has them, 11282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for example: "Rat", "Ox", "Tiger", etc. 11292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The usage context: FORMAT, STANDALONE. 11302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The requested name width: WIDE, ABBREVIATED, SHORT, NARROW. 11312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return The zodiac name strings, or null if they are not 11322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * available for this calendar. 11332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 11342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getZodiacNames(int context, int width) { 11352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // context & width ignored for now, one set of names for all uses 11362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (shortZodiacNames != null) { 11372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(shortZodiacNames); 11382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return null; 11402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 11422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 11432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets calendar zodiac name strings, for example: "Rat", "Ox", "Tiger", etc. 11442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param zodiacNames The new zodiac name strings. 11452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The usage context: FORMAT, STANDALONE (currently only FORMAT is supported). 11462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The name width: WIDE, ABBREVIATED, NARROW (currently only ABBREVIATED is supported). 11472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 11482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setZodiacNames(String[] zodiacNames, int context, int width) { 11492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (context == FORMAT && width == ABBREVIATED) { 11502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shortZodiacNames = duplicate(zodiacNames); 11512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 11542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 11552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns the appropriate leapMonthPattern if the calendar has them, 11562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for example: "{0}bis" 11572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The usage context: FORMAT, STANDALONE, NUMERIC. 11582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The requested pattern width: WIDE, ABBREVIATED, SHORT, NARROW. 11592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return The leapMonthPattern, or null if not available for 11602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this calendar. 11612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated This API is ICU internal only. 116293cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller * @hide original deprecated declaration 1163836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 11642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 11652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 11662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String getLeapMonthPattern(int context, int width) { 11672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (leapMonthPatterns != null) { 11682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller int leapMonthPatternIndex = -1; 11692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch (context) { 11702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case FORMAT : 11712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 11722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 11732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_WIDE; 11742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 11752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 11762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : // no month data for this, defaults to ABBREVIATED 11772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV; 11782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 11792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 11802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_NARROW; 11812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 11822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 11842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case STANDALONE : 11852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 11862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 11872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_WIDE; 11882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 11892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 11902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case SHORT : // no month data for this, defaults to ABBREVIATED 11912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV; 11922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 11932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 11942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_NARROW; 11952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 11962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 11972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 11982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NUMERIC : 11992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_NUMERIC; 12002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (leapMonthPatternIndex < 0) { 12032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throw new IllegalArgumentException("Bad context or width argument"); 12042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return leapMonthPatterns[leapMonthPatternIndex]; 12062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return null; 12082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 12102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 12112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets a leapMonthPattern, for example: "{0}bis" 12122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param leapMonthPattern The new leapMonthPattern. 12132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param context The usage context: FORMAT, STANDALONE, NUMERIC. 12142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param width The name width: WIDE, ABBREVIATED, NARROW. 12152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated This API is ICU internal only. 121693cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller * @hide original deprecated declaration 1217836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 12182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 12192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 12202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setLeapMonthPattern(String leapMonthPattern, int context, int width) { 12212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (leapMonthPatterns != null) { 12222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller int leapMonthPatternIndex = -1; 12232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch (context) { 12242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case FORMAT : 12252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 12262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 12272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_WIDE; 12282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 12302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV; 12312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 12332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_NARROW; 12342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller default : // HANDLE SHORT, etc. 12362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case STANDALONE : 12402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller switch(width) { 12412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case WIDE : 12422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_WIDE; 12432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case ABBREVIATED : 12452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV; 12462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NARROW : 12482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_STANDALONE_NARROW; 12492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller default : // HANDLE SHORT, etc. 12512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller case NUMERIC : 12552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatternIndex = DT_LEAP_MONTH_PATTERN_NUMERIC; 12562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller default : 12582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 12592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (leapMonthPatternIndex >= 0) { 12612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller leapMonthPatterns[leapMonthPatternIndex] = leapMonthPattern; 12622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 12662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 12672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns am/pm strings. For example: "AM" and "PM". 12682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the weekday strings. 12692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 12702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[] getAmPmStrings() { 12712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(ampms); 12722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 12742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 12752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets am/pm strings. For example: "AM" and "PM". 12762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newAmpms the new ampm strings. 12772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 12782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setAmPmStrings(String[] newAmpms) { 12792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ampms = duplicate(newAmpms); 12802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 12822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 12832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns the time separator string. For example: ":". 12842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the time separator string. 12851c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * @deprecated This API is ICU internal only. 1286836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 12872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 12881c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert @Deprecated 12892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String getTimeSeparatorString() { 12902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return timeSeparator; 12912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 12922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 12932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 12942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets the time separator string. For example: ":". 12952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newTimeSeparator the new time separator string. 12961c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * @deprecated This API is ICU internal only. 1297836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 12982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 12991c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert @Deprecated 13002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setTimeSeparatorString(String newTimeSeparator) { 13012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller timeSeparator = newTimeSeparator; 13022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 13032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 13042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 13052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns time zone strings. 13062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 13072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The array returned by this API is a two dimensional String array and 13082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * each row contains at least following strings: 13092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <ul> 13102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>ZoneStrings[n][0] - System time zone ID 13112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>ZoneStrings[n][1] - Long standard time display name 13122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>ZoneStrings[n][2] - Short standard time display name 13132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>ZoneStrings[n][3] - Long daylight saving time display name 13142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li>ZoneStrings[n][4] - Short daylight saving time display name 13152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </ul> 13162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * When a localized display name is not available, the corresponding 13172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * array element will be <code>null</code>. 13182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 13197241d93e30f4c7c527c019cd6ca3a791ca22d9b2Fredrik Roubert * <b>Note</b>: ICU implements the time zone display name formatting algorithm 13202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * specified by <a href="http://www.unicode.org/reports/tr35/">UTS#35 Unicode 13212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Locale Data Markup Language(LDML)</a>. The algorithm supports historic 13227241d93e30f4c7c527c019cd6ca3a791ca22d9b2Fredrik Roubert * display name changes and various different types of names not available in 13237241d93e30f4c7c527c019cd6ca3a791ca22d9b2Fredrik Roubert * {@link java.text.DateFormatSymbols#getZoneStrings()}. For accessing the full 13247241d93e30f4c7c527c019cd6ca3a791ca22d9b2Fredrik Roubert * set of time zone string data used by ICU implementation, you should use 13257241d93e30f4c7c527c019cd6ca3a791ca22d9b2Fredrik Roubert * {@link TimeZoneNames} APIs instead. 13261c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * 13272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the time zone strings. 13282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 13292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String[][] getZoneStrings() { 13302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (zoneStrings != null) { 13312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return duplicate(zoneStrings); 13322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 13332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 13342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String[] tzIDs = TimeZone.getAvailableIDs(); 13352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller TimeZoneNames tznames = TimeZoneNames.getInstance(validLocale); 13362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller tznames.loadAllDisplayNames(); 13372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller NameType types[] = { 13382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller NameType.LONG_STANDARD, NameType.SHORT_STANDARD, 13392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller NameType.LONG_DAYLIGHT, NameType.SHORT_DAYLIGHT 13402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller }; 13412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller long now = System.currentTimeMillis(); 13422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String[][] array = new String[tzIDs.length][5]; 13432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller for (int i = 0; i < tzIDs.length; i++) { 13442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String canonicalID = TimeZone.getCanonicalID(tzIDs[i]); 13452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (canonicalID == null) { 13462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller canonicalID = tzIDs[i]; 13472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 13482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 13492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller array[i][0] = tzIDs[i]; 13502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller tznames.getDisplayNames(canonicalID, types, now, array[i], 1); 13512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 13522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 13532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller zoneStrings = array; 13542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return zoneStrings; 13552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 13562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 13572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 13582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets time zone strings. 13592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 13602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <b>Note</b>: {@link SimpleDateFormat} no longer uses the 13612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * zone strings stored in a <code>DateFormatSymbols</code>. 13622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Therefore, the time zone strings set by this method have 13632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * no effects in an instance of <code>SimpleDateFormat</code> 13642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for formatting time zones. If you want to customize time 13652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * zone display names formatted by <code>SimpleDateFormat</code>, 13662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * you should customize {@link TimeZoneFormat} and set the 13672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * instance by {@link SimpleDateFormat#setTimeZoneFormat(TimeZoneFormat)} 13682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * instead. 13691c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert * 13702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newZoneStrings the new time zone strings. 13712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 13722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setZoneStrings(String[][] newZoneStrings) { 13732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller zoneStrings = duplicate(newZoneStrings); 13742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 13752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 13762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 13772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns localized date-time pattern characters. For example: 'u', 't', etc. 13782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 13792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>Note: ICU no longer provides localized date-time pattern characters for a locale 13802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * starting ICU 3.8. This method returns the non-localized date-time pattern 13812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * characters unless user defined localized data is set by setLocalPatternChars. 13822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the localized date-time pattern characters. 13832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 13842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public String getLocalPatternChars() { 13852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return localPatternChars; 13862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 13872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 13882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 13892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets localized date-time pattern characters. For example: 'u', 't', etc. 13902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param newLocalPatternChars the new localized date-time 13912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * pattern characters. 13922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 13932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public void setLocalPatternChars(String newLocalPatternChars) { 13942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller localPatternChars = newLocalPatternChars; 13952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 13962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 13972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 13982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Overrides clone. 13992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1400f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert @Override 14012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public Object clone() 14022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 14032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller try { 14042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller DateFormatSymbols other = (DateFormatSymbols)super.clone(); 14052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return other; 14062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } catch (CloneNotSupportedException e) { 14072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ///CLOVER:OFF 14082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throw new ICUCloneNotSupportedException(e); 14092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ///CLOVER:ON 14102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 14112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 14122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 14132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 14142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Override hashCode. 14152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Generates a hash code for the DateFormatSymbols object. 14162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1417f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert @Override 14182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public int hashCode() { 14192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // Is this sufficient? 14202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return requestedLocale.toString().hashCode(); 14212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 14222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 14232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 14242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Overrides equals. 14252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 1426f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert @Override 14272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public boolean equals(Object obj) 14282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 14292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (this == obj) return true; 14302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (obj == null || getClass() != obj.getClass()) return false; 14312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller DateFormatSymbols that = (DateFormatSymbols) obj; 14322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return (Utility.arrayEquals(eras, that.eras) 14332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(eraNames, that.eraNames) 14342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(months, that.months) 14352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(shortMonths, that.shortMonths) 14362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(narrowMonths, that.narrowMonths) 14372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(standaloneMonths, that.standaloneMonths) 14382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(standaloneShortMonths, that.standaloneShortMonths) 14392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(standaloneNarrowMonths, that.standaloneNarrowMonths) 14402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(weekdays, that.weekdays) 14412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(shortWeekdays, that.shortWeekdays) 14422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(shorterWeekdays, that.shorterWeekdays) 14432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(narrowWeekdays, that.narrowWeekdays) 14442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(standaloneWeekdays, that.standaloneWeekdays) 14452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(standaloneShortWeekdays, that.standaloneShortWeekdays) 14462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(standaloneShorterWeekdays, that.standaloneShorterWeekdays) 14472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(standaloneNarrowWeekdays, that.standaloneNarrowWeekdays) 14482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(ampms, that.ampms) 14492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(ampmsNarrow, that.ampmsNarrow) 14501c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert && Utility.arrayEquals(abbreviatedDayPeriods, that.abbreviatedDayPeriods) 14511c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert && Utility.arrayEquals(wideDayPeriods, that.wideDayPeriods) 14521c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert && Utility.arrayEquals(narrowDayPeriods, that.narrowDayPeriods) 14531c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert && Utility.arrayEquals(standaloneAbbreviatedDayPeriods, that.standaloneAbbreviatedDayPeriods) 14541c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert && Utility.arrayEquals(standaloneWideDayPeriods, that.standaloneWideDayPeriods) 14551c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert && Utility.arrayEquals(standaloneNarrowDayPeriods, that.standaloneNarrowDayPeriods) 14562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(timeSeparator, that.timeSeparator) 14572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && arrayOfArrayEquals(zoneStrings, that.zoneStrings) 14582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // getDiplayName maps deprecated country and language codes to the current ones 14592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // too bad there is no way to get the current codes! 14602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // I thought canolicalize() would map the codes but .. alas! it doesn't. 14612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && requestedLocale.getDisplayName().equals(that.requestedLocale.getDisplayName()) 14622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller && Utility.arrayEquals(localPatternChars, 14632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller that.localPatternChars)); 14642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 14652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 14662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // =======================privates=============================== 14672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 14682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 14692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Useful constant for defining timezone offsets. 14702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 14712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static final int millisPerHour = 60*60*1000; 14722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 14732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // DateFormatSymbols cache 1474f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private static CacheBase<String, DateFormatSymbols, ULocale> DFSCACHE = 1475f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert new SoftCache<String, DateFormatSymbols, ULocale>() { 1476f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert @Override 1477f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert protected DateFormatSymbols createInstance(String key, ULocale locale) { 1478f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Extract the type string from the key. 1479f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Otherwise we would have to create a pair object that 1480f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // carries both the locale and the type. 1481f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert int typeStart = key.indexOf('+') + 1; 1482f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert int typeLimit = key.indexOf('+', typeStart); 1483f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (typeLimit < 0) { 1484f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // no numbers keyword value 1485f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert typeLimit = key.length(); 1486f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1487f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String type = key.substring(typeStart, typeLimit); 1488f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert return new DateFormatSymbols(locale, null, type); 1489f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1490f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert }; 14912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 14922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 14932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Initializes format symbols for the locale and calendar type 14942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param desiredLocale The locale whose symbols are desired. 14952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param type The calendar type whose date format symbols are desired. 14962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 14972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller //TODO: This protected seems to be marked as @stable accidentally. 14981fba789ac68efdd9120a7373f49daef42833e674Neil Fuller // We may need to deescalate this API to @internal. 14992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller protected void initializeData(ULocale desiredLocale, String type) 15002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 1501f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String key = desiredLocale.getBaseName() + '+' + type; 15022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String ns = desiredLocale.getKeywordValue("numbers"); 15032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (ns != null && ns.length() > 0) { 1504f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert key += '+' + ns; 15052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 1506f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert DateFormatSymbols dfs = DFSCACHE.getInstance(key, desiredLocale); 1507f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert initializeData(dfs); 15082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 15092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 15102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 15112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Initializes format symbols using another instance. 15122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 15132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * TODO Clean up initialization methods for subclasses 15142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 15152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller void initializeData(DateFormatSymbols dfs) { 15162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.eras = dfs.eras; 15172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.eraNames = dfs.eraNames; 15182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.narrowEras = dfs.narrowEras; 15192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.months = dfs.months; 15202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.shortMonths = dfs.shortMonths; 15212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.narrowMonths = dfs.narrowMonths; 15222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.standaloneMonths = dfs.standaloneMonths; 15232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.standaloneShortMonths = dfs.standaloneShortMonths; 15242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.standaloneNarrowMonths = dfs.standaloneNarrowMonths; 15252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.weekdays = dfs.weekdays; 15262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.shortWeekdays = dfs.shortWeekdays; 15272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.shorterWeekdays = dfs.shorterWeekdays; 15282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.narrowWeekdays = dfs.narrowWeekdays; 15292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.standaloneWeekdays = dfs.standaloneWeekdays; 15302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.standaloneShortWeekdays = dfs.standaloneShortWeekdays; 15312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.standaloneShorterWeekdays = dfs.standaloneShorterWeekdays; 15322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.standaloneNarrowWeekdays = dfs.standaloneNarrowWeekdays; 15332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.ampms = dfs.ampms; 15342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.ampmsNarrow = dfs.ampmsNarrow; 15352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.timeSeparator = dfs.timeSeparator; 15362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.shortQuarters = dfs.shortQuarters; 15372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.quarters = dfs.quarters; 15382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.standaloneShortQuarters = dfs.standaloneShortQuarters; 15392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.standaloneQuarters = dfs.standaloneQuarters; 15402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.leapMonthPatterns = dfs.leapMonthPatterns; 15412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.shortYearNames = dfs.shortYearNames; 15422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.shortZodiacNames = dfs.shortZodiacNames; 15431c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert this.abbreviatedDayPeriods = dfs.abbreviatedDayPeriods; 15441c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert this.wideDayPeriods = dfs.wideDayPeriods; 15451c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert this.narrowDayPeriods = dfs.narrowDayPeriods; 15461c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert this.standaloneAbbreviatedDayPeriods = dfs.standaloneAbbreviatedDayPeriods; 15471c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert this.standaloneWideDayPeriods = dfs.standaloneWideDayPeriods; 15481c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert this.standaloneNarrowDayPeriods = dfs.standaloneNarrowDayPeriods; 15492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 15502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.zoneStrings = dfs.zoneStrings; // always null at initialization time for now 15512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.localPatternChars = dfs.localPatternChars; 15521c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 15532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.capitalization = dfs.capitalization; 15542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 15552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.actualLocale = dfs.actualLocale; 15562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.validLocale = dfs.validLocale; 15572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.requestedLocale = dfs.requestedLocale; 15582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 15592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1560f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1561f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** 1562f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Sink to enumerate the calendar data 1563f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert */ 1564f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private static final class CalendarDataSink extends UResource.Sink { 1565f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1566f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Data structures to store resources from the resource bundle 1567f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert Map<String, String[]> arrays = new TreeMap<String, String[]>(); 1568f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert Map<String, Map<String, String>> maps = new TreeMap<String, Map<String, String>>(); 1569f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert List<String> aliasPathPairs = new ArrayList<String>(); 1570f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1571f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Current and next calendar resource table which should be loaded 1572f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String currentCalendarType = null; 1573f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String nextCalendarType = null; 1574f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1575f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Resources to visit when enumerating fallback calendars 1576f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private Set<String> resourcesToVisit; 1577f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1578f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Alias' relative path populated when an alias is read 1579f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private String aliasRelativePath; 1580f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1581f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** 1582f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Initializes CalendarDataSink with default values 1583f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert */ 1584f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert CalendarDataSink() { } 1585f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1586f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** 1587f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Configure the CalendarSink to visit all the resources 1588f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert */ 1589f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert void visitAllResources() { 1590f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert resourcesToVisit = null; 1591f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1592f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1593f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** 1594f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Actions to be done before enumerating 1595f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert */ 1596f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert void preEnumerate(String calendarType) { 1597f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert currentCalendarType = calendarType; 1598f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert nextCalendarType = null; 1599f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert aliasPathPairs.clear(); 1600f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1601f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1602f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert @Override 1603f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert public void put(UResource.Key key, UResource.Value value, boolean noFallback) { 1604f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert assert currentCalendarType != null && !currentCalendarType.isEmpty(); 1605f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1606f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Stores the resources to visit on the next calendar. 1607f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert Set<String> resourcesToVisitNext = null; 1608f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert UResource.Table calendarData = value.getTable(); 1609f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1610f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Enumerate all resources for this calendar 1611f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert for (int i = 0; calendarData.getKeyAndValue(i, key, value); i++) { 1612f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String keyString = key.toString(); 1613f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1614f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // == Handle aliases == 1615f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert AliasType aliasType = processAliasFromValue(keyString, value); 1616f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (aliasType == AliasType.GREGORIAN) { 1617f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Ignore aliases to the gregorian calendar, all of its resources will be loaded anyways. 1618f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert continue; 1619f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1620f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } else if (aliasType == AliasType.DIFFERENT_CALENDAR) { 1621f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Whenever an alias to the next calendar (except gregorian) is encountered, register the 1622f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // calendar type it's pointing to 1623f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (resourcesToVisitNext == null) { 1624f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert resourcesToVisitNext = new HashSet<String>(); 1625f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1626f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert resourcesToVisitNext.add(aliasRelativePath); 1627f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert continue; 1628f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1629f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } else if (aliasType == AliasType.SAME_CALENDAR) { 1630f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Register same-calendar alias 1631f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (!arrays.containsKey(keyString) && !maps.containsKey(keyString)) { 1632f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert aliasPathPairs.add(aliasRelativePath); 1633f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert aliasPathPairs.add(keyString); 1634f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1635f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert continue; 1636f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1637f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1638f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Only visit the resources that were referenced by an alias on the previous calendar 1639f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // (AmPmMarkersAbbr is an exception). 1640f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (resourcesToVisit != null && !resourcesToVisit.isEmpty() && !resourcesToVisit.contains(keyString) 1641f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert && !keyString.equals("AmPmMarkersAbbr")) { continue; } 1642f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1643f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // == Handle data == 1644f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (keyString.startsWith("AmPmMarkers")) { 1645f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (!keyString.endsWith("%variant") && !arrays.containsKey(keyString)) { 1646f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String[] dataArray = value.getStringArray(); 1647f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert arrays.put(keyString, dataArray); 1648f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1649f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } else if (keyString.equals("eras") 1650f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert || keyString.equals("dayNames") 1651f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert || keyString.equals("monthNames") 1652f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert || keyString.equals("quarters") 1653f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert || keyString.equals("dayPeriod") 1654f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert || keyString.equals("monthPatterns") 1655f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert || keyString.equals("cyclicNameSets")) { 1656f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert processResource(keyString, key, value); 1657f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1658f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1659f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1660f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Apply same-calendar aliases 1661f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert boolean modified; 1662f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert do { 1663f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert modified = false; 1664f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert for (int i = 0; i < aliasPathPairs.size();) { 1665f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert boolean mod = false; 1666f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String alias = aliasPathPairs.get(i); 1667f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (arrays.containsKey(alias)) { 1668f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert arrays.put(aliasPathPairs.get(i + 1), arrays.get(alias)); 1669f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert mod = true; 1670f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } else if (maps.containsKey(alias)) { 1671f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert maps.put(aliasPathPairs.get(i + 1), maps.get(alias)); 1672f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert mod = true; 1673f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1674f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (mod) { 1675f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert aliasPathPairs.remove(i + 1); 1676f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert aliasPathPairs.remove(i); 1677f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert modified = true; 1678f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } else { 1679f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert i += 2; 1680f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1681f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1682f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } while (modified && !aliasPathPairs.isEmpty()); 1683f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1684f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Set the resources to visit on the next calendar 1685f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (resourcesToVisitNext != null) { 1686f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert resourcesToVisit = resourcesToVisitNext; 1687f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1688f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1689f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1690f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** 1691f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Process the nested resource bundle tables 1692f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * @param path Table's relative path to the calendar 1693f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * @param key Resource bundle key 1694f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * @param value Resource bundle value (has to have the table to read) 1695f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert */ 1696f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert protected void processResource(String path, UResource.Key key, UResource.Value value) { 1697f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1698f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert UResource.Table table = value.getTable(); 1699f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert Map<String, String> stringMap = null; 1700f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1701f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Iterate over all the elements of the table and add them to the map 1702f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert for(int i = 0; table.getKeyAndValue(i, key, value); i++) { 1703f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Ignore '%variant' keys 1704f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (key.endsWith("%variant")) { continue; } 1705f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1706f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String keyString = key.toString(); 1707f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1708f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // == Handle String elements == 1709f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (value.getType() == ICUResourceBundle.STRING) { 1710f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // We are on a leaf, store the map elements into the stringMap 1711f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (i == 0) { 1712f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert stringMap = new HashMap<String, String>(); 1713f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert maps.put(path, stringMap); 1714f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1715f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert assert stringMap != null; 1716f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert stringMap.put(keyString, value.getString()); 1717f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert continue; 1718f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1719f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert assert stringMap == null; 1720f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1721f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String currentPath = path + "/" + keyString; 1722f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // In cyclicNameSets ignore everything but years/format/abbreviated 1723f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // and zodiacs/format/abbreviated 1724f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (currentPath.startsWith("cyclicNameSets")) { 1725f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (!"cyclicNameSets/years/format/abbreviated".startsWith(currentPath) 1726f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert && !"cyclicNameSets/zodiacs/format/abbreviated".startsWith(currentPath) 1727f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert && !"cyclicNameSets/dayParts/format/abbreviated".startsWith(currentPath)) 1728f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert { continue; } 1729f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1730f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1731f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // == Handle aliases == 1732f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (arrays.containsKey(currentPath) 1733f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert || maps.containsKey(currentPath)) { continue; } 1734f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1735f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert AliasType aliasType = processAliasFromValue(currentPath, value); 1736f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (aliasType == AliasType.SAME_CALENDAR) { 1737f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert aliasPathPairs.add(aliasRelativePath); 1738f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert aliasPathPairs.add(currentPath); 1739f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert continue; 1740f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1741f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert assert aliasType == AliasType.NONE; 1742f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1743f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // == Handle data == 1744f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (value.getType() == ICUResourceBundle.ARRAY) { 1745f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // We are on a leaf, store the array 1746f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String[] dataArray = value.getStringArray(); 1747f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert arrays.put(currentPath, dataArray); 1748f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } else if (value.getType() == ICUResourceBundle.TABLE) { 1749f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // We are not on a leaf, recursively process the subtable. 1750f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert processResource(currentPath, key, value); 1751f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1752f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1753f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1754f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1755f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Alias' path prefix 1756f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private static final String CALENDAR_ALIAS_PREFIX = "/LOCALE/calendar/"; 1757f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1758f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** 1759f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Populates an AliasIdentifier with the alias information contained on the UResource.Value. 1760f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * @param currentRelativePath Relative path of this alias' resource 1761f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * @param value Value which contains the alias 1762f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * @return The AliasType of the alias found on Value 1763f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert */ 1764f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private AliasType processAliasFromValue(String currentRelativePath, UResource.Value value) { 1765f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (value.getType() == ICUResourceBundle.ALIAS) { 1766f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String aliasPath = value.getAliasString(); 1767f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (aliasPath.startsWith(CALENDAR_ALIAS_PREFIX) && 1768f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert aliasPath.length() > CALENDAR_ALIAS_PREFIX.length()) { 1769f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert int typeLimit = aliasPath.indexOf('/', CALENDAR_ALIAS_PREFIX.length()); 1770f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (typeLimit > CALENDAR_ALIAS_PREFIX.length()) { 1771f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String aliasCalendarType = aliasPath.substring(CALENDAR_ALIAS_PREFIX.length(), typeLimit); 1772f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert aliasRelativePath = aliasPath.substring(typeLimit + 1); 1773f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1774f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (currentCalendarType.equals(aliasCalendarType) 1775f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert && !currentRelativePath.equals(aliasRelativePath)) { 1776f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // If we have an alias to the same calendar, the path to the resource must be different 1777f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert return AliasType.SAME_CALENDAR; 1778f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1779f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } else if (!currentCalendarType.equals(aliasCalendarType) 1780f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert && currentRelativePath.equals(aliasRelativePath)) { 1781f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // If we have an alias to a different calendar, the path to the resource must be the same 1782f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (aliasCalendarType.equals("gregorian")) { 1783f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert return AliasType.GREGORIAN; 1784f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } else if (nextCalendarType == null || nextCalendarType.equals(aliasCalendarType)) { 1785f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert nextCalendarType = aliasCalendarType; 1786f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert return AliasType.DIFFERENT_CALENDAR; 1787f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1788f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1789f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1790f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1791f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert throw new ICUException("Malformed 'calendar' alias. Path: " + aliasPath); 1792f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1793f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert return AliasType.NONE; 1794f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1795f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1796f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** 1797f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Enum which specifies the type of alias received, or no alias 1798f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert */ 1799f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private enum AliasType { 1800f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert SAME_CALENDAR, 1801f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert DIFFERENT_CALENDAR, 1802f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert GREGORIAN, 1803f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert NONE 1804f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1805f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1806f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1807f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** Private, for cache.getInstance(). */ 1808f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private DateFormatSymbols(ULocale desiredLocale, ICUResourceBundle b, String calendarType) { 1809f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert initializeData(desiredLocale, b, calendarType); 1810f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1811f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 18122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 18132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Initializes format symbols for the locale and calendar type 18142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param desiredLocale The locale whose symbols are desired. 1815f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * @param b Resource bundle provided externally 1816f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * @param calendarType The calendar type being used 18172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated This API is ICU internal only. 1818836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 18192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 18202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 18212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // This API was accidentally marked as @stable ICU 3.0 formerly. 1822f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert protected void initializeData(ULocale desiredLocale, ICUResourceBundle b, String calendarType) 18232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 1824f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Create a CalendarSink to load this data and a resource bundle 1825f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert CalendarDataSink calendarSink = new CalendarDataSink(); 1826f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (b == null) { 1827f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert b = (ICUResourceBundle) UResourceBundle 1828f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert .getBundleInstance(ICUData.ICU_BASE_NAME, desiredLocale); 1829f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1830f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1831f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Iterate over the resource bundle data following the fallbacks through different calendar types 1832f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert while (calendarType != null) { 1833f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1834f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Enumerate this calendar type. If the calendar is not found fallback to gregorian. 1835f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert ICUResourceBundle dataForType = b.findWithFallback("calendar/" + calendarType); 1836f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (dataForType == null) { 1837f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (!"gregorian".equals(calendarType)) { 1838f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert calendarType = "gregorian"; 1839f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert calendarSink.visitAllResources(); 1840f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert continue; 1841f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1842f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert throw new MissingResourceException("The 'gregorian' calendar type wasn't found for the locale: " 1843f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert + desiredLocale.getBaseName(), getClass().getName(), "gregorian"); 1844f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1845f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert calendarSink.preEnumerate(calendarType); 1846f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert dataForType.getAllItemsWithFallback("", calendarSink); 1847f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1848f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Stop loading when gregorian was loaded 1849f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (calendarType.equals("gregorian")) { 1850f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert break; 1851f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1852f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1853f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Get the next calendar type to process from the sink 1854f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert calendarType = calendarSink.nextCalendarType; 1855f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1856f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert // Gregorian is always the last fallback 1857f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (calendarType == null) { 1858f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert calendarType = "gregorian"; 1859f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert calendarSink.visitAllResources(); 1860f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1861f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 18622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1863f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert Map<String, String[]> arrays = calendarSink.arrays; 1864f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert Map<String, Map<String, String>> maps = calendarSink.maps; 18652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1866f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert eras = arrays.get("eras/abbreviated"); 1867f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert eraNames = arrays.get("eras/wide"); 1868f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert narrowEras = arrays.get("eras/narrow"); 18692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1870f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert months = arrays.get("monthNames/format/wide"); 1871f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert shortMonths = arrays.get("monthNames/format/abbreviated"); 1872f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert narrowMonths = arrays.get("monthNames/format/narrow"); 18731c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 1874f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert standaloneMonths = arrays.get("monthNames/stand-alone/wide"); 1875f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert standaloneShortMonths = arrays.get("monthNames/stand-alone/abbreviated"); 1876f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert standaloneNarrowMonths = arrays.get("monthNames/stand-alone/narrow"); 18772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1878f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String[] lWeekdays = arrays.get("dayNames/format/wide"); 18792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller weekdays = new String[8]; 18802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller weekdays[0] = ""; // 1-based 18812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller System.arraycopy(lWeekdays, 0, weekdays, 1, lWeekdays.length); 18822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1883f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String[] aWeekdays = arrays.get("dayNames/format/abbreviated"); 18842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shortWeekdays = new String[8]; 18852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shortWeekdays[0] = ""; // 1-based 18862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller System.arraycopy(aWeekdays, 0, shortWeekdays, 1, aWeekdays.length); 18872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1888f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String[] sWeekdays = arrays.get("dayNames/format/short"); 18892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shorterWeekdays = new String[8]; 18902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller shorterWeekdays[0] = ""; // 1-based 18912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller System.arraycopy(sWeekdays, 0, shorterWeekdays, 1, sWeekdays.length); 18922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1893f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String [] nWeekdays = arrays.get("dayNames/format/narrow"); 1894f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (nWeekdays == null) { 1895f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert nWeekdays = arrays.get("dayNames/stand-alone/narrow"); 1896f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1897f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (nWeekdays == null) { 1898f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert nWeekdays = arrays.get("dayNames/format/abbreviated"); 1899f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1900f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (nWeekdays == null) { 1901f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert throw new MissingResourceException("Resource not found", 1902f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert getClass().getName(), "dayNames/format/abbreviated"); 1903f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 19042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 19052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 19062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller narrowWeekdays = new String[8]; 19072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller narrowWeekdays[0] = ""; // 1-based 19082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller System.arraycopy(nWeekdays, 0, narrowWeekdays, 1, nWeekdays.length); 19092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 19102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String [] swWeekdays = null; 1911f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert swWeekdays = arrays.get("dayNames/stand-alone/wide"); 19122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneWeekdays = new String[8]; 19132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneWeekdays[0] = ""; // 1-based 19142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller System.arraycopy(swWeekdays, 0, standaloneWeekdays, 1, swWeekdays.length); 19152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 19162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String [] saWeekdays = null; 1917f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert saWeekdays = arrays.get("dayNames/stand-alone/abbreviated"); 19182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneShortWeekdays = new String[8]; 19192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneShortWeekdays[0] = ""; // 1-based 19202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller System.arraycopy(saWeekdays, 0, standaloneShortWeekdays, 1, saWeekdays.length); 19212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 19222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String [] ssWeekdays = null; 1923f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert ssWeekdays = arrays.get("dayNames/stand-alone/short"); 19242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneShorterWeekdays = new String[8]; 19252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneShorterWeekdays[0] = ""; // 1-based 19262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller System.arraycopy(ssWeekdays, 0, standaloneShorterWeekdays, 1, ssWeekdays.length); 19272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 19282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String [] snWeekdays = null; 1929f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert snWeekdays = arrays.get("dayNames/stand-alone/narrow"); 19302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneNarrowWeekdays = new String[8]; 19312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller standaloneNarrowWeekdays[0] = ""; // 1-based 19322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller System.arraycopy(snWeekdays, 0, standaloneNarrowWeekdays, 1, snWeekdays.length); 19332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 1934f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert ampms = arrays.get("AmPmMarkers"); 1935f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert ampmsNarrow = arrays.get("AmPmMarkersNarrow"); 1936f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1937f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert quarters = arrays.get("quarters/format/wide"); 1938f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert shortQuarters = arrays.get("quarters/format/abbreviated"); 1939f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1940f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert standaloneQuarters = arrays.get("quarters/stand-alone/wide"); 1941f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert standaloneShortQuarters = arrays.get("quarters/stand-alone/abbreviated"); 1942f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1943f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert abbreviatedDayPeriods = loadDayPeriodStrings(maps.get("dayPeriod/format/abbreviated")); 1944f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert wideDayPeriods = loadDayPeriodStrings(maps.get("dayPeriod/format/wide")); 1945f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert narrowDayPeriods = loadDayPeriodStrings(maps.get("dayPeriod/format/narrow")); 1946f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert standaloneAbbreviatedDayPeriods = loadDayPeriodStrings(maps.get("dayPeriod/stand-alone/abbreviated")); 1947f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert standaloneWideDayPeriods = loadDayPeriodStrings(maps.get("dayPeriod/stand-alone/wide")); 1948f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert standaloneNarrowDayPeriods = loadDayPeriodStrings(maps.get("dayPeriod/stand-alone/narrow")); 1949f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 1950f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert for (int i = 0; i < DT_MONTH_PATTERN_COUNT; i++) { 1951f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String monthPatternPath = LEAP_MONTH_PATTERNS_PATHS[i]; 1952f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (monthPatternPath != null) { 1953f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert Map<String, String> monthPatternMap = maps.get(monthPatternPath); 1954f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (monthPatternMap != null) { 1955f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String leapMonthPattern = monthPatternMap.get("leap"); 1956f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (leapMonthPattern != null) { 1957f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (leapMonthPatterns == null) { 1958f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert leapMonthPatterns = new String[DT_MONTH_PATTERN_COUNT]; 1959f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1960f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert leapMonthPatterns[i] = leapMonthPattern; 1961f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1962f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 1963f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 19642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 19651c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 1966f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert shortYearNames = arrays.get("cyclicNameSets/years/format/abbreviated"); 1967f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert shortZodiacNames = arrays.get("cyclicNameSets/zodiacs/format/abbreviated"); 19681c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 19692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller requestedLocale = desiredLocale; 19702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 19712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ICUResourceBundle rb = 19722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller (ICUResourceBundle)UResourceBundle.getBundleInstance( 1973f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert ICUData.ICU_BASE_NAME, desiredLocale); 19742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 19752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller localPatternChars = patternChars; 19762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 19772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // TODO: obtain correct actual/valid locale later 19782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ULocale uloc = rb.getULocale(); 19792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller setLocale(uloc, uloc); 19801c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 19812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller capitalization = new HashMap<CapitalizationContextUsage,boolean[]>(); 19822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller boolean[] noTransforms = new boolean[2]; 19832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller noTransforms[0] = false; 19842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller noTransforms[1] = false; 19852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller CapitalizationContextUsage allUsages[] = CapitalizationContextUsage.values(); 19862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller for (CapitalizationContextUsage usage: allUsages) { 19872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller capitalization.put(usage, noTransforms); 19882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 19892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller UResourceBundle contextTransformsBundle = null; 19902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller try { 1991f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert contextTransformsBundle = rb.getWithFallback("contextTransforms"); 19922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 19932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller catch (MissingResourceException e) { 19942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller contextTransformsBundle = null; // probably redundant 19952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 19962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (contextTransformsBundle != null) { 19972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller UResourceBundleIterator ctIterator = contextTransformsBundle.getIterator(); 19982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller while ( ctIterator.hasNext() ) { 19992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller UResourceBundle contextTransformUsage = ctIterator.next(); 20002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller int[] intVector = contextTransformUsage.getIntVector(); 20012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (intVector.length >= 2) { 20022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String usageKey = contextTransformUsage.getKey(); 20032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller CapitalizationContextUsage usage = contextUsageTypeMap.get(usageKey); 20042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (usage != null) { 20052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller boolean[] transforms = new boolean[2]; 20062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller transforms[0] = (intVector[0] != 0); 20072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller transforms[1] = (intVector[1] != 0); 20082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller capitalization.put(usage, transforms); 20092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 20142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller NumberingSystem ns = NumberingSystem.getInstance(desiredLocale); 20152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String nsName = ns == null ? "latn" : ns.getName(); // Latin is default. 20162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String tsPath = "NumberElements/" + nsName + "/symbols/timeSeparator"; 20172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller try { 20182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller setTimeSeparatorString(rb.getStringWithFallback(tsPath)); 20192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } catch (MissingResourceException e) { 20202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller setTimeSeparatorString(DEFAULT_TIME_SEPARATOR); 20212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 2024f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** 2025f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Resource bundle paths for each leap month pattern 2026f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert */ 2027f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private static final String[] LEAP_MONTH_PATTERNS_PATHS = new String[DT_MONTH_PATTERN_COUNT]; 2028f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert static { 2029f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert LEAP_MONTH_PATTERNS_PATHS[DT_LEAP_MONTH_PATTERN_FORMAT_WIDE] = "monthPatterns/format/wide"; 2030f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert LEAP_MONTH_PATTERNS_PATHS[DT_LEAP_MONTH_PATTERN_FORMAT_ABBREV] = "monthPatterns/format/abbreviated"; 2031f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert LEAP_MONTH_PATTERNS_PATHS[DT_LEAP_MONTH_PATTERN_FORMAT_NARROW] = "monthPatterns/format/narrow"; 2032f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert LEAP_MONTH_PATTERNS_PATHS[DT_LEAP_MONTH_PATTERN_STANDALONE_WIDE] = "monthPatterns/stand-alone/wide"; 2033f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert LEAP_MONTH_PATTERNS_PATHS[DT_LEAP_MONTH_PATTERN_STANDALONE_ABBREV] = "monthPatterns/stand-alone/abbreviated"; 2034f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert LEAP_MONTH_PATTERNS_PATHS[DT_LEAP_MONTH_PATTERN_STANDALONE_NARROW] = "monthPatterns/stand-alone/narrow"; 2035f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert LEAP_MONTH_PATTERNS_PATHS[DT_LEAP_MONTH_PATTERN_NUMERIC] = "monthPatterns/numeric/all"; 2036f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert } 2037f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert 20382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private static final boolean arrayOfArrayEquals(Object[][] aa1, Object[][]aa2) { 20392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (aa1 == aa2) { // both are null 20402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return true; 20412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (aa1 == null || aa2 == null) { // one is null and the other is not 20432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return false; 20442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (aa1.length != aa2.length) { 20462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return false; 20472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller boolean equal = true; 20492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller for (int i = 0; i < aa1.length; i++) { 20502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller equal = Utility.arrayEquals(aa1[i], aa2[i]); 20512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (!equal) { 20522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 20532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return equal; 20562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 20581c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert /** 2059f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Keys for dayPeriods 20601c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert */ 2061f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private static final String[] DAY_PERIOD_KEYS = {"midnight", "noon", 2062f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert "morning1", "afternoon1", "evening1", "night1", 2063f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert "morning2", "afternoon2", "evening2", "night2"}; 20641c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 2065f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert /** 2066f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * Loads localized names for day periods in the requested format. 2067f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert * @param resourceMap Contains the dayPeriod resource to load 2068f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert */ 2069f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert private String[] loadDayPeriodStrings(Map<String, String> resourceMap) { 2070f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert String strings[] = new String[DAY_PERIOD_KEYS.length]; 2071f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert if (resourceMap != null) { 2072f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert for (int i = 0; i < DAY_PERIOD_KEYS.length; ++i) { 2073f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert strings[i] = resourceMap.get(DAY_PERIOD_KEYS[i]); // Null if string doesn't exist. 20741c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert } 20751c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert } 20761c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert return strings; 20771c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert } 20781c8a530973739aafa823d758240d2cd5dad96fe3Fredrik Roubert 20792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /* 20802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * save the input locale 20812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 20822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private ULocale requestedLocale; 20832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 20842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /* 20852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Clones an array of Strings. 20862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param srcArray the source array to be cloned. 20872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return a cloned array. 20882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 20892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private final String[] duplicate(String[] srcArray) 20902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 20912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return srcArray.clone(); 20922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 20932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 20942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private final String[][] duplicate(String[][] srcArray) 20952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 20962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String[][] aCopy = new String[srcArray.length][]; 20972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller for (int i = 0; i < srcArray.length; ++i) 20982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller aCopy[i] = duplicate(srcArray[i]); 20992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return aCopy; 21002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 21012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 21022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /* 21032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Compares the equality of the two arrays of String. 21042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param current this String array. 21052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param other that String array. 21062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private final boolean equals(String[] current, String[] other) 21072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller { 21082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller int count = current.length; 21092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 21102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller for (int i = 0; i < count; ++i) 21112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (!current[i].equals(other[i])) 21122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return false; 21132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return true; 21142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 21152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 21162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 21172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 21182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 21192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 21202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns the {@link DateFormatSymbols} object that should be used to format a 21212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * calendar system's dates in the given locale. 21222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 21232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <b>Subclassing:</b><br> 21242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * When creating a new Calendar subclass, you must create the 21252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * {@link ResourceBundle ResourceBundle} 21262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * containing its {@link DateFormatSymbols DateFormatSymbols} in a specific place. 21272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The resource bundle name is based on the calendar's fully-specified 21282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * class name, with ".resources" inserted at the end of the package name 21292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * (just before the class name) and "Symbols" appended to the end. 21301fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * For example, the bundle corresponding to "android.icu.util.HebrewCalendar" 21311fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * is "android.icu.impl.data.HebrewCalendarSymbols". 21322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 21332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Within the ResourceBundle, this method searches for five keys: 21342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <ul> 21352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>DayNames</b> - 21362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of strings corresponding to each possible 21372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * value of the <code>DAY_OF_WEEK</code> field. Even though 21382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DAY_OF_WEEK</code> starts with <code>SUNDAY</code> = 1, 21392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * This array is 0-based; the name for Sunday goes in the 21402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * first position, at index 0. If this key is not found 21412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * in the bundle, the day names are inherited from the 21422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * default <code>DateFormatSymbols</code> for the requested locale. 21432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 21442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>DayAbbreviations</b> - 21452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of abbreviated day names corresponding 21462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * to the values in the "DayNames" array. If this key 21472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * is not found in the resource bundle, the "DayNames" 21482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * values are used instead. If neither key is found, 21492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * the day abbreviations are inherited from the default 21502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormatSymbols</code> for the locale. 21512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 21522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>MonthNames</b> - 21532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of strings corresponding to each possible 21542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * value of the <code>MONTH</code> field. If this key is not found 21552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * in the bundle, the month names are inherited from the 21562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * default <code>DateFormatSymbols</code> for the requested locale. 21572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 21582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>MonthAbbreviations</b> - 21592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of abbreviated day names corresponding 21602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * to the values in the "MonthNames" array. If this key 21612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * is not found in the resource bundle, the "MonthNames" 21622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * values are used instead. If neither key is found, 21632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * the day abbreviations are inherited from the default 21642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormatSymbols</code> for the locale. 21652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 21662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>Eras</b> - 21672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of strings corresponding to each possible 21682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * value of the <code>ERA</code> field. If this key is not found 21692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * in the bundle, the era names are inherited from the 21702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * default <code>DateFormatSymbols</code> for the requested locale. 21712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </ul> 21722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 21732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param cal The calendar system whose date format symbols are desired. 21742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param locale The locale whose symbols are desired. 21752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 21762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see DateFormatSymbols#DateFormatSymbols(java.util.Locale) 21772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 21782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public DateFormatSymbols(Calendar cal, Locale locale) { 21792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller initializeData(ULocale.forLocale(locale), cal.getType()); 21802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 21812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 21822ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 21832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns the {@link DateFormatSymbols} object that should be used to format a 21842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * calendar system's dates in the given locale. 21852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 21862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <b>Subclassing:</b><br> 21872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * When creating a new Calendar subclass, you must create the 21882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * {@link ResourceBundle ResourceBundle} 21892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * containing its {@link DateFormatSymbols DateFormatSymbols} in a specific place. 21902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The resource bundle name is based on the calendar's fully-specified 21912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * class name, with ".resources" inserted at the end of the package name 21922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * (just before the class name) and "Symbols" appended to the end. 21931fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * For example, the bundle corresponding to "android.icu.util.HebrewCalendar" 21941fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * is "android.icu.impl.data.HebrewCalendarSymbols". 21952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 21962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Within the ResourceBundle, this method searches for five keys: 21972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <ul> 21982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>DayNames</b> - 21992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of strings corresponding to each possible 22002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * value of the <code>DAY_OF_WEEK</code> field. Even though 22012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DAY_OF_WEEK</code> starts with <code>SUNDAY</code> = 1, 22022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * This array is 0-based; the name for Sunday goes in the 22032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * first position, at index 0. If this key is not found 22042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * in the bundle, the day names are inherited from the 22052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * default <code>DateFormatSymbols</code> for the requested locale. 22062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 22072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>DayAbbreviations</b> - 22082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of abbreviated day names corresponding 22092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * to the values in the "DayNames" array. If this key 22102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * is not found in the resource bundle, the "DayNames" 22112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * values are used instead. If neither key is found, 22122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * the day abbreviations are inherited from the default 22132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormatSymbols</code> for the locale. 22142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 22152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>MonthNames</b> - 22162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of strings corresponding to each possible 22172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * value of the <code>MONTH</code> field. If this key is not found 22182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * in the bundle, the month names are inherited from the 22192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * default <code>DateFormatSymbols</code> for the requested locale. 22202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 22212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>MonthAbbreviations</b> - 22222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of abbreviated day names corresponding 22232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * to the values in the "MonthNames" array. If this key 22242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * is not found in the resource bundle, the "MonthNames" 22252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * values are used instead. If neither key is found, 22262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * the day abbreviations are inherited from the default 22272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <code>DateFormatSymbols</code> for the locale. 22282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 22292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <li><b>Eras</b> - 22302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * An array of strings corresponding to each possible 22312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * value of the <code>ERA</code> field. If this key is not found 22322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * in the bundle, the era names are inherited from the 22332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * default <code>DateFormatSymbols</code> for the requested locale. 22342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * </ul> 22352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 22362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param cal The calendar system whose date format symbols are desired. 22372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param locale The ulocale whose symbols are desired. 22382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 22392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see DateFormatSymbols#DateFormatSymbols(java.util.Locale) 22402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 22412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public DateFormatSymbols(Calendar cal, ULocale locale) { 22422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller initializeData(locale, cal.getType()); 22432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 22442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 22452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 22462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Variant of DateFormatSymbols(Calendar, Locale) that takes the Calendar class 22472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * instead of a Calendar instance. 22482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see #DateFormatSymbols(Calendar, Locale) 22492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 22502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public DateFormatSymbols(Class<? extends Calendar> calendarClass, Locale locale) { 22512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this(calendarClass, ULocale.forLocale(locale)); 22522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 22532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 22542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 22552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Variant of DateFormatSymbols(Calendar, ULocale) that takes the Calendar class 22562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * instead of a Calendar instance. 22572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see #DateFormatSymbols(Calendar, Locale) 22582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 22592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public DateFormatSymbols(Class<? extends Calendar> calendarClass, ULocale locale) { 22602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String fullName = calendarClass.getName(); 22612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller int lastDot = fullName.lastIndexOf('.'); 22622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String className = fullName.substring(lastDot+1); 22632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller String calType = null; 22642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller for (String[] calClassInfo : CALENDAR_CLASSES) { 22652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (calClassInfo[0].equals(className)) { 22662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller calType = calClassInfo[1]; 22672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller break; 22682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 22692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 22702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if (calType == null) { 22712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller calType = className.replaceAll("Calendar", "").toLowerCase(Locale.ENGLISH); 22722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 22732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 22742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller initializeData(locale, calType); 22752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 22762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 227722b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer // Android patch (http://b/30464240) start: Add constructor taking a calendar type. 227822b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer /** 227922b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer * Variant of DateFormatSymbols(Calendar, ULocale) that takes the calendar type 228022b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer * instead of a Calendar instance. 228122b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer * @see #DateFormatSymbols(Calendar, Locale) 228222b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer * @deprecated This API is ICU internal only. 228322b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer * @hide draft / provisional / internal are hidden on Android 228422b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer */ 228522b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer @Deprecated 228622b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer public DateFormatSymbols(ULocale locale, String calType) { 228722b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer initializeData(locale, calType); 228822b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer } 228922b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer // Android patch end. 229022b47ef9ddf9e6a0c70a0fc411918f0ff5ba4f2dJoachim Sauer 22912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 22922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Fetches a custom calendar's DateFormatSymbols out of the given resource 22932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * bundle. Symbols that are not overridden are inherited from the 22942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * default DateFormatSymbols for the locale. 22952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see DateFormatSymbols#DateFormatSymbols(java.util.Locale) 22962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 22972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public DateFormatSymbols(ResourceBundle bundle, Locale locale) { 22982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this(bundle, ULocale.forLocale(locale)); 22992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 23002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 23012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 23022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Fetches a custom calendar's DateFormatSymbols out of the given resource 23032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * bundle. Symbols that are not overridden are inherited from the 23042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * default DateFormatSymbols for the locale. 23052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see DateFormatSymbols#DateFormatSymbols(java.util.Locale) 23062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 23072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public DateFormatSymbols(ResourceBundle bundle, ULocale locale) { 2308f86f25d102340da66b9c7cb6b2d5ecdc0de43ecfFredrik Roubert initializeData(locale, (ICUResourceBundle) bundle, CalendarUtil.getCalendarType(locale)); 23092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 23102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 23112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 23122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Finds the ResourceBundle containing the date format information for 23132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * a specified calendar subclass in a given locale. 23142ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 23152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The resource bundle name is based on the calendar's fully-specified 23162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * class name, with ".resources" inserted at the end of the package name 23172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * (just before the class name) and "Symbols" appended to the end. 23181fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * For example, the bundle corresponding to "android.icu.util.HebrewCalendar" 23191fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * is "android.icu.impl.data.HebrewCalendarSymbols". 23202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 23212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <b>Note:</b>Because of the structural changes in the ICU locale bundle, 23222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this API no longer works as described. This method always returns null. 23232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 4.0 232493cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller * @hide original deprecated declaration 23252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 23262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 23272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // This API was formerly @stable ICU 2.0 23282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static public ResourceBundle getDateFormatBundle(Class<? extends Calendar> calendarClass, 23292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller Locale locale) 23302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throws MissingResourceException { 23312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return null; 23322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 23332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 23342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 23352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Finds the ResourceBundle containing the date format information for 23362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * a specified calendar subclass in a given locale. 23372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 23382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The resource bundle name is based on the calendar's fully-specified 23392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * class name, with ".resources" inserted at the end of the package name 23402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * (just before the class name) and "Symbols" appended to the end. 23411fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * For example, the bundle corresponding to "android.icu.util.HebrewCalendar" 23421fba789ac68efdd9120a7373f49daef42833e674Neil Fuller * is "android.icu.impl.data.HebrewCalendarSymbols". 23432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 23442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <b>Note:</b>Because of the structural changes in the ICU locale bundle, 23452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this API no longer works as described. This method always returns null. 23462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 4.0 234793cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller * @hide original deprecated declaration 23482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 23492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 23502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // This API was formerly @stable ICU 3.2 23512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller static public ResourceBundle getDateFormatBundle(Class<? extends Calendar> calendarClass, 23522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ULocale locale) 23532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throws MissingResourceException { 23542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return null; 23552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 23562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 23572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 23582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Variant of getDateFormatBundle(java.lang.Class, java.util.Locale) that takes 23592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * a Calendar instance instead of a Calendar class. 23602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 23612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <b>Note:</b>Because of the structural changes in the ICU locale bundle, 23622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this API no longer works as described. This method always returns null. 23632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see #getDateFormatBundle(java.lang.Class, java.util.Locale) 23642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 4.0 236593cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller * @hide original deprecated declaration 23662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 23672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 23682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // This API was formerly @stable ICU 2.2 23692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static ResourceBundle getDateFormatBundle(Calendar cal, Locale locale) 23702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throws MissingResourceException { 23712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return null; 23722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 23732ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 23742ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 23752ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Variant of getDateFormatBundle(java.lang.Class, java.util.Locale) that takes 23762ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * a Calendar instance instead of a Calendar class. 23772ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p> 23782ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <b>Note:</b>Because of the structural changes in the ICU locale bundle, 23792ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this API no longer works as described. This method always returns null. 23802ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see #getDateFormatBundle(java.lang.Class, java.util.Locale) 23812ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @deprecated ICU 4.0 238293cf604e9dd0525f15bc0a7450b2a35f3884c298Neil Fuller * @hide original deprecated declaration 23832ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 23842ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller @Deprecated 23852ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // This API was formerly @stable ICU 3.2 23862ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public static ResourceBundle getDateFormatBundle(Calendar cal, ULocale locale) 23872ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throws MissingResourceException { 23882ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return null; 23892ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 23902ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 23912ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // -------- BEGIN ULocale boilerplate -------- 23922ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 23932ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 23942ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Returns the locale that was used to create this object, or null. 23952ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * This may may differ from the locale requested at the time of 23962ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this object's creation. For example, if an object is created 23972ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for locale <tt>en_US_CALIFORNIA</tt>, the actual data may be 23982ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * drawn from <tt>en</tt> (the <i>actual</i> locale), and 23992ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <tt>en_US</tt> may be the most specific locale that exists (the 24002ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <i>valid</i> locale). 24012ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 24022ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * <p>Note: This method will be implemented in ICU 3.0; ICU 2.8 24032ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * contains a partial preview implementation. The * <i>actual</i> 24042ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * locale is returned correctly, but the <i>valid</i> locale is 24052ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * not, in most cases. 24062ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param type type of information requested, either {@link 24072ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * android.icu.util.ULocale#VALID_LOCALE} or {@link 24082ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * android.icu.util.ULocale#ACTUAL_LOCALE}. 24092ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @return the information specified by <i>type</i>, or null if 24102ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this object was not constructed from locale data. 24112ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.ULocale 24122ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.ULocale#VALID_LOCALE 24132ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.ULocale#ACTUAL_LOCALE 2414836e6b40a94ec3fb7545a76cb072960442b7eee9Neil Fuller * @hide draft / provisional / internal are hidden on Android 24152ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 24162ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller public final ULocale getLocale(ULocale.Type type) { 24172ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller return type == ULocale.ACTUAL_LOCALE ? 24182ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.actualLocale : this.validLocale; 24192ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 24202ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 24212ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 24222ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * Sets information about the locales that were used to create this 24232ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * object. If the object was not constructed from locale data, 24242ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * both arguments should be set to null. Otherwise, neither 24252ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * should be null. The actual locale must be at the same level or 24262ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * less specific than the valid locale. This method is intended 24272ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * for use by factories or other entities that create objects of 24282ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * this class. 24292ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param valid the most specific locale containing any resource 24302ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * data, or null 24312ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @param actual the locale containing data used to construct this 24322ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * object, or null 24332ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.ULocale 24342ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.ULocale#VALID_LOCALE 24352ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.ULocale#ACTUAL_LOCALE 24362ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 24372ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller final void setLocale(ULocale valid, ULocale actual) { 24382ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // Change the following to an assertion later 24392ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller if ((valid == null) != (actual == null)) { 24402ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ///CLOVER:OFF 24412ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller throw new IllegalArgumentException(); 24422ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller ///CLOVER:ON 24432ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 24442ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // Another check we could do is that the actual locale is at 24452ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // the same level or less specific than the valid locale. 24462ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.validLocale = valid; 24472ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller this.actualLocale = actual; 24482ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 24492ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 24502ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 24512ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The most specific locale containing any resource data, or null. 24522ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.ULocale 24532ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 24542ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private ULocale validLocale; 24552ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 24562ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 24572ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * The locale containing data used to construct this object, or 24582ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * null. 24592ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * @see android.icu.util.ULocale 24602ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 24612ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private ULocale actualLocale; 24622ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 24632ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller // -------- END ULocale boilerplate -------- 24642ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller 24652ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller /** 24662ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * 3.8 or older version did not have localized GMT format 24672ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller * patterns. 24682ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller */ 24692ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { 24702ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller stream.defaultReadObject(); 24712ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller } 24722ae130017183d2f66d55bf0ca51f8da3294644fdNeil Fuller} 2473