2215 map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
2216 toStandaloneStyle(style), locale);
2217 } else if (style != ALL_STYLES) {
2218 map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
2219 getBaseStyle(style), locale);
2220 }
2221 }
2222 return map;
2223 }
2224
2225 // SHORT or LONG
2226 return getDisplayNamesImpl(field, style, locale);
2227 }
2228
2229 private Map<String,Integer> getDisplayNamesImpl(int field, int style, Locale locale) {
2230 DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
2231 String[] strings = getFieldStrings(field, style, symbols);
2232 if (strings != null) {
2233 Map<String,Integer> names = new HashMap<>();
2234 for (int i = 0; i < strings.length; i++) {
2235 if (strings[i].length() == 0) {
2236 continue;
2237 }
2238 names.put(strings[i], i);
2239 }
2240 return names;
2241 }
2242 return null;
2243 }
2244
2245 boolean checkDisplayNameParams(int field, int style, int minStyle, int maxStyle,
2246 Locale locale, int fieldMask) {
2247 int baseStyle = getBaseStyle(style); // Ignore the standalone mask
2248 if (field < 0 || field >= fields.length ||
2249 baseStyle < minStyle || baseStyle > maxStyle || baseStyle == 3) {
2250 throw new IllegalArgumentException();
2251 }
2252 if (locale == null) {
2253 throw new NullPointerException();
2254 }
2255 return isFieldSet(fieldMask, field);
|
2215 map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
2216 toStandaloneStyle(style), locale);
2217 } else if (style != ALL_STYLES) {
2218 map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
2219 getBaseStyle(style), locale);
2220 }
2221 }
2222 return map;
2223 }
2224
2225 // SHORT or LONG
2226 return getDisplayNamesImpl(field, style, locale);
2227 }
2228
2229 private Map<String,Integer> getDisplayNamesImpl(int field, int style, Locale locale) {
2230 DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
2231 String[] strings = getFieldStrings(field, style, symbols);
2232 if (strings != null) {
2233 Map<String,Integer> names = new HashMap<>();
2234 for (int i = 0; i < strings.length; i++) {
2235 if (strings[i].isEmpty()) {
2236 continue;
2237 }
2238 names.put(strings[i], i);
2239 }
2240 return names;
2241 }
2242 return null;
2243 }
2244
2245 boolean checkDisplayNameParams(int field, int style, int minStyle, int maxStyle,
2246 Locale locale, int fieldMask) {
2247 int baseStyle = getBaseStyle(style); // Ignore the standalone mask
2248 if (field < 0 || field >= fields.length ||
2249 baseStyle < minStyle || baseStyle > maxStyle || baseStyle == 3) {
2250 throw new IllegalArgumentException();
2251 }
2252 if (locale == null) {
2253 throw new NullPointerException();
2254 }
2255 return isFieldSet(fieldMask, field);
|