/*
* -----------------------------------------------------------------------
* Copyright © 2013-2015 Meno Hochschild, <http://www.menodata.de/>
* -----------------------------------------------------------------------
* This file (CopticEra.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 Coptic calendar only supports one single era called "Anno Martyrum" with the
* numerical value {@code 1} which is sometimes also called "Diocletian era" and starts
* on Julian date AD-284-08-29. </p>
*
* @author Meno Hochschild
* @since 3.11/4.8
*/
/*[deutsch]
* <p>Der koptische Kalender unterstützt nur eine einzige Ära, die "Anno Martyrum"
* oder manchmal die diokletianische Ära genannt wird, den numerischen Wert {@code 1} hat und zum
* julianischen Datum AD-284-08-29 beginnt. </p>
*
* @author Meno Hochschild
* @since 3.11/4.8
*/
public enum CopticEra
implements CalendarEra {
//~ Statische Felder/Initialisierungen --------------------------------
/**
* Called after the victims of persecutions against Christians by the Roman emperator Diocletian
* (often abbreviated as "A.M.").
*/
/*[deutsch]
* Benannt nach den Opfern der Christenverfolgungen des römischen Kaisers Diocletian
* (oft als "A.M." abgekürzt).
*/
ANNO_MARTYRUM;
//~ Methoden ----------------------------------------------------------
@Override
public int getValue() {
return 1;
}
/**
* <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.11/4.8
*/
/*[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.11/4.8
*/
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.11/4.8
*/
/*[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.11/4.8
*/
public String getDisplayName(
Locale locale,
TextWidth width
) {
CalendarText names = CalendarText.getInstance("coptic", locale);
return names.getEras(width).print(this);
}
}