APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.util.calendar

public abstract sealed Class BaseCalendar

extends AbstractCalendar
permits Gregorian, JulianCalendar, LocalGregorianCalendar
Class Inheritance
Known Direct Subclasses
sun.util.calendar.Gregorian, sun.util.calendar.JulianCalendar, sun.util.calendar.LocalGregorianCalendar
Imports
java.util.TimeZone

The BaseCalendar provides basic calendar calculation functions to support the Julian, Gregorian, and Gregorian-based calendar systems.
Author
Masayoshi Okutsu
Since
1.5

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class

Field Summary

Modifier and TypeField and Description
pack-priv static final int[]
pack-priv static final int[]
public static final int
public static final int
private static final int
pack-priv static final int[]
public static final int
public static final int
private static final int[]
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
Inherited from sun.util.calendar.AbstractCalendar:
DAY_IN_MILLISEPOCH_OFFSETHOUR_IN_MILLISMINUTE_IN_MILLISSECOND_IN_MILLIS

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
getCalendarDateFromFixedDate(CalendarDate date, long fixedDate)

Implements abstract sun.util.calendar.AbstractCalendar.getCalendarDateFromFixedDate.

Calculates calendar fields and store them in the specified CalendarDate.

public int
getDayOfWeek(CalendarDate date)

Returns the day of week of the given Gregorian date.

public static int
getDayOfWeekFromFixedDate(long fixedDate)

public long
pack-priv final long
getDayOfYear(int year, int month, int dayOfMonth)

public long
getFixedDate(CalendarDate date)

Implements abstract sun.util.calendar.AbstractCalendar.getFixedDate.

Returns the fixed date calculated with the specified calendar date.

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

pack-priv final int
getGregorianYearFromFixedDate(long fixedDate)

Returns the Gregorian year number of the given fixed date.

public int
getMonthLength(CalendarDate date)

Implements abstract sun.util.calendar.CalendarSystem.getMonthLength.

Returns the length in days of the month specified by the calendar date.

private int
getMonthLength(int year, int month)

public int
getYearFromFixedDate(long fixedDate)

public int

Returns:

a year length in days
getYearLength
(CalendarDate
a CalendarDate
date
)

Implements abstract sun.util.calendar.CalendarSystem.getYearLength.

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.

protected boolean
isLeapYear(CalendarDate date)

Implements abstract sun.util.calendar.AbstractCalendar.isLeapYear.

Returns: true if the specified year is a Gregorian leap year, or false otherwise.

pack-priv boolean
isLeapYear(int normalizedYear)

public boolean
normalize(CalendarDate date)

Implements abstract sun.util.calendar.CalendarSystem.normalize.

Normalizes calendar fields in the specified date.

pack-priv void
public boolean
validate(CalendarDate date)

Implements abstract sun.util.calendar.CalendarSystem.validate.

Checks whether the calendar fields specified by date represents a valid date and time in this calendar system.

Inherited from sun.util.calendar.AbstractCalendar:
getCalendarDategetCalendarDategetCalendarDategetCalendarDategetDayOfWeekDateAftergetDayOfWeekDateBeforegetDayOfWeekDateOnOrBeforegetEragetErasgetNthDayOfWeekgetTimegetTimeOfDaygetTimeOfDayValuenormalizeTimesetErassetTimeOfDayvalidateTime

Field Detail

ACCUMULATED_DAYS_IN_MONTHback to summary
pack-priv static final int[] ACCUMULATED_DAYS_IN_MONTH
ACCUMULATED_DAYS_IN_MONTH_LEAPback to summary
pack-priv static final int[] ACCUMULATED_DAYS_IN_MONTH_LEAP
APRILback to summary
public static final int APRIL
AUGUSTback to summary
public static final int AUGUST
BASE_YEARback to summary
private static final int BASE_YEAR
DAYS_IN_MONTHback to summary
pack-priv static final int[] DAYS_IN_MONTH
DECEMBERback to summary
public static final int DECEMBER
FEBRUARYback to summary
public static final int FEBRUARY
FIXED_DATESback to summary
private static final int[] FIXED_DATES
FRIDAYback to summary
public static final int FRIDAY
JANUARYback to summary
public static final int JANUARY
JULYback to summary
public static final int JULY
JUNEback to summary
public static final int JUNE
MARCHback to summary
public static final int MARCH
MAYback to summary
public static final int MAY
MONDAYback to summary
public static final int MONDAY
NOVEMBERback to summary
public static final int NOVEMBER
OCTOBERback to summary
public static final int OCTOBER
SATURDAYback to summary
public static final int SATURDAY
SEPTEMBERback to summary
public static final int SEPTEMBER
SUNDAYback to summary
public static final int SUNDAY
THURSDAYback to summary
public static final int THURSDAY
TUESDAYback to summary
public static final int TUESDAY
WEDNESDAYback to summary
public static final int WEDNESDAY

Constructor Detail

BaseCalendarback to summary
public BaseCalendar()

Method Detail

getCalendarDateFromFixedDateback to summary
public void getCalendarDateFromFixedDate(CalendarDate date, long fixedDate)

Implements abstract sun.util.calendar.AbstractCalendar.getCalendarDateFromFixedDate.

Calculates calendar fields and store them in the specified CalendarDate.

Annotations
@Override
getDayOfWeekback to summary
public int getDayOfWeek(CalendarDate date)

Returns the day of week of the given Gregorian date.

getDayOfWeekFromFixedDateback to summary
public static int getDayOfWeekFromFixedDate(long fixedDate)
getDayOfYearback to summary
public long getDayOfYear(CalendarDate date)
getDayOfYearback to summary
pack-priv final long getDayOfYear(int year, int month, int dayOfMonth)
getFixedDateback to summary
public long getFixedDate(CalendarDate date)

Implements abstract sun.util.calendar.AbstractCalendar.getFixedDate.

Doc from sun.util.calendar.AbstractCalendar.getFixedDate.

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

Annotations
@Override
getFixedDateback to summary
public long getFixedDate(int year, int month, int dayOfMonth, BaseCalendar.Date cache)
getGregorianYearFromFixedDateback to summary
pack-priv final int getGregorianYearFromFixedDate(long fixedDate)

Returns the Gregorian year number of the given fixed date.

getMonthLengthback to summary
public int getMonthLength(CalendarDate date)

Implements abstract sun.util.calendar.CalendarSystem.getMonthLength.

Doc from sun.util.calendar.CalendarSystem.getMonthLength.

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.

Annotations
@Override
getMonthLengthback to summary
private int getMonthLength(int year, int month)
getYearFromFixedDateback to summary
public int getYearFromFixedDate(long fixedDate)
getYearLengthback to summary
public int getYearLength(CalendarDate date)

Implements abstract sun.util.calendar.CalendarSystem.getYearLength.

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.

Parameters
date:CalendarDate

a CalendarDate

Returns:int

a year length in days

Annotations
@Override
Exceptions
ClassCastException:
if the specified date is not a BaseCalendar.Date
isLeapYearback to summary
protected boolean isLeapYear(CalendarDate date)

Implements abstract sun.util.calendar.AbstractCalendar.isLeapYear.

Returns:boolean

true if the specified year is a Gregorian leap year, or false otherwise.

Annotations
@Override
See Also
CalendarUtils#isGregorianLeapYear
isLeapYearback to summary
pack-priv boolean isLeapYear(int normalizedYear)
normalizeback to summary
public boolean normalize(CalendarDate date)

Implements abstract sun.util.calendar.CalendarSystem.normalize.

Doc from sun.util.calendar.CalendarSystem.normalize.

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

Annotations
@Override
normalizeMonthback to summary
pack-priv void normalizeMonth(CalendarDate date)
validateback to summary
public boolean validate(CalendarDate date)

Implements abstract sun.util.calendar.CalendarSystem.validate.

Doc from sun.util.calendar.CalendarSystem.validate.

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.

Annotations
@Override
sun.util.calendar back to summary

public abstract sealed Class BaseCalendar.Date

extends CalendarDate
permits Date, ImmutableGregorianDate, Date, Date
Class Inheritance
Known Direct Subclasses
sun.util.calendar.Gregorian.Date, sun.util.calendar.ImmutableGregorianDate, sun.util.calendar.JulianCalendar.Date, sun.util.calendar.LocalGregorianCalendar.Date

Field Summary

Modifier and TypeField and Description
pack-priv long
pack-priv long
pack-priv int
Inherited from sun.util.calendar.CalendarDate:
FIELD_UNDEFINEDTIME_UNDEFINED

Constructor Summary

AccessConstructor and Description
protected
Date()

protected
Date(TimeZone zone)

Method Summary

Modifier and TypeMethod and Description
protected long
protected int
public abstract int
protected final boolean
hit(int year)

protected final boolean
hit(long fixedDate)

protected void
setCache(int year, long jan1, int len)

public BaseCalendar.Date
setNormalizedDate(int normalizedYear, int month, int dayOfMonth)

public abstract void
setNormalizedYear(int normalizedYear)

Inherited from sun.util.calendar.CalendarDate:
addHoursaddMonthaddYearcloneequalsgetDaylightSavinggetDayOfMonthgetDayOfWeekgetEragetHoursgetMillisgetMinutesgetMonthgetSecondsgetTimeOfDaygetYeargetZonegetZoneOffsethashCodeisDaylightTimeisLeapYearisNormalizedisSameDatesetDatesetDaylightSavingsetDayOfMonthsetDayOfWeeksetErasetHourssetLeapYearsetMillissetMinutessetMonthsetNormalizedsetSecondssetTimeOfDaysetTimeOfDaysetYearsetZonesetZoneOffsettoString

Field Detail

cachedFixedDateJan1back to summary
pack-priv long cachedFixedDateJan1
cachedFixedDateNextJan1back to summary
pack-priv long cachedFixedDateNextJan1
cachedYearback to summary
pack-priv int cachedYear

Constructor Detail

Dateback to summary
protected Date()
Dateback to summary
protected Date(TimeZone zone)

Method Detail

getCachedJan1back to summary
protected long getCachedJan1()
getCachedYearback to summary
protected int getCachedYear()
getNormalizedYearback to summary
public abstract int getNormalizedYear()
hitback to summary
protected final boolean hit(int year)
hitback to summary
protected final boolean hit(long fixedDate)
setCacheback to summary
protected void setCache(int year, long jan1, int len)
setNormalizedDateback to summary
public BaseCalendar.Date setNormalizedDate(int normalizedYear, int month, int dayOfMonth)
setNormalizedYearback to summary
public abstract void setNormalizedYear(int normalizedYear)