public abstract class

BaseCalendar

extends AbstractCalendar
java.lang.Object
   ↳ sun.util.calendar.CalendarSystem
     ↳ sun.util.calendar.AbstractCalendar
       ↳ sun.util.calendar.BaseCalendar
Known Direct Subclasses

Class Overview

The BaseCalendar provides basic calendar calculation functions to support the Julian, Gregorian, and Gregorian-based calendar systems.

Summary

Nested Classes
class BaseCalendar.Date  
Constants
int APRIL
int AUGUST
int DECEMBER
int FEBRUARY
int FRIDAY
int JANUARY
int JULY
int JUNE
int MARCH
int MAY
int MONDAY
int NOVEMBER
int OCTOBER
int SATURDAY
int SEPTEMBER
int SUNDAY
int THURSDAY
int TUESDAY
int WEDNESDAY
Public Constructors
BaseCalendar()
Public Methods
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.
final static int getDayOfWeekFromFixedDate(long fixedDate)
long getDayOfYear(CalendarDate date)
long getFixedDate(int year, int month, int dayOfMonth, BaseCalendar.Date cache)
long getFixedDate(CalendarDate date)
Returns the fixed date calculated with the specified calendar date.
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.
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.
Protected Methods
boolean isLeapYear(CalendarDate date)
[Expand]
Inherited Methods
From class sun.util.calendar.AbstractCalendar
From class sun.util.calendar.CalendarSystem
From class java.lang.Object

Constants

public static final int APRIL

Constant Value: 4 (0x00000004)

public static final int AUGUST

Constant Value: 8 (0x00000008)

public static final int DECEMBER

Constant Value: 12 (0x0000000c)

public static final int FEBRUARY

Constant Value: 2 (0x00000002)

public static final int FRIDAY

Constant Value: 6 (0x00000006)

public static final int JANUARY

Constant Value: 1 (0x00000001)

public static final int JULY

Constant Value: 7 (0x00000007)

public static final int JUNE

Constant Value: 6 (0x00000006)

public static final int MARCH

Constant Value: 3 (0x00000003)

public static final int MAY

Constant Value: 5 (0x00000005)

public static final int MONDAY

Constant Value: 2 (0x00000002)

public static final int NOVEMBER

Constant Value: 11 (0x0000000b)

public static final int OCTOBER

Constant Value: 10 (0x0000000a)

public static final int SATURDAY

Constant Value: 7 (0x00000007)

public static final int SEPTEMBER

Constant Value: 9 (0x00000009)

public static final int SUNDAY

Constant Value: 1 (0x00000001)

public static final int THURSDAY

Constant Value: 5 (0x00000005)

public static final int TUESDAY

Constant Value: 3 (0x00000003)

public static final int WEDNESDAY

Constant Value: 4 (0x00000004)

Public Constructors

public BaseCalendar ()

Public Methods

public void getCalendarDateFromFixedDate (CalendarDate date, long fixedDate)

Calculates calendar fields and store them in the specified CalendarDate.

Parameters
date a CalendarDate to stored the calculated calendar fields.
fixedDate a fixed date to calculate calendar fields

public int getDayOfWeek (CalendarDate date)

Returns the day of week of the given Gregorian date.

public static final int getDayOfWeekFromFixedDate (long fixedDate)

public long getDayOfYear (CalendarDate date)

public long getFixedDate (int year, int month, int dayOfMonth, BaseCalendar.Date cache)

public long getFixedDate (CalendarDate date)

Returns the fixed date calculated with the specified calendar date. If the specified date is not normalized, its date fields are normalized.

Parameters
date a CalendarDate with which the fixed date is calculated
Returns
  • the calculated fixed date

public int getMonthLength (CalendarDate date)

Returns the length in days of the month specified by the calendar date. This method does not perform the normalization with the specified calendar date. The CalendarDate must be normalized to get a correct value.

Parameters
date the date from which the month value is obtained
Returns
  • the number of days in the month

public int getYearFromFixedDate (long fixedDate)

public 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. The CalendarDate must be normalized to get a correct value.

Returns
  • a year length in days
Throws
ClassCastException if the specified date is not a BaseCalendar.Date

public int getYearLengthInMonths (CalendarDate date)

Returns the number of months of the specified year. This method does not perform the normalization with the specified CalendarDate. The CalendarDate must be normalized to get a correct value.

public boolean normalize (CalendarDate date)

Normalizes calendar fields in the specified date. Also all undefined fields are set to correct values. The actual normalization process is calendar system dependent.

Parameters
date the calendar date to be validated
Returns
  • true if all fields have been normalized; false otherwise.

public boolean validate (CalendarDate date)

Checks whether the calendar fields specified by date represents a valid date and time in this calendar system. If the given date is valid, date is marked as normalized.

Parameters
date the CalendarDate to be validated
Returns
  • true if all the calendar fields are consistent, otherwise, false is returned.

Protected Methods

protected boolean isLeapYear (CalendarDate date)

Returns
  • true if the specified year is a Gregorian leap year, or false otherwise.
See Also
  • BaseCalendar#isGregorianLeapYear