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: throw new UnsupportedOperationException("Unit-ID: " + unitID); } }
private static String lookup( UnitPatternProvider p, Locale language, char unitID, boolean future, boolean abbreviated, PluralCategory category) { if (abbreviated && (p instanceof RelativeTimeProvider)) { RelativeTimeProvider rp = RelativeTimeProvider.class.cast(p); switch (unitID) { case 'Y': return rp.getShortYearPattern(language, future, category); case 'M': return rp.getShortMonthPattern(language, future, category); case 'W': return rp.getShortWeekPattern(language, future, category); case 'D': return rp.getShortDayPattern(language, future, category); case 'H': return rp.getShortHourPattern(language, future, category); case 'N': return rp.getShortMinutePattern(language, future, category); case 'S': return rp.getShortSecondPattern(language, future, category); default: throw new UnsupportedOperationException("Unit-ID: " + unitID); } } switch (unitID) { case 'Y': return p.getYearPattern(language, future, category); case 'M': return p.getMonthPattern(language, future, category); case 'W': return p.getWeekPattern(language, future, category); case 'D': return p.getDayPattern(language, future, category); case 'H': return p.getHourPattern(language, future, category); case 'N': return p.getMinutePattern(language, future, category); case 'S': return p.getSecondPattern(language, future, category); default: throw new UnsupportedOperationException("Unit-ID: " + unitID); } }