com.ibm.icu.util

Class BuddhistCalendar

Implemented Interfaces:
Cloneable, Comparable, Serializable

public class BuddhistCalendar
extends GregorianCalendar

BuddhistCalendar is a subclass of GregorianCalendar that numbers years since the birth of the Buddha. This is the civil calendar in some predominantly Buddhist countries such as Thailand, and it is used for religious purposes elsewhere.

The Buddhist calendar is identical to the Gregorian calendar in all respects except for the year and era. Years are numbered since the birth of the Buddha in 543 BC (Gregorian), so that 1 AD (Gregorian) is equivalent to 544 BE (Buddhist Era) and 1998 AD is 2541 BE.

The Buddhist Calendar has only one allowable era: BE. If the calendar is not in lenient mode (see setLenient), dates before 1/1/1 BE are rejected with an IllegalArgumentException.

This class should not be subclassed.

BuddhistCalendar usually should be instantiated using Calendar.getInstance(ULocale) passing in a ULocale with the tag "@calendar=buddhist".

Authors:
Laura Werner
Alan Liu
See Also:
Calendar, GregorianCalendar

Field Summary

static int
BE
Constant for the Buddhist Era.

Fields inherited from class com.ibm.icu.util.GregorianCalendar

AD, BC, invertGregorian, isGregorian

Fields inherited from class com.ibm.icu.util.Calendar

AM, AM_PM, APRIL, AUGUST, BASE_FIELD_COUNT, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DOW_LOCAL, DST_OFFSET, EPOCH_JULIAN_DAY, ERA, EXTENDED_YEAR, FEBRUARY, FRIDAY, GREATEST_MINIMUM, HOUR, HOUR_OF_DAY, INTERNALLY_SET, JANUARY, JAN_1_1_JULIAN_DAY, JULIAN_DAY, JULY, JUNE, LEAST_MAXIMUM, MARCH, MAXIMUM, MAX_DATE, MAX_FIELD_COUNT, MAX_JULIAN, MAX_MILLIS, MAY, MILLISECOND, MILLISECONDS_IN_DAY, MINIMUM, MINIMUM_USER_STAMP, MINUTE, MIN_DATE, MIN_JULIAN, MIN_MILLIS, MONDAY, MONTH, NOVEMBER, OCTOBER, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, PM, RESOLVE_REMAP, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, UNSET, WEDNESDAY, WEEKDAY, WEEKEND, WEEKEND_CEASE, WEEKEND_ONSET, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, YEAR_WOY, ZONE_OFFSET

Constructor Summary

BuddhistCalendar()
Constructs a BuddhistCalendar using the current time in the default time zone with the default locale.
BuddhistCalendar(Date date)
Constructs a BuddhistCalendar with the given date set in the default time zone with the default locale.
BuddhistCalendar(Locale aLocale)
Constructs a BuddhistCalendar based on the current time in the default time zone with the given locale.
BuddhistCalendar(TimeZone zone)
Constructs a BuddhistCalendar based on the current time in the given time zone with the default locale.
BuddhistCalendar(TimeZone zone, Locale aLocale)
Constructs a BuddhistCalendar based on the current time in the given time zone with the given locale.
BuddhistCalendar(TimeZone zone, ULocale locale)
Constructs a BuddhistCalendar based on the current time in the given time zone with the given locale.
BuddhistCalendar(ULocale locale)
Constructs a BuddhistCalendar based on the current time in the default time zone with the given locale.
BuddhistCalendar(int year, int month, int date)
Constructs a BuddhistCalendar with the given date set in the default time zone with the default locale.
BuddhistCalendar(int year, int month, int date, int hour, int minute, int second)
Constructs a BuddhistCalendar with the given date and time set for the default time zone with the default locale.

Method Summary

String
getType()
Return the current Calendar type.
protected void
handleComputeFields(int julianDay)
protected int
handleComputeMonthStart(int eyear, int month, boolean useMonth)
protected int
handleGetExtendedYear()
protected int
handleGetLimit(int field, int limitType)
Override GregorianCalendar.

Methods inherited from class com.ibm.icu.util.GregorianCalendar

getActualMaximum, getActualMinimum, getGregorianChange, getType, handleComputeFields, handleComputeJulianDay, handleComputeMonthStart, handleGetExtendedYear, handleGetLimit, handleGetMonthLength, handleGetYearLength, hashCode, isEquivalentTo, isLeapYear, roll, setGregorianChange

Methods inherited from class com.ibm.icu.util.Calendar

add, after, before, clear, clear, clone, compareTo, compareTo, complete, computeFields, computeGregorianFields, computeGregorianMonthStart, computeJulianDay, computeMillisInDay, computeTime, computeZoneOffset, equals, fieldDifference, fieldName, floorDivide, floorDivide, floorDivide, floorDivide, get, getActualMaximum, getActualMinimum, getAvailableLocales, getAvailableULocales, getDateTimeFormat, getDateTimeFormat, getDayOfWeekType, getDisplayName, getDisplayName, getFieldCount, getFieldResolutionTable, getFirstDayOfWeek, getGreatestMinimum, getGregorianDayOfMonth, getGregorianDayOfYear, getGregorianMonth, getGregorianYear, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getLeastMaximum, getLimit, getLocale, getMaximum, getMinimalDaysInFirstWeek, getMinimum, getStamp, getTime, getTimeInMillis, getTimeZone, getType, getWeekendTransition, gregorianMonthLength, gregorianPreviousMonthLength, handleComputeFields, handleComputeJulianDay, handleComputeMonthStart, handleCreateFields, handleGetDateFormat, handleGetDateFormat, handleGetExtendedYear, handleGetLimit, handleGetMonthLength, handleGetYearLength, hashCode, internalGet, internalGet, internalGetTimeInMillis, internalSet, isEquivalentTo, isGregorianLeapYear, isLenient, isSet, isWeekend, isWeekend, julianDayToDayOfWeek, julianDayToMillis, millisToJulianDay, newerField, newestStamp, pinField, prepareGetActual, resolveFields, roll, roll, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, setTimeZone, toString, validateField, validateField, validateFields, weekNumber, weekNumber

Field Details

BE

public static final int BE
Constant for the Buddhist Era. This is the only allowable ERA value for the Buddhist calendar.
Field Value:
0

Constructor Details

BuddhistCalendar

public BuddhistCalendar()
Constructs a BuddhistCalendar using the current time in the default time zone with the default locale.

BuddhistCalendar

public BuddhistCalendar(Date date)
Constructs a BuddhistCalendar with the given date set in the default time zone with the default locale.
Parameters:
date - The date to which the new calendar is set.

BuddhistCalendar

public BuddhistCalendar(Locale aLocale)
Constructs a BuddhistCalendar based on the current time in the default time zone with the given locale.
Parameters:
aLocale - the given locale.

BuddhistCalendar

public BuddhistCalendar(TimeZone zone)
Constructs a BuddhistCalendar based on the current time in the given time zone with the default locale.
Parameters:
zone - the given time zone.

BuddhistCalendar

public BuddhistCalendar(TimeZone zone,
                        Locale aLocale)
Constructs a BuddhistCalendar based on the current time in the given time zone with the given locale.
Parameters:
zone - the given time zone.
aLocale - the given locale.

BuddhistCalendar

public BuddhistCalendar(TimeZone zone,
                        ULocale locale)
Constructs a BuddhistCalendar based on the current time in the given time zone with the given locale.
Parameters:
zone - the given time zone.
locale - the given ulocale.

BuddhistCalendar

public BuddhistCalendar(ULocale locale)
Constructs a BuddhistCalendar based on the current time in the default time zone with the given locale.
Parameters:
locale - the given ulocale.

BuddhistCalendar

public BuddhistCalendar(int year,
                        int month,
                        int date)
Constructs a BuddhistCalendar with the given date set in the default time zone with the default locale.
Parameters:
year - The value used to set the calendar's YEAR time field.
month - The value used to set the calendar's MONTH time field. The value is 0-based. e.g., 0 for January.
date - The value used to set the calendar's DATE time field.

BuddhistCalendar

public BuddhistCalendar(int year,
                        int month,
                        int date,
                        int hour,
                        int minute,
                        int second)
Constructs a BuddhistCalendar with the given date and time set for the default time zone with the default locale.
Parameters:
year - The value used to set the calendar's YEAR time field.
month - The value used to set the calendar's MONTH time field. The value is 0-based. e.g., 0 for January.
date - The value used to set the calendar's DATE time field.
hour - The value used to set the calendar's HOUR_OF_DAY time field.
minute - The value used to set the calendar's MINUTE time field.
second - The value used to set the calendar's SECOND time field.

Method Details

getType

public String getType()
Return the current Calendar type.
Overrides:
getType in interface GregorianCalendar
Returns:
type of calendar (gregorian, etc.)

handleComputeFields

protected void handleComputeFields(int julianDay)
Overrides:
handleComputeFields in interface GregorianCalendar

handleComputeMonthStart

protected int handleComputeMonthStart(int eyear,
                                      int month,
                                      boolean useMonth)
Overrides:
handleComputeMonthStart in interface GregorianCalendar

handleGetExtendedYear

protected int handleGetExtendedYear()
Overrides:
handleGetExtendedYear in interface GregorianCalendar

handleGetLimit

protected int handleGetLimit(int field,
                             int limitType)
Override GregorianCalendar. There is only one Buddhist ERA. We should really handle YEAR, YEAR_WOY, and EXTENDED_YEAR here too to implement the 1..5000000 range, but it's not critical.
Overrides:
handleGetLimit in interface GregorianCalendar

Copyright (c) 2006 IBM Corporation and others.