public abstract class BaseCalendar extends AbstractCalendar
BaseCalendar provides basic calendar calculation
functions to support the Julian, Gregorian, and Gregorian-based
calendar systems.| Modifier and Type | Class and Description |
|---|---|
static class |
BaseCalendar.Date |
| Modifier and Type | Field and Description |
|---|---|
static int |
APRIL |
static int |
AUGUST |
static int |
DECEMBER |
static int |
FEBRUARY |
static int |
FRIDAY |
static int |
JANUARY |
static int |
JULY |
static int |
JUNE |
static int |
MARCH |
static int |
MAY |
static int |
MONDAY |
static int |
NOVEMBER |
static int |
OCTOBER |
static int |
SATURDAY |
static int |
SEPTEMBER |
static int |
SUNDAY |
static int |
THURSDAY |
static int |
TUESDAY |
static int |
WEDNESDAY |
| Constructor and Description |
|---|
BaseCalendar() |
| Modifier and Type | Method and Description |
|---|---|
void |
getCalendarDateFromFixedDate(CalendarDate date,
long fixedDate)
Calculates calendar fields and store them in the specified
CalendarDate. |
int |
getDayOfWeek(CalendarDate date)
Returns the day of week of the given Gregorian date.
|
static int |
getDayOfWeekFromFixedDate(long fixedDate) |
long |
getDayOfYear(CalendarDate date) |
long |
getFixedDate(CalendarDate date)
Returns the fixed date calculated with the specified calendar
date.
|
long |
getFixedDate(int year,
int month,
int dayOfMonth,
BaseCalendar.Date cache) |
int |
getMonthLength(CalendarDate date)
Returns the length in days of the month specified by the calendar
date.
|
int |
getYearFromFixedDate(long fixedDate) |
int |
getYearLength(CalendarDate date)
Returns 366 if the specified date is in a leap year, or 365
otherwise This method does not perform the normalization with
the specified
CalendarDate. |
int |
getYearLengthInMonths(CalendarDate date)
Returns the number of months of the specified year.
|
protected boolean |
isLeapYear(CalendarDate date) |
boolean |
normalize(CalendarDate date)
Normalizes calendar fields in the specified
date. |
boolean |
validate(CalendarDate date)
Checks whether the calendar fields specified by
date
represents a valid date and time in this calendar system. |
getCalendarDate, getCalendarDate, getCalendarDate, getCalendarDate, getDayOfWeekDateOnOrBefore, getEra, getEras, getNthDayOfWeek, getTime, getTimeOfDay, getTimeOfDayValue, getWeekLength, setEra, setEras, setTimeOfDay, validateTimeforName, getGregorianCalendar, getName, newCalendarDate, newCalendarDatepublic static final int JANUARY
public static final int FEBRUARY
public static final int MARCH
public static final int APRIL
public static final int MAY
public static final int JUNE
public static final int JULY
public static final int AUGUST
public static final int SEPTEMBER
public static final int OCTOBER
public static final int NOVEMBER
public static final int DECEMBER
public static final int SUNDAY
public static final int MONDAY
public static final int TUESDAY
public static final int WEDNESDAY
public static final int THURSDAY
public static final int FRIDAY
public static final int SATURDAY
public boolean validate(CalendarDate date)
CalendarSystemdate
represents a valid date and time in this calendar system. If the
given date is valid, date is marked as normalized.validate in class CalendarSystemdate - the CalendarDate to be validatedtrue if all the calendar fields are consistent,
otherwise, false is returned.public boolean normalize(CalendarDate date)
CalendarSystemdate. Also all undefined fields are set to correct values. The actual
normalization process is calendar system dependent.normalize in class CalendarSystemdate - the calendar date to be validatedtrue if all fields have been normalized;
false otherwise.public int getYearLength(CalendarDate date)
CalendarDate. The
CalendarDate must be normalized to get a correct
value.getYearLength in class CalendarSystemdate - a CalendarDatejava.lang.ClassCastException - if the specified date is not a
BaseCalendar.Datepublic int getYearLengthInMonths(CalendarDate date)
CalendarSystemCalendarDate. The CalendarDate must
be normalized to get a correct value.getYearLengthInMonths in class CalendarSystempublic int getMonthLength(CalendarDate date)
CalendarSystemCalendarDate must
be normalized to get a correct value.getMonthLength in class CalendarSystemdate - the date from which the month value is obtainedpublic long getDayOfYear(CalendarDate date)
public long getFixedDate(CalendarDate date)
AbstractCalendargetFixedDate in class AbstractCalendardate - a CalendarDate with which the fixed
date is calculatedAbstractCalendar.html#fixed_datepublic long getFixedDate(int year,
int month,
int dayOfMonth,
BaseCalendar.Date cache)
public void getCalendarDateFromFixedDate(CalendarDate date, long fixedDate)
CalendarDate.getCalendarDateFromFixedDate in class AbstractCalendardate - a CalendarDate to stored the
calculated calendar fields.fixedDate - a fixed date to calculate calendar fieldsAbstractCalendar.html#fixed_datepublic int getDayOfWeek(CalendarDate date)
public static final int getDayOfWeekFromFixedDate(long fixedDate)
public int getYearFromFixedDate(long fixedDate)
protected boolean isLeapYear(CalendarDate date)
isLeapYear in class AbstractCalendarBaseCalendar#isGregorianLeapYear