Package org.joda.time.chrono
Class BasicGJChronology
java.lang.Object
org.joda.time.Chronology
org.joda.time.chrono.BaseChronology
org.joda.time.chrono.AssembledChronology
org.joda.time.chrono.BasicChronology
org.joda.time.chrono.BasicGJChronology
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
GregorianChronology,JulianChronology
Abstract Chronology for implementing chronologies based on Gregorian/Julian formulae.
Most of the utility methods required by subclasses are package-private,
reflecting the intention that they be defined in the same package.
BasicGJChronology is thread-safe and immutable, and all subclasses must be as well.
- Since:
- 1.2, refactored from CommonGJChronology
-
Nested Class Summary
Nested classes/interfaces inherited from class org.joda.time.chrono.AssembledChronology
AssembledChronology.Fields -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longprivate static final int[]private static final long[]private static final int[]private static final long[]private static final longSerialization lock -
Constructor Summary
ConstructorsConstructorDescriptionBasicGJChronology(Chronology base, Object param, int minDaysInFirstWeek) Constructor. -
Method Summary
Modifier and TypeMethodDescription(package private) intgetDaysInMonthMax(int month) Gets the maximum days in the specified month.(package private) intgetDaysInMonthMaxForSet(long instant, int value) Gets the maximum number of days in the month specified by the instant.(package private) intgetDaysInYearMonth(int year, int month) Gets the number of days in the specified month and year.(package private) intgetMonthOfYear(long millis, int year) (package private) longgetTotalMillisByYearMonth(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) longgetYearDifference(long minuendInstant, long subtrahendInstant) Gets the difference between the two instants in years.(package private) booleanisLeapDay(long instant) Is the specified instant a leap day?(package private) longsetYear(long instant, int year) Sets the year from an instant and year.Methods inherited from class org.joda.time.chrono.BasicChronology
assemble, calculateFirstDayOfYearMillis, equals, getApproxMillisAtEpochDividedByTwo, getAverageMillisPerMonth, getAverageMillisPerYear, getAverageMillisPerYearDividedByTwo, getDateMidnightMillis, getDateTimeMillis, getDateTimeMillis, getDayOfMonth, getDayOfMonth, getDayOfMonth, getDayOfWeek, getDayOfYear, getDayOfYear, getDaysInMonthMax, getDaysInMonthMax, getDaysInYear, getDaysInYearMax, getFirstWeekOfYearMillis, getMaxMonth, getMaxMonth, getMaxYear, getMillisOfDay, getMinimumDaysInFirstWeek, getMinYear, getMonthOfYear, getWeekOfWeekyear, getWeekOfWeekyear, getWeeksInYear, getWeekyear, getYear, getYearMillis, getYearMonthDayMillis, getYearMonthMillis, getZone, hashCode, isLeapYear, toStringMethods 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 Details
-
serialVersionUID
private static final long serialVersionUIDSerialization lock- See Also:
-
MIN_DAYS_PER_MONTH_ARRAY
private static final int[] MIN_DAYS_PER_MONTH_ARRAY -
MAX_DAYS_PER_MONTH_ARRAY
private static final int[] MAX_DAYS_PER_MONTH_ARRAY -
MIN_TOTAL_MILLIS_BY_MONTH_ARRAY
private static final long[] MIN_TOTAL_MILLIS_BY_MONTH_ARRAY -
MAX_TOTAL_MILLIS_BY_MONTH_ARRAY
private static final long[] MAX_TOTAL_MILLIS_BY_MONTH_ARRAY -
FEB_29
private static final long FEB_29- See Also:
-
-
Constructor Details
-
BasicGJChronology
BasicGJChronology(Chronology base, Object param, int minDaysInFirstWeek) Constructor.
-
-
Method Details
-
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
-
getMonthOfYear
int getMonthOfYear(long millis, int year) - Specified by:
getMonthOfYearin classBasicChronology- Parameters:
millis- from 1970-01-01T00:00:00Zyear- precalculated year of millis
-
getDaysInYearMonth
int getDaysInYearMonth(int year, int month) Gets the number of days in the specified month and year.- Specified by:
getDaysInYearMonthin classBasicChronology- Parameters:
year- the yearmonth- the month- Returns:
- the number of days
-
getDaysInMonthMax
int getDaysInMonthMax(int month) Description copied from class:BasicChronologyGets the maximum days in the specified month.- Specified by:
getDaysInMonthMaxin classBasicChronology- Parameters:
month- the month- Returns:
- the max days
-
getDaysInMonthMaxForSet
int getDaysInMonthMaxForSet(long instant, int value) Description copied from class:BasicChronologyGets the maximum number of days in the month specified by the instant. The value represents what the user is trying to set, and can be used to optimise this method.- Overrides:
getDaysInMonthMaxForSetin classBasicChronology- Parameters:
instant- millis from 1970-01-01T00:00:00Zvalue- the value being set- Returns:
- the maximum number of days in the month
-
getTotalMillisByYearMonth
long getTotalMillisByYearMonth(int year, int month) Description copied from class:BasicChronologyGets the total number of millis elapsed in this year at the start of the specified month, such as zero for month 1.- Specified by:
getTotalMillisByYearMonthin classBasicChronology- Parameters:
year- the yearmonth- the month- Returns:
- the elapsed millis at the start of the month
-
getYearDifference
long getYearDifference(long minuendInstant, long subtrahendInstant) Description copied from class:BasicChronologyGets the difference between the two instants in years.- Specified by:
getYearDifferencein classBasicChronology- Parameters:
minuendInstant- the first instantsubtrahendInstant- the second instant- Returns:
- the difference
-
setYear
long setYear(long instant, int year) Description copied from class:BasicChronologySets the year from an instant and year.- Specified by:
setYearin classBasicChronology- Parameters:
instant- millis from 1970-01-01T00:00:00Zyear- the year to set- Returns:
- the updated millis
-