/** * <p>Constructs a localized list pattern suitable for the use in * {@link java.text.MessageFormat#format(String, Object[])}. </p> * * @param width text width (ABBREVIATED as synonym for SHORT) * @param size count of list items * @return message format pattern with placeholders {0}, {1}, ..., {x}, ... * @throws IllegalArgumentException if size is smaller than 2 */ String getListPattern( TextWidth width, int size ) { if (width == null) { throw new NullPointerException("Missing width."); } if ( (size >= MIN_LIST_INDEX) && (size <= MAX_LIST_INDEX) ) { return this.list.get(Integer.valueOf(size)).get(width); } return lookup(this.locale, width, size); }
Map<PluralCategory, String> tmp2 = new EnumMap<>(PluralCategory.class); for (PluralCategory cat : PluralCategory.values()) { tmp2.put(cat, lookup(language, unit, width, cat)); tmp3.put(cat, lookup(language, unit, false, false, cat)); Map<PluralCategory, String> tmp3a = new EnumMap<>(PluralCategory.class); for (PluralCategory cat : PluralCategory.values()) { tmp3a.put(cat, lookup(language, unit, false, true, cat)); tmp4.put(cat, lookup(language, unit, true, false, cat)); Map<PluralCategory, String> tmp4a = new EnumMap<>(PluralCategory.class); for (PluralCategory cat : PluralCategory.values()) { tmp4a.put(cat, lookup(language, unit, true, true, cat)); Map<TextWidth, String> tmp5 = new EnumMap<>(TextWidth.class); for (TextWidth width : TextWidth.values()) { tmp5.put(width, lookup(language, width, index));
private static String lookup( UnitPatternProvider p, Locale language, char unitID, TextWidth width, PluralCategory category ) { switch (unitID) { case 'Y': return p.getYearPattern(language, width, category); case 'M': return p.getMonthPattern(language, width, category); case 'W': return p.getWeekPattern(language, width, category); case 'D': return p.getDayPattern(language, width, category); case 'H': return p.getHourPattern(language, width, category); case 'N': return p.getMinutePattern(language, width, category); case 'S': return p.getSecondPattern(language, width, category); case '3': return p.getMilliPattern(language, width, category); case '6': return p.getMicroPattern(language, width, category); case '9': return p.getNanoPattern(language, width, category); default: