/* * ----------------------------------------------------------------------- * Copyright © 2013-2015 Meno Hochschild, <http://www.menodata.de/> * ----------------------------------------------------------------------- * This file (MinguoEra.java) is part of project Time4J. * * Time4J is free software: You can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 2.1 of the License, or * (at your option) any later version. * * Time4J is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Time4J. If not, see <http://www.gnu.org/licenses/>. * ----------------------------------------------------------------------- */ package net.time4j.calendar; import net.time4j.engine.CalendarEra; import net.time4j.format.CalendarText; import net.time4j.format.TextWidth; import java.util.Locale; /** * <p>The Minguo calendar supports two eras related to the year 1912. </p> * * @author Meno Hochschild * @since 3.13/4.10 */ /*[deutsch] * <p>Der Minguo-Kalender unterstützt zwei Äras, die sich auf das Jahr 1912 beziehen. </p> * * @author Meno Hochschild * @since 3.13/4.10 */ public enum MinguoEra implements CalendarEra { //~ Statische Felder/Initialisierungen -------------------------------- /** * Used for dates before 1912-01-01. */ /*[deutsch] * Verwendet für Datumsangaben vor 1912-01-01. */ BEFORE_ROC, /** * Used for dates from 1912-01-01 or later. */ /*[deutsch] * Verwendet für Datumsangaben ab 1912-01-01. */ ROC; //~ Methoden ---------------------------------------------------------- @Override public int getValue() { return this.ordinal(); } /** * <p>Equivalent to the expression {@code getDisplayName(locale, TextWidth.WIDE)}. </p> * * @param locale language setting * @return descriptive text (long form, never {@code null}) * @see #getDisplayName(Locale, TextWidth) * @since 3.5/4.3 */ /*[deutsch] * <p>Entspricht dem Ausdruck {@code getDisplayName(locale, TextWidth.WIDE)}. </p> * * @param locale language setting * @return descriptive text (long form, never {@code null}) * @see #getDisplayName(Locale, TextWidth) * @since 3.5/4.3 */ public String getDisplayName(Locale locale) { return this.getDisplayName(locale, TextWidth.WIDE); } /** * <p>Gets the description text dependent on the locale and style * parameters. </p> * * <p>The second argument controls the width of description. </p> * * @param locale language setting * @param width text width * @return descriptive text for given locale and style (never {@code null}) * @since 3.5/4.3 */ /*[deutsch] * <p>Liefert den sprachabhängigen Beschreibungstext. </p> * * <p>Über das zweite Argument kann gesteuert werden, ob eine kurze * oder eine lange Form des Beschreibungstexts ausgegeben werden soll. Das * ist besonders sinnvoll in Benutzeroberflächen, wo zwischen der * Beschriftung und der detaillierten Erläuterung einer graphischen * Komponente unterschieden wird. </p> * * @param locale language setting * @param width text width * @return descriptive text for given locale and style (never {@code null}) * @since 3.5/4.3 */ public String getDisplayName( Locale locale, TextWidth width ) { CalendarText names = CalendarText.getInstance("roc", locale); return names.getEras(width).print(this); } }