abstract class BasicChronology extends AssembledChronology
BasicChronology is thread-safe and immutable, and all subclasses must be as well.
Modifier and Type | Class and Description |
---|---|
private static class |
BasicChronology.HalfdayField |
private static class |
BasicChronology.YearInfo |
AssembledChronology.Fields
Constructor and Description |
---|
BasicChronology(Chronology base,
java.lang.Object param,
int minDaysInFirstWeek) |
Modifier and Type | Method and 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) abstract long |
calculateFirstDayOfYearMillis(int year)
Gets the millisecond value of the first day of the year.
|
boolean |
equals(java.lang.Object obj)
Checks if this chronology instance equals another.
|
(package private) abstract long |
getApproxMillisAtEpochDividedByTwo()
Returns a constant representing the approximate number of milliseconds
elapsed from year 0 of this chronology, divided by two.
|
(package private) abstract long |
getAverageMillisPerMonth()
Gets an average value for the milliseconds per month.
|
(package private) abstract long |
getAverageMillisPerYear()
Gets an average value for the milliseconds per year.
|
(package private) abstract long |
getAverageMillisPerYearDividedByTwo()
Gets an average value for the milliseconds per year, divided by two.
|
(package private) long |
getDateMidnightMillis(int year,
int monthOfYear,
int dayOfMonth)
Gets the milliseconds for a date at midnight.
|
long |
getDateTimeMillis(int year,
int monthOfYear,
int dayOfMonth,
int millisOfDay)
Returns a datetime millisecond instant, formed from the given year,
month, day, and millisecond values.
|
long |
getDateTimeMillis(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond)
Returns a datetime millisecond instant, formed from the given year,
month, day, hour, minute, second, and millisecond values.
|
private long |
getDateTimeMillis0(int year,
int monthOfYear,
int dayOfMonth,
int millisOfDay) |
(package private) int |
getDayOfMonth(long millis) |
(package private) int |
getDayOfMonth(long millis,
int year) |
(package private) int |
getDayOfMonth(long millis,
int year,
int month) |
(package private) int |
getDayOfWeek(long instant) |
(package private) int |
getDayOfYear(long instant) |
(package private) int |
getDayOfYear(long instant,
int year) |
(package private) int |
getDaysInMonthMax()
Gets the maximum number of days in any month.
|
(package private) abstract int |
getDaysInMonthMax(int month)
Gets the maximum days in the specified month.
|
(package private) int |
getDaysInMonthMax(long instant)
Gets the maximum number of days in the month specified by the instant.
|
(package private) int |
getDaysInMonthMaxForSet(long instant,
int value)
Gets the maximum number of days in the month specified by the instant.
|
(package private) int |
getDaysInYear(int year)
Get the number of days in the year.
|
(package private) int |
getDaysInYearMax()
Get the number of days in the year.
|
(package private) abstract int |
getDaysInYearMonth(int year,
int month)
Gets the number of days in the specified month and year.
|
(package private) long |
getFirstWeekOfYearMillis(int year)
Get the millis for the first week of a year.
|
(package private) int |
getMaxMonth()
Gets the maximum number of months.
|
(package private) int |
getMaxMonth(int year)
Gets the maximum month for the specified year.
|
(package private) abstract int |
getMaxYear()
Gets the maximum supported year.
|
(package private) int |
getMillisOfDay(long instant) |
int |
getMinimumDaysInFirstWeek() |
(package private) abstract int |
getMinYear()
Gets the minimum supported year.
|
(package private) int |
getMonthOfYear(long millis) |
(package private) abstract int |
getMonthOfYear(long millis,
int year) |
(package private) abstract long |
getTotalMillisByYearMonth(int year,
int month)
Gets the total number of millis elapsed in this year at the start
of the specified month, such as zero for month 1.
|
(package private) int |
getWeekOfWeekyear(long instant) |
(package private) int |
getWeekOfWeekyear(long instant,
int year) |
(package private) int |
getWeeksInYear(int year)
Get the number of weeks in the year.
|
(package private) int |
getWeekyear(long instant) |
(package private) int |
getYear(long instant) |
(package private) abstract long |
getYearDifference(long minuendInstant,
long subtrahendInstant)
Gets the difference between the two instants in years.
|
private BasicChronology.YearInfo |
getYearInfo(int year) |
(package private) long |
getYearMillis(int year)
Get the milliseconds for the start of a year.
|
(package private) long |
getYearMonthDayMillis(int year,
int month,
int dayOfMonth)
Get the milliseconds for a particular date.
|
(package private) long |
getYearMonthMillis(int year,
int month)
Get the milliseconds for the start of a month.
|
DateTimeZone |
getZone()
Returns the DateTimeZone that this Chronology operates in, or null if
unspecified.
|
int |
hashCode()
A suitable hash code for the chronology.
|
(package private) boolean |
isLeapDay(long instant)
Is the specified instant a leap day?
|
(package private) abstract boolean |
isLeapYear(int year)
Is the specified year a leap year?
|
(package private) abstract long |
setYear(long instant,
int year)
Sets the year from an instant and year.
|
java.lang.String |
toString()
Gets a debugging toString.
|
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
private static final long serialVersionUID
private static final DurationField cMillisField
private static final DurationField cSecondsField
private static final DurationField cMinutesField
private static final DurationField cHoursField
private static final DurationField cHalfdaysField
private static final DurationField cDaysField
private static final DurationField cWeeksField
private static final DateTimeField cMillisOfSecondField
private static final DateTimeField cMillisOfDayField
private static final DateTimeField cSecondOfMinuteField
private static final DateTimeField cSecondOfDayField
private static final DateTimeField cMinuteOfHourField
private static final DateTimeField cMinuteOfDayField
private static final DateTimeField cHourOfDayField
private static final DateTimeField cHourOfHalfdayField
private static final DateTimeField cClockhourOfDayField
private static final DateTimeField cClockhourOfHalfdayField
private static final DateTimeField cHalfdayOfDayField
private static final int CACHE_SIZE
private static final int CACHE_MASK
private final transient BasicChronology.YearInfo[] iYearInfoCache
private final int iMinDaysInFirstWeek
BasicChronology(Chronology base, java.lang.Object param, int minDaysInFirstWeek)
public DateTimeZone getZone()
BaseChronology
getZone
in class AssembledChronology
public long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int millisOfDay) throws java.lang.IllegalArgumentException
BaseChronology
The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.
getDateTimeMillis
in class AssembledChronology
year
- year to usemonthOfYear
- month to usedayOfMonth
- day of month to usemillisOfDay
- millisecond to usejava.lang.IllegalArgumentException
- if the values are invalidpublic long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond) throws java.lang.IllegalArgumentException
BaseChronology
The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.
getDateTimeMillis
in class AssembledChronology
year
- year to usemonthOfYear
- month to usedayOfMonth
- day of month to usehourOfDay
- hour to useminuteOfHour
- minute to usesecondOfMinute
- second to usemillisOfSecond
- millisecond to usejava.lang.IllegalArgumentException
- if the values are invalidprivate long getDateTimeMillis0(int year, int monthOfYear, int dayOfMonth, int millisOfDay)
public int getMinimumDaysInFirstWeek()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare topublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class BaseChronology
protected void assemble(AssembledChronology.Fields fields)
AssembledChronology
assemble
in class AssembledChronology
fields
- container of fieldsint getDaysInYearMax()
int getDaysInYear(int year)
year
- the year to useint getWeeksInYear(int year)
year
- the year to uselong getFirstWeekOfYearMillis(int year)
year
- the year to uselong getYearMillis(int year)
year
- The year to use.long getYearMonthMillis(int year, int month)
year
- The year to use.month
- The month to uselong getYearMonthDayMillis(int year, int month, int dayOfMonth)
year
- The year to use.month
- The month to usedayOfMonth
- The day of the month to useint getYear(long instant)
instant
- millis from 1970-01-01T00:00:00Zint getMonthOfYear(long millis)
millis
- from 1970-01-01T00:00:00Zabstract int getMonthOfYear(long millis, int year)
millis
- from 1970-01-01T00:00:00Zyear
- precalculated year of millisint getDayOfMonth(long millis)
millis
- from 1970-01-01T00:00:00Zint getDayOfMonth(long millis, int year)
millis
- from 1970-01-01T00:00:00Zyear
- precalculated year of millisint getDayOfMonth(long millis, int year, int month)
millis
- from 1970-01-01T00:00:00Zyear
- precalculated year of millismonth
- precalculated month of millisint getDayOfYear(long instant)
instant
- millis from 1970-01-01T00:00:00Zint getDayOfYear(long instant, int year)
instant
- millis from 1970-01-01T00:00:00Zyear
- precalculated year of millisint getWeekyear(long instant)
instant
- millis from 1970-01-01T00:00:00Zint getWeekOfWeekyear(long instant)
instant
- millis from 1970-01-01T00:00:00Zint getWeekOfWeekyear(long instant, int year)
instant
- millis from 1970-01-01T00:00:00Zyear
- precalculated year of millisint getDayOfWeek(long instant)
instant
- millis from 1970-01-01T00:00:00Zint getMillisOfDay(long instant)
instant
- millis from 1970-01-01T00:00:00Zint getDaysInMonthMax()
int getDaysInMonthMax(long instant)
instant
- millis from 1970-01-01T00:00:00Zint getDaysInMonthMaxForSet(long instant, int value)
instant
- millis from 1970-01-01T00:00:00Zvalue
- the value being setlong getDateMidnightMillis(int year, int monthOfYear, int dayOfMonth)
year
- the yearmonthOfYear
- the monthdayOfMonth
- the dayabstract long getYearDifference(long minuendInstant, long subtrahendInstant)
minuendInstant
- the first instantsubtrahendInstant
- the second instantabstract boolean isLeapYear(int year)
year
- the year to testboolean isLeapDay(long instant)
instant
- the instant to testabstract int getDaysInYearMonth(int year, int month)
year
- the yearmonth
- the monthabstract int getDaysInMonthMax(int month)
month
- the monthabstract long getTotalMillisByYearMonth(int year, int month)
year
- the yearmonth
- the monthabstract long calculateFirstDayOfYearMillis(int year)
abstract int getMinYear()
abstract int getMaxYear()
int getMaxMonth(int year)
year
- the yearint getMaxMonth()
abstract long getAverageMillisPerYear()
abstract long getAverageMillisPerYearDividedByTwo()
abstract long getAverageMillisPerMonth()
abstract long getApproxMillisAtEpochDividedByTwo()
(yearAtEpoch * averageMillisPerYear + millisOfYearAtEpoch) / 2where epoch is 1970-01-01 (Gregorian).
abstract long setYear(long instant, int year)
instant
- millis from 1970-01-01T00:00:00Zyear
- the year to setprivate BasicChronology.YearInfo getYearInfo(int year)