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[]>
cCache
Cache of zone to chronology arraysstatic int
EE
Constant value for 'Ethiopean Era', equivalent to the value returned for AD/CE.private static DateTimeField
ERA_FIELD
A singleton era field.private static EthiopicChronology
INSTANCE_UTC
Singleton instance of a UTC EthiopicChronologyprivate static int
MAX_YEAR
The highest year that can be fully supported.private static int
MIN_YEAR
The lowest year that can be fully supported.private static long
serialVersionUID
Serialization 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 void
assemble(AssembledChronology.Fields fields)
Invoked by the constructor and after deserialization to allow subclasses to define all of its supported fields.(package private) long
calculateFirstDayOfYearMillis(int year)
Gets the millisecond value of the first day of the year.(package private) long
getApproxMillisAtEpochDividedByTwo()
Returns a constant representing the approximate number of milliseconds elapsed from year 0 of this chronology, divided by two.static EthiopicChronology
getInstance()
Gets an instance of the EthiopicChronology in the default time zone.static EthiopicChronology
getInstance(DateTimeZone zone)
Gets an instance of the EthiopicChronology in the given time zone.static EthiopicChronology
getInstance(DateTimeZone zone, int minDaysInFirstWeek)
Gets an instance of the EthiopicChronology in the given time zone.static EthiopicChronology
getInstanceUTC()
Gets an instance of the EthiopicChronology.(package private) int
getMaxYear()
Gets the maximum supported year.(package private) int
getMinYear()
Gets the minimum supported year.(package private) boolean
isLeapDay(long instant)
Is the specified instant a leap day?private java.lang.Object
readResolve()
Serialization singleton.Chronology
withUTC()
Gets the Chronology in the UTC time zone.Chronology
withZone(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:
withUTC
in classBaseChronology
- Returns:
- the chronology in UTC
-
withZone
public Chronology withZone(DateTimeZone zone)
Gets the Chronology in a specific time zone.- Specified by:
withZone
in 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:BasicChronology
Is the specified instant a leap day?- Overrides:
isLeapDay
in classBasicChronology
- Parameters:
instant
- the instant to test- Returns:
- true if leap, default is false
-
calculateFirstDayOfYearMillis
long calculateFirstDayOfYearMillis(int year)
Description copied from class:BasicChronology
Gets the millisecond value of the first day of the year.- Specified by:
calculateFirstDayOfYearMillis
in classBasicChronology
- Returns:
- the milliseconds for the first of the year
-
getMinYear
int getMinYear()
Description copied from class:BasicChronology
Gets the minimum supported year.- Specified by:
getMinYear
in classBasicChronology
- Returns:
- the year
-
getMaxYear
int getMaxYear()
Description copied from class:BasicChronology
Gets the maximum supported year.- Specified by:
getMaxYear
in classBasicChronology
- Returns:
- the year
-
getApproxMillisAtEpochDividedByTwo
long getApproxMillisAtEpochDividedByTwo()
Description copied from class:BasicChronology
Returns 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) / 2
where epoch is 1970-01-01 (Gregorian).- Specified by:
getApproxMillisAtEpochDividedByTwo
in classBasicChronology
-
assemble
protected void assemble(AssembledChronology.Fields fields)
Description copied from class:AssembledChronology
Invoked by the constructor and after deserialization to allow subclasses to define all of its supported fields. All unset fields default to unsupported instances.- Overrides:
assemble
in classBasicChronology
- Parameters:
fields
- container of fields
-
-