| java.lang.Object com.ibm.icu.util.Calendar com.ibm.icu.util.HebrewCalendar
HebrewCalendar | public class HebrewCalendar extends Calendar (Code) | | HebrewCalendar is a subclass of Calendar
that that implements the traditional Hebrew calendar.
This is the civil calendar in Israel and the liturgical calendar
of the Jewish faith worldwide.
The Hebrew calendar is lunisolar and thus has a number of interesting
properties that distinguish it from the Gregorian. Months start
on the day of (an arithmetic approximation of) each new moon. Since the
solar year (approximately 365.24 days) is not an even multiple of
the lunar month (approximately 29.53 days) an extra "leap month" is
inserted in 7 out of every 19 years. To make matters even more
interesting, the start of a year can be delayed by up to three days
in order to prevent certain holidays from falling on the Sabbath and
to prevent certain illegal year lengths. Finally, the lengths of certain
months can vary depending on the number of days in the year.
The leap month is known as "Adar 1" and is inserted between the
months of Shevat and Adar in leap years. Since the leap month does
not come at the end of the year, calculations involving
month numbers are particularly complex. Users of this class should
make sure to use the
HebrewCalendar.roll roll and
HebrewCalendar.add add methods
rather than attempting to perform date arithmetic by manipulating
the fields directly.
Note: In the traditional Hebrew calendar, days start at sunset.
However, in order to keep the time fields in this class
synchronized with those of the other calendars and with local clock time,
we treat days and months as beginning at midnight,
roughly 6 hours after the corresponding sunset.
If you are interested in more information on the rules behind the Hebrew
calendar, see one of the following references:
This class should not be subclassed.
HebrewCalendar usually should be instantiated using
com.ibm.icu.util.Calendar.getInstance(ULocale) passing in a ULocale
with the tag "@calendar=hebrew" .
See Also: com.ibm.icu.util.GregorianCalendar See Also: com.ibm.icu.util.Calendar author: Laura Werner author: Alan Liu |
Field Summary | |
final public static int | ADAR Constant for the Adar, the 7th month of the Hebrew year. | final public static int | ADAR_1 Constant for Adar I, the 6th month of the Hebrew year
(present in leap years only). | final public static int | AV Constant for Av, the 12th month of the Hebrew year. | final public static int | ELUL Constant for Elul, the 13th month of the Hebrew year. | final public static int | HESHVAN Constant for Heshvan, the 2nd month of the Hebrew year. | final public static int | IYAR Constant for Iyar, the 9th month of the Hebrew year. | final public static int | KISLEV Constant for Kislev, the 3rd month of the Hebrew year. | final public static int | NISAN Constant for Nisan, the 8th month of the Hebrew year. | final public static int | SHEVAT Constant for Shevat, the 5th month of the Hebrew year. | final public static int | SIVAN Constant for Sivan, the 10th month of the Hebrew year. | final public static int | TAMUZ Constant for Tammuz, the 11th month of the Hebrew year. | final public static int | TEVET Constant for Tevet, the 4th month of the Hebrew year. | final public static int | TISHRI Constant for Tishri, the 1st month of the Hebrew year. |
Constructor Summary | |
public | HebrewCalendar() Constructs a default HebrewCalendar using the current time
in the default time zone with the default locale. | public | HebrewCalendar(TimeZone zone) Constructs a HebrewCalendar based on the current time
in the given time zone with the default locale. | public | HebrewCalendar(Locale aLocale) Constructs a HebrewCalendar based on the current time
in the default time zone with the given locale. | public | HebrewCalendar(ULocale locale) Constructs a HebrewCalendar based on the current time
in the default time zone with the given locale. | public | HebrewCalendar(TimeZone zone, Locale aLocale) Constructs a HebrewCalendar based on the current time
in the given time zone with the given locale. | public | HebrewCalendar(TimeZone zone, ULocale locale) Constructs a HebrewCalendar based on the current time
in the given time zone with the given locale. | public | HebrewCalendar(int year, int month, int date) Constructs a HebrewCalendar with the given date set
in the default time zone with the default locale.
Parameters: year - The value used to set the calendar's HebrewCalendar.YEAR YEAR time field. Parameters: month - The value used to set the calendar's HebrewCalendar.MONTH MONTH time field.The value is 0-based. | public | HebrewCalendar(Date date) Constructs a HebrewCalendar with the given date set
in the default time zone with the default locale. | public | HebrewCalendar(int year, int month, int date, int hour, int minute, int second) Constructs a HebrewCalendar 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 HebrewCalendar.YEAR YEAR time field. Parameters: month - The value used to set the calendar's HebrewCalendar.MONTH MONTH time field.The value is 0-based. |
Method Summary | |
public void | add(int field, int amount) Add a signed amount to a specified field, using this calendar's rules.
For example, to add three days to the current date, you can call
add(Calendar.DATE, 3) . | public String | getType() Return the current Calendar type. | protected void | handleComputeFields(int julianDay) Subclasses may override this method to compute several fields
specific to each calendar system. | protected int | handleComputeMonthStart(int eyear, int month, boolean useMonth) Return JD of start of given month/year. | protected int | handleGetExtendedYear() | protected int | handleGetLimit(int field, int limitType) | protected int | handleGetMonthLength(int extendedYear, int month) | protected int | handleGetYearLength(int eyear) | public void | roll(int field, int amount) Rolls (up/down) a specified amount time on the given field. |
ADAR | final public static int ADAR(Code) | | Constant for the Adar, the 7th month of the Hebrew year.
|
ADAR_1 | final public static int ADAR_1(Code) | | Constant for Adar I, the 6th month of the Hebrew year
(present in leap years only). In non-leap years, the calendar
jumps from Shevat (5th month) to Adar (7th month).
|
AV | final public static int AV(Code) | | Constant for Av, the 12th month of the Hebrew year.
|
ELUL | final public static int ELUL(Code) | | Constant for Elul, the 13th month of the Hebrew year.
|
HESHVAN | final public static int HESHVAN(Code) | | Constant for Heshvan, the 2nd month of the Hebrew year.
|
IYAR | final public static int IYAR(Code) | | Constant for Iyar, the 9th month of the Hebrew year.
|
KISLEV | final public static int KISLEV(Code) | | Constant for Kislev, the 3rd month of the Hebrew year.
|
NISAN | final public static int NISAN(Code) | | Constant for Nisan, the 8th month of the Hebrew year.
|
SHEVAT | final public static int SHEVAT(Code) | | Constant for Shevat, the 5th month of the Hebrew year.
|
SIVAN | final public static int SIVAN(Code) | | Constant for Sivan, the 10th month of the Hebrew year.
|
TAMUZ | final public static int TAMUZ(Code) | | Constant for Tammuz, the 11th month of the Hebrew year.
|
TEVET | final public static int TEVET(Code) | | Constant for Tevet, the 4th month of the Hebrew year.
|
TISHRI | final public static int TISHRI(Code) | | Constant for Tishri, the 1st month of the Hebrew year.
|
HebrewCalendar | public HebrewCalendar()(Code) | | Constructs a default HebrewCalendar using the current time
in the default time zone with the default locale.
|
HebrewCalendar | public HebrewCalendar(TimeZone zone)(Code) | | Constructs a HebrewCalendar based on the current time
in the given time zone with the default locale.
Parameters: zone - The time zone for the new calendar. |
HebrewCalendar | public HebrewCalendar(Locale aLocale)(Code) | | Constructs a HebrewCalendar based on the current time
in the default time zone with the given locale.
Parameters: aLocale - The locale for the new calendar. |
HebrewCalendar | public HebrewCalendar(ULocale locale)(Code) | | Constructs a HebrewCalendar based on the current time
in the default time zone with the given locale.
Parameters: locale - The locale for the new calendar. |
HebrewCalendar | public HebrewCalendar(TimeZone zone, Locale aLocale)(Code) | | Constructs a HebrewCalendar based on the current time
in the given time zone with the given locale.
Parameters: zone - The time zone for the new calendar. Parameters: aLocale - The locale for the new calendar. |
HebrewCalendar | public HebrewCalendar(TimeZone zone, ULocale locale)(Code) | | Constructs a HebrewCalendar based on the current time
in the given time zone with the given locale.
Parameters: zone - The time zone for the new calendar. Parameters: locale - The locale for the new calendar. |
HebrewCalendar | public HebrewCalendar(int year, int month, int date)(Code) | | Constructs a HebrewCalendar with the given date set
in the default time zone with the default locale.
Parameters: year - The value used to set the calendar's HebrewCalendar.YEAR YEAR time field. Parameters: month - The value used to set the calendar's HebrewCalendar.MONTH MONTH time field.The value is 0-based. e.g., 0 for Tishri. Parameters: date - The value used to set the calendar's HebrewCalendar.DATE DATE time field. |
HebrewCalendar | public HebrewCalendar(Date date)(Code) | | Constructs a HebrewCalendar 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. |
HebrewCalendar | public HebrewCalendar(int year, int month, int date, int hour, int minute, int second)(Code) | | Constructs a HebrewCalendar 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 HebrewCalendar.YEAR YEAR time field. Parameters: month - The value used to set the calendar's HebrewCalendar.MONTH MONTH time field.The value is 0-based. e.g., 0 for Tishri. Parameters: date - The value used to set the calendar's HebrewCalendar.DATE DATE time field. Parameters: hour - The value used to set the calendar's HebrewCalendar.HOUR_OF_DAY HOUR_OF_DAY time field. Parameters: minute - The value used to set the calendar's HebrewCalendar.MINUTE MINUTE time field. Parameters: second - The value used to set the calendar's HebrewCalendar.SECOND SECOND time field. |
add | public void add(int field, int amount)(Code) | | Add a signed amount to a specified field, using this calendar's rules.
For example, to add three days to the current date, you can call
add(Calendar.DATE, 3) .
When adding to certain fields, the values of other fields may conflict and
need to be changed. For example, when adding one to the
HebrewCalendar.MONTH MONTH field
for the date "30 Av 5758", the
HebrewCalendar.DAY_OF_MONTH DAY_OF_MONTH field
must be adjusted so that the result is "29 Elul 5758" rather than the invalid
"30 Elul 5758".
This method is able to add to
all fields except for
HebrewCalendar.ERA ERA ,
HebrewCalendar.DST_OFFSET DST_OFFSET ,
and
HebrewCalendar.ZONE_OFFSET ZONE_OFFSET .
Note: You should always use
HebrewCalendar.roll roll and add rather
than attempting to perform arithmetic operations directly on the fields
of a HebrewCalendar. Since the
HebrewCalendar.MONTH MONTH field behaves
discontinuously in non-leap years, simple arithmetic can give invalid results.
Parameters: field - the time field. Parameters: amount - the amount to add to the field. exception: IllegalArgumentException - if the field is invalid or refersto a field that cannot be handled by this method. |
getType | public String getType()(Code) | | Return the current Calendar type.
type of calendar (gregorian, etc.) |
handleComputeFields | protected void handleComputeFields(int julianDay)(Code) | | Subclasses may override this method to compute several fields
specific to each calendar system. These are:
- ERA
- YEAR
- MONTH
- DAY_OF_MONTH
- DAY_OF_YEAR
- EXTENDED_YEAR
Subclasses can refer to the DAY_OF_WEEK and DOW_LOCAL fields,
which will be set when this method is called. Subclasses can
also call the getGregorianXxx() methods to obtain Gregorian
calendar equivalents for the given Julian day.
In addition, subclasses should compute any subclass-specific
fields, that is, fields from BASE_FIELD_COUNT to
getFieldCount() - 1.
|
handleComputeMonthStart | protected int handleComputeMonthStart(int eyear, int month, boolean useMonth)(Code) | | Return JD of start of given month/year.
|
handleGetExtendedYear | protected int handleGetExtendedYear()(Code) | | |
handleGetLimit | protected int handleGetLimit(int field, int limitType)(Code) | | |
handleGetMonthLength | protected int handleGetMonthLength(int extendedYear, int month)(Code) | | Returns the length of the given month in the given year
|
handleGetYearLength | protected int handleGetYearLength(int eyear)(Code) | | Returns the number of days in the given Hebrew year
|
roll | public void roll(int field, int amount)(Code) | | Rolls (up/down) a specified amount time on the given field. For
example, to roll the current date up by three days, you can call
roll(Calendar.DATE, 3) . If the
field is rolled past its maximum allowable value, it will "wrap" back
to its minimum and continue rolling.
For example, calling roll(Calendar.DATE, 10)
on a Hebrew calendar set to "25 Av 5758" will result in the date "5 Av 5758".
When rolling certain fields, the values of other fields may conflict and
need to be changed. For example, when rolling the
HebrewCalendar.MONTH MONTH field
upward by one for the date "30 Av 5758", the
HebrewCalendar.DAY_OF_MONTH DAY_OF_MONTH field
must be adjusted so that the result is "29 Elul 5758" rather than the invalid
"30 Elul".
This method is able to roll
all fields except for
HebrewCalendar.ERA ERA ,
HebrewCalendar.DST_OFFSET DST_OFFSET ,
and
HebrewCalendar.ZONE_OFFSET ZONE_OFFSET . Subclasses may, of course, add support for
additional fields in their overrides of roll .
Note: You should always use roll and
HebrewCalendar.add add rather
than attempting to perform arithmetic operations directly on the fields
of a HebrewCalendar. Since the
HebrewCalendar.MONTH MONTH field behaves
discontinuously in non-leap years, simple arithmetic can give invalid results.
Parameters: field - the time field. Parameters: amount - the amount by which the field should be rolled. exception: IllegalArgumentException - if the field is invalid or refersto a field that cannot be handled by this method. |
Methods inherited from com.ibm.icu.util.Calendar | public void add(int field, int amount)(Code)(Java Doc) public boolean after(Object when)(Code)(Java Doc) public boolean before(Object when)(Code)(Java Doc) final public void clear()(Code)(Java Doc) final public void clear(int field)(Code)(Java Doc) public Object clone()(Code)(Java Doc) public int compareTo(Calendar that)(Code)(Java Doc) public int compareTo(Object that)(Code)(Java Doc) protected void complete()(Code)(Java Doc) protected void computeFields()(Code)(Java Doc) final protected void computeGregorianFields(int julianDay)(Code)(Java Doc) protected int computeGregorianMonthStart(int year, int month)(Code)(Java Doc) protected int computeJulianDay()(Code)(Java Doc) protected int computeMillisInDay()(Code)(Java Doc) protected void computeTime()(Code)(Java Doc) protected int computeZoneOffset(long millis, int millisInDay)(Code)(Java Doc) public boolean equals(Object obj)(Code)(Java Doc) public int fieldDifference(Date when, int field)(Code)(Java Doc) protected String fieldName(int field)(Code)(Java Doc) final protected static long floorDivide(long numerator, long denominator)(Code)(Java Doc) final protected static int floorDivide(int numerator, int denominator)(Code)(Java Doc) final protected static int floorDivide(int numerator, int denominator, int[] remainder)(Code)(Java Doc) final protected static int floorDivide(long numerator, int denominator, int[] remainder)(Code)(Java Doc) final public int get(int field)(Code)(Java Doc) public int getActualMaximum(int field)(Code)(Java Doc) public int getActualMinimum(int field)(Code)(Java Doc) public static Locale[] getAvailableLocales()(Code)(Java Doc) public static ULocale[] getAvailableULocales()(Code)(Java Doc) static Set getCalendarFactoryNames()(Code)(Java Doc) public DateFormat getDateTimeFormat(int dateStyle, int timeStyle, Locale loc)(Code)(Java Doc) public DateFormat getDateTimeFormat(int dateStyle, int timeStyle, ULocale loc)(Code)(Java Doc) public int getDayOfWeekType(int dayOfWeek)(Code)(Java Doc) protected int getDefaultDayInMonth(int extendedYear, int month)(Code)(Java Doc) protected int getDefaultMonthInYear(int extendedYear)(Code)(Java Doc) public String getDisplayName(Locale loc)(Code)(Java Doc) public String getDisplayName(ULocale loc)(Code)(Java Doc) final public int getFieldCount()(Code)(Java Doc) protected int[][][] getFieldResolutionTable()(Code)(Java Doc) public int getFirstDayOfWeek()(Code)(Java Doc) final public int getGreatestMinimum(int field)(Code)(Java Doc) final protected int getGregorianDayOfMonth()(Code)(Java Doc) final protected int getGregorianDayOfYear()(Code)(Java Doc) final protected int getGregorianMonth()(Code)(Java Doc) final protected int getGregorianYear()(Code)(Java Doc) public static synchronized Calendar getInstance()(Code)(Java Doc) public static synchronized Calendar getInstance(TimeZone zone)(Code)(Java Doc) public static synchronized Calendar getInstance(Locale aLocale)(Code)(Java Doc) public static synchronized Calendar getInstance(ULocale locale)(Code)(Java Doc) public static synchronized Calendar getInstance(TimeZone zone, Locale aLocale)(Code)(Java Doc) public static synchronized Calendar getInstance(TimeZone zone, ULocale locale)(Code)(Java Doc) static synchronized Calendar getInstance(TimeZone zone, ULocale locale, String factoryName)(Code)(Java Doc) final public int getLeastMaximum(int field)(Code)(Java Doc) protected int getLimit(int field, int limitType)(Code)(Java Doc) final public ULocale getLocale(ULocale.Type type)(Code)(Java Doc) final public int getMaximum(int field)(Code)(Java Doc) public int getMinimalDaysInFirstWeek()(Code)(Java Doc) final public int getMinimum(int field)(Code)(Java Doc) final protected int getStamp(int field)(Code)(Java Doc) final public Date getTime()(Code)(Java Doc) public long getTimeInMillis()(Code)(Java Doc) public TimeZone getTimeZone()(Code)(Java Doc) public String getType()(Code)(Java Doc) public int getWeekendTransition(int dayOfWeek)(Code)(Java Doc) final protected static int gregorianMonthLength(int y, int m)(Code)(Java Doc) final protected static int gregorianPreviousMonthLength(int y, int m)(Code)(Java Doc) protected void handleComputeFields(int julianDay)(Code)(Java Doc) protected int handleComputeJulianDay(int bestField)(Code)(Java Doc) abstract protected int handleComputeMonthStart(int eyear, int month, boolean useMonth)(Code)(Java Doc) protected int[] handleCreateFields()(Code)(Java Doc) protected DateFormat handleGetDateFormat(String pattern, Locale locale)(Code)(Java Doc) protected DateFormat handleGetDateFormat(String pattern, ULocale locale)(Code)(Java Doc) abstract protected int handleGetExtendedYear()(Code)(Java Doc) abstract protected int handleGetLimit(int field, int limitType)(Code)(Java Doc) protected int handleGetMonthLength(int extendedYear, int month)(Code)(Java Doc) protected int handleGetYearLength(int eyear)(Code)(Java Doc) public int hashCode()(Code)(Java Doc) final protected int internalGet(int field)(Code)(Java Doc) final protected int internalGet(int field, int defaultValue)(Code)(Java Doc) final protected long internalGetTimeInMillis()(Code)(Java Doc) final protected void internalSet(int field, int value)(Code)(Java Doc) public boolean isEquivalentTo(Calendar other)(Code)(Java Doc) final protected static boolean isGregorianLeapYear(int year)(Code)(Java Doc) public boolean isLenient()(Code)(Java Doc) final public boolean isSet(int field)(Code)(Java Doc) public boolean isWeekend(Date date)(Code)(Java Doc) public boolean isWeekend()(Code)(Java Doc) final protected static int julianDayToDayOfWeek(int julian)(Code)(Java Doc) final protected static long julianDayToMillis(int julian)(Code)(Java Doc) final protected static int millisToJulianDay(long millis)(Code)(Java Doc) protected int newerField(int defaultField, int alternateField)(Code)(Java Doc) protected int newestStamp(int first, int last, int bestStampSoFar)(Code)(Java Doc) protected void pinField(int field)(Code)(Java Doc) protected void prepareGetActual(int field, boolean isMinimum)(Code)(Java Doc) static Object register(CalendarFactory factory, ULocale locale)(Code)(Java Doc) static Object register(CalendarFactory factory, ULocale locale, boolean visible)(Code)(Java Doc) protected int resolveFields(int[][][] precedenceTable)(Code)(Java Doc) final public void roll(int field, boolean up)(Code)(Java Doc) public void roll(int field, int amount)(Code)(Java Doc) final public void set(int field, int value)(Code)(Java Doc) final public void set(int year, int month, int date)(Code)(Java Doc) final public void set(int year, int month, int date, int hour, int minute)(Code)(Java Doc) final public void set(int year, int month, int date, int hour, int minute, int second)(Code)(Java Doc) public void setFirstDayOfWeek(int value)(Code)(Java Doc) public void setLenient(boolean lenient)(Code)(Java Doc) final void setLocale(ULocale valid, ULocale actual)(Code)(Java Doc) public void setMinimalDaysInFirstWeek(int value)(Code)(Java Doc) final public void setTime(Date date)(Code)(Java Doc) public void setTimeInMillis(long millis)(Code)(Java Doc) public void setTimeZone(TimeZone value)(Code)(Java Doc) public String toString()(Code)(Java Doc) static boolean unregister(Object registryKey)(Code)(Java Doc) protected void validateField(int field)(Code)(Java Doc) final protected void validateField(int field, int min, int max)(Code)(Java Doc) protected void validateFields()(Code)(Java Doc) protected int weekNumber(int desiredDay, int dayOfPeriod, int dayOfWeek)(Code)(Java Doc) final protected int weekNumber(int dayOfPeriod, int dayOfWeek)(Code)(Java Doc)
|
|
|