Package org.joda.time.chrono
Class EthiopicChronology
- java.lang.Object
-
- All Implemented Interfaces:
java.io.Serializable
public final class EthiopicChronology extends BasicFixedMonthChronology
Implements the Ethiopic calendar system, which defines every fourth year as leap, much like the Julian calendar. The year is broken down into 12 months, each 30 days in length. An extra period at the end of the year is either 5 or 6 days in length. In this implementation, it is considered a 13th month.Year 1 in the Ethiopic calendar began on August 29, 8 CE (Julian), thus Ethiopic years do not begin at the same time as Julian years. This chronology is not proleptic, as it does not allow dates before the first Ethiopic year.
This implementation defines a day as midnight to midnight exactly as per the ISO chronology. Some references indicate that a coptic day starts at sunset on the previous ISO day, but this has not been confirmed and is not implemented.
EthiopicChronology is thread-safe and immutable.
- Since:
- 1.2
- See Also:
- Wikipedia, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.joda.time.chrono.AssembledChronology
AssembledChronology.Fields
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.ConcurrentHashMap<DateTimeZone,EthiopicChronology[]>cCacheCache of zone to chronology arraysstatic intEEConstant value for 'Ethiopean Era', equivalent to the value returned for AD/CE.private static DateTimeFieldERA_FIELDA singleton era field.private static EthiopicChronologyINSTANCE_UTCSingleton instance of a UTC EthiopicChronologyprivate static intMAX_YEARThe highest year that can be fully supported.private static intMIN_YEARThe lowest year that can be fully supported.private static longserialVersionUIDSerialization lock-
Fields inherited from class org.joda.time.chrono.BasicFixedMonthChronology
MILLIS_PER_MONTH, MILLIS_PER_YEAR, MONTH_LENGTH
-
-
Constructor Summary
Constructors Constructor Description EthiopicChronology(Chronology base, java.lang.Object param, int minDaysInFirstWeek)Restricted constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassemble(AssembledChronology.Fields fields)Invoked by the constructor and after deserialization to allow subclasses to define all of its supported fields.(package private) longcalculateFirstDayOfYearMillis(int year)Gets the millisecond value of the first day of the year.(package private) longgetApproxMillisAtEpochDividedByTwo()Returns a constant representing the approximate number of milliseconds elapsed from year 0 of this chronology, divided by two.static EthiopicChronologygetInstance()Gets an instance of the EthiopicChronology in the default time zone.static EthiopicChronologygetInstance(DateTimeZone zone)Gets an instance of the EthiopicChronology in the given time zone.static EthiopicChronologygetInstance(DateTimeZone zone, int minDaysInFirstWeek)Gets an instance of the EthiopicChronology in the given time zone.static EthiopicChronologygetInstanceUTC()Gets an instance of the EthiopicChronology.(package private) intgetMaxYear()Gets the maximum supported year.(package private) intgetMinYear()Gets the minimum supported year.(package private) booleanisLeapDay(long instant)Is the specified instant a leap day?private java.lang.ObjectreadResolve()Serialization singleton.ChronologywithUTC()Gets the Chronology in the UTC time zone.ChronologywithZone(DateTimeZone zone)Gets the Chronology in a specific time zone.-
Methods inherited from class org.joda.time.chrono.BasicFixedMonthChronology
getAverageMillisPerMonth, getAverageMillisPerYear, getAverageMillisPerYearDividedByTwo, getDayOfMonth, getDaysInMonthMax, getDaysInMonthMax, getDaysInYearMonth, getMaxMonth, getMonthOfYear, getMonthOfYear, getTotalMillisByYearMonth, getYearDifference, isLeapYear, setYear
-
Methods inherited from class org.joda.time.chrono.BasicChronology
equals, getDateMidnightMillis, getDateTimeMillis, getDateTimeMillis, getDayOfMonth, getDayOfMonth, getDayOfWeek, getDayOfYear, getDayOfYear, getDaysInMonthMax, getDaysInMonthMaxForSet, getDaysInYear, getDaysInYearMax, getFirstWeekOfYearMillis, getMaxMonth, getMillisOfDay, getMinimumDaysInFirstWeek, getWeekOfWeekyear, getWeekOfWeekyear, getWeeksInYear, getWeekyear, getYear, getYearMillis, getYearMonthDayMillis, getYearMonthMillis, getZone, hashCode, toString
-
Methods inherited from class org.joda.time.chrono.AssembledChronology
centuries, centuryOfEra, clockhourOfDay, clockhourOfHalfday, dayOfMonth, dayOfWeek, dayOfYear, days, era, eras, getBase, getDateTimeMillis, getParam, halfdayOfDay, halfdays, hourOfDay, hourOfHalfday, hours, millis, millisOfDay, millisOfSecond, minuteOfDay, minuteOfHour, minutes, monthOfYear, months, secondOfDay, secondOfMinute, seconds, weekOfWeekyear, weeks, weekyear, weekyearOfCentury, weekyears, year, yearOfCentury, yearOfEra, years
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serialization lock- See Also:
- Constant Field Values
-
EE
public static final int EE
Constant value for 'Ethiopean Era', equivalent to the value returned for AD/CE.- See Also:
- Constant Field Values
-
ERA_FIELD
private static final DateTimeField ERA_FIELD
A singleton era field.
-
MIN_YEAR
private static final int MIN_YEAR
The lowest year that can be fully supported.- See Also:
- Constant Field Values
-
MAX_YEAR
private static final int MAX_YEAR
The highest year that can be fully supported.- See Also:
- Constant Field Values
-
cCache
private static final java.util.concurrent.ConcurrentHashMap<DateTimeZone,EthiopicChronology[]> cCache
Cache of zone to chronology arrays
-
INSTANCE_UTC
private static final EthiopicChronology INSTANCE_UTC
Singleton instance of a UTC EthiopicChronology
-
-
Constructor Detail
-
EthiopicChronology
EthiopicChronology(Chronology base, java.lang.Object param, int minDaysInFirstWeek)
Restricted constructor.
-
-
Method Detail
-
getInstanceUTC
public static EthiopicChronology getInstanceUTC()
Gets an instance of the EthiopicChronology. The time zone of the returned instance is UTC.- Returns:
- a singleton UTC instance of the chronology
-
getInstance
public static EthiopicChronology getInstance()
Gets an instance of the EthiopicChronology in the default time zone.- Returns:
- a chronology in the default time zone
-
getInstance
public static EthiopicChronology getInstance(DateTimeZone zone)
Gets an instance of the EthiopicChronology in the given time zone.- Parameters:
zone- the time zone to get the chronology in, null is default- Returns:
- a chronology in the specified time zone
-
getInstance
public static EthiopicChronology getInstance(DateTimeZone zone, int minDaysInFirstWeek)
Gets an instance of the EthiopicChronology in the given time zone.- Parameters:
zone- the time zone to get the chronology in, null is defaultminDaysInFirstWeek- minimum number of days in first week of the year; default is 4- Returns:
- a chronology in the specified time zone
-
readResolve
private java.lang.Object readResolve()
Serialization singleton.
-
withUTC
public Chronology withUTC()
Gets the Chronology in the UTC time zone.- Specified by:
withUTCin classBaseChronology- Returns:
- the chronology in UTC
-
withZone
public Chronology withZone(DateTimeZone zone)
Gets the Chronology in a specific time zone.- Specified by:
withZonein classBaseChronology- Parameters:
zone- the zone to get the chronology in, null is default- Returns:
- the chronology
- See Also:
ZonedChronology
-
isLeapDay
boolean isLeapDay(long instant)
Description copied from class:BasicChronologyIs the specified instant a leap day?- Overrides:
isLeapDayin classBasicChronology- Parameters:
instant- the instant to test- Returns:
- true if leap, default is false
-
calculateFirstDayOfYearMillis
long calculateFirstDayOfYearMillis(int year)
Description copied from class:BasicChronologyGets the millisecond value of the first day of the year.- Specified by:
calculateFirstDayOfYearMillisin classBasicChronology- Returns:
- the milliseconds for the first of the year
-
getMinYear
int getMinYear()
Description copied from class:BasicChronologyGets the minimum supported year.- Specified by:
getMinYearin classBasicChronology- Returns:
- the year
-
getMaxYear
int getMaxYear()
Description copied from class:BasicChronologyGets the maximum supported year.- Specified by:
getMaxYearin classBasicChronology- Returns:
- the year
-
getApproxMillisAtEpochDividedByTwo
long getApproxMillisAtEpochDividedByTwo()
Description copied from class:BasicChronologyReturns a constant representing the approximate number of milliseconds elapsed from year 0 of this chronology, divided by two. This constant must be defined as:(yearAtEpoch * averageMillisPerYear + millisOfYearAtEpoch) / 2where epoch is 1970-01-01 (Gregorian).- Specified by:
getApproxMillisAtEpochDividedByTwoin classBasicChronology
-
assemble
protected void assemble(AssembledChronology.Fields fields)
Description copied from class:AssembledChronologyInvoked by the constructor and after deserialization to allow subclasses to define all of its supported fields. All unset fields default to unsupported instances.- Overrides:
assemblein classBasicChronology- Parameters:
fields- container of fields
-
-