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 |
|
[Expand]
Inherited Methods |
From class
sun.util.calendar.AbstractCalendar
CalendarDate
|
getCalendarDate(long millis)
Calculates calendar fields from the specified number of
milliseconds since the Epoch, January 1, 1970 00:00:00 UTC
(Gregorian).
|
CalendarDate
|
getCalendarDate(long millis, CalendarDate date)
|
CalendarDate
|
getCalendarDate(long millis, TimeZone zone)
|
CalendarDate
|
getCalendarDate()
|
abstract
void
|
getCalendarDateFromFixedDate(CalendarDate date, long fixedDate)
Calculates calendar fields from the specified fixed date.
|
static
long
|
getDayOfWeekDateOnOrBefore(long fixedDate, int dayOfWeek)
Returns a date of the given day of week on or before the given fixed
date.
|
Era
|
getEra(String eraName)
Returns the Era designated by the era name that
has to be known to this calendar system.
|
Era[]
|
getEras()
Returns valid Era s of this calendar system.
|
abstract
long
|
getFixedDate(CalendarDate date)
Returns the fixed date calculated with the specified calendar
date.
|
CalendarDate
|
getNthDayOfWeek(int nth, int dayOfWeek, CalendarDate date)
Returns a CalendarDate of the n-th day of week
which is on, after or before the specified date.
|
long
|
getTime(CalendarDate date)
Returns the number of milliseconds since the Epoch, January 1,
1970 00:00:00 UTC (Gregorian), represented by the specified
CalendarDate .
|
long
|
getTimeOfDay(CalendarDate date)
|
long
|
getTimeOfDayValue(CalendarDate date)
|
int
|
getWeekLength()
Returns 7 in this default implementation.
|
abstract
boolean
|
isLeapYear(CalendarDate date)
|
void
|
setEra(CalendarDate date, String eraName)
|
void
|
setEras(Era[] eras)
|
CalendarDate
|
setTimeOfDay(CalendarDate cdate, int fraction)
|
boolean
|
validateTime(CalendarDate date)
|
|
From class
sun.util.calendar.CalendarSystem
static
CalendarSystem
|
forName(String calendarName)
Returns a CalendarSystem specified by the calendar
name.
|
abstract
CalendarDate
|
getCalendarDate(long millis)
Calculates calendar fields from the specified number of
milliseconds since the Epoch, January 1, 1970 00:00:00 UTC
(Gregorian).
|
abstract
CalendarDate
|
getCalendarDate(long millis, CalendarDate date)
|
abstract
CalendarDate
|
getCalendarDate(long millis, TimeZone zone)
|
abstract
CalendarDate
|
getCalendarDate()
|
abstract
Era
|
getEra(String eraName)
Returns the Era designated by the era name that
has to be known to this calendar system.
|
abstract
Era[]
|
getEras()
Returns valid Era s of this calendar system.
|
static
Gregorian
|
getGregorianCalendar()
Returns the singleton instance of the Gregorian
calendar system.
|
abstract
int
|
getMonthLength(CalendarDate date)
Returns the length in days of the month specified by the calendar
date.
|
abstract
String
|
getName()
Returns the name of this calendar system.
|
abstract
CalendarDate
|
getNthDayOfWeek(int nth, int dayOfWeek, CalendarDate date)
Returns a CalendarDate of the n-th day of week
which is on, after or before the specified date.
|
abstract
long
|
getTime(CalendarDate date)
Returns the number of milliseconds since the Epoch, January 1,
1970 00:00:00 UTC (Gregorian), represented by the specified
CalendarDate .
|
abstract
int
|
getWeekLength()
Returns the length in days of a week in this calendar
system.
|
abstract
int
|
getYearLength(CalendarDate date)
Returns the length in days of the specified year by
date .
|
abstract
int
|
getYearLengthInMonths(CalendarDate date)
Returns the number of months of the specified year.
|
abstract
CalendarDate
|
newCalendarDate()
Constructs a CalendarDate that is specific to this
calendar system.
|
abstract
CalendarDate
|
newCalendarDate(TimeZone zone)
|
abstract
boolean
|
normalize(CalendarDate date)
Normalizes calendar fields in the specified
date .
|
abstract
void
|
setEra(CalendarDate date, String eraName)
|
abstract
CalendarDate
|
setTimeOfDay(CalendarDate date, int timeOfDay)
|
abstract
boolean
|
validate(CalendarDate date)
Checks whether the calendar fields specified by date
represents a valid date and time in this calendar system.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
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 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
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.
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