Class HebrewCalendar
java.lang.Object
org.episteme.social.history.calendars.AlternateCalendar
org.episteme.social.history.calendars.SevenDaysWeek
org.episteme.social.history.calendars.MonthDayYear
org.episteme.social.history.calendars.HebrewCalendar
- All Implemented Interfaces:
Serializable
Implementation of the Hebrew (Jewish) calendar.
The Hebrew calendar is a lunisolar calendar used for Jewish religious observances.
It incorporates both lunar months and a solar year through a 19-year Metonic cycle.
Key features:
- Epoch: October 7, 3761 BCE (Julian) - the traditional date of Creation
- Uses a 19-year cycle with 7 leap years (years 3, 6, 8, 11, 14, 17, 19)
- Months alternate between 29 and 30 days, with adjustments
- Years can be deficient (353/383), regular (354/384), or complete (355/385)
- Years are marked with "A.M." (Anno Mundi)
The month Adar becomes Adar I in leap years, with Adar II added after it.
* @version 2.0- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final longThe Hebrew epoch: October 7, 3761 BCE (Julian calendar).Fields inherited from class MonthDayYear
day, month, yearFields inherited from class SevenDaysWeek
DAY_NAMES, FRIDAY, MONDAY, SATURDAY, SUNDAY, THURSDAY, TUESDAY, WEDNESDAYFields inherited from class AlternateCalendar
JD_EPOCH, rd, unicode -
Constructor Summary
ConstructorsConstructorDescriptionCreates a Hebrew calendar set to the epoch (1 Tishri, 1 AM).HebrewCalendar(int year, int month, int day) Creates a Hebrew calendar set to the specified date.HebrewCalendar(long rataDie) Creates a Hebrew calendar set to the specified Rata Die.HebrewCalendar(AlternateCalendar calendar) Creates a Hebrew calendar from another calendar's date. -
Method Summary
Modifier and TypeMethodDescriptionprotected static intdaysInYear(int year) Returns the total number of days in the specified Hebrew year.protected static intdelay(int year) Calculates the year-type delay adjustment.protected static longelapsedDays(int year) Calculates the number of elapsed days from the epoch to the start of the specified year.Returns an enumeration of month names.protected StringReturns the era suffix for display.static booleanisLeapYear(int year) Determines if the specified year is a leap year in the Hebrew calendar.protected static intlastDay(int month, int year) Returns the number of days in the specified month of the specified year.static intlastMonth(int year) Returns the last month of the specified year (12 or 13 for leap years).protected static booleanlongHeshvan(int year) Determines if Heshvan is long (30 days) in the specified year.protected StringReturns the name of the current month.protected voidRecomputes the year, month, and day fields from the current Rata Die.protected voidRecomputes the Rata Die from the current year, month, and day fields.voidset(long rataDie) Sets this calendar to the specified Rata Die and recomputes the date fields.protected static booleanshortKislev(int year) Determines if Kislev is short (29 days) in the specified year.Methods inherited from class SevenDaysWeek
kDayAfter, kDayBefore, kDayNearest, kDayOnOrAfter, kDayOnOrBefore, nthKDay, weekDay, weekDayNameMethods inherited from class AlternateCalendar
add, amod, difference, difference, floorDiv, fromJD, isAfter, isBefore, mod, mod, subtract, toJD, toJD, toRD
-
Field Details
-
EPOCH
protected static final long EPOCHThe Hebrew epoch: October 7, 3761 BCE (Julian calendar).
-
-
Constructor Details
-
HebrewCalendar
public HebrewCalendar()Creates a Hebrew calendar set to the epoch (1 Tishri, 1 AM). -
HebrewCalendar
public HebrewCalendar(long rataDie) Creates a Hebrew calendar set to the specified Rata Die.- Parameters:
rataDie- the day number
-
HebrewCalendar
public HebrewCalendar(int year, int month, int day) Creates a Hebrew calendar set to the specified date.- Parameters:
year- the Hebrew year (Anno Mundi)month- the month (1=Nisan, 7=Tishri)day- the day of month (1-30)
-
HebrewCalendar
Creates a Hebrew calendar from another calendar's date.- Parameters:
calendar- the source calendar
-
-
Method Details
-
isLeapYear
public static boolean isLeapYear(int year) Determines if the specified year is a leap year in the Hebrew calendar. Years 3, 6, 8, 11, 14, 17, and 19 of each 19-year cycle are leap years.- Parameters:
year- the Hebrew year- Returns:
- true if it's a leap year
-
lastMonth
public static int lastMonth(int year) Returns the last month of the specified year (12 or 13 for leap years).- Parameters:
year- the Hebrew year- Returns:
- 12 for regular years, 13 for leap years
-
elapsedDays
protected static long elapsedDays(int year) Calculates the number of elapsed days from the epoch to the start of the specified year.- Parameters:
year- the Hebrew year- Returns:
- days elapsed
-
delay
protected static int delay(int year) Calculates the year-type delay adjustment.- Parameters:
year- the Hebrew year- Returns:
- delay in days (0, 1, or 2)
-
lastDay
protected static int lastDay(int month, int year) Returns the number of days in the specified month of the specified year.- Parameters:
month- the month (1-13)year- the Hebrew year- Returns:
- days in month (29 or 30)
-
longHeshvan
protected static boolean longHeshvan(int year) Determines if Heshvan is long (30 days) in the specified year.- Parameters:
year- the Hebrew year- Returns:
- true if Heshvan has 30 days
-
shortKislev
protected static boolean shortKislev(int year) Determines if Kislev is short (29 days) in the specified year.- Parameters:
year- the Hebrew year- Returns:
- true if Kislev has 29 days
-
daysInYear
protected static int daysInYear(int year) Returns the total number of days in the specified Hebrew year.- Parameters:
year- the Hebrew year- Returns:
- days in year (353, 354, 355, 383, 384, or 385)
-
recomputeRD
protected void recomputeRD()Recomputes the Rata Die from the current year, month, and day fields.- Specified by:
recomputeRDin classAlternateCalendar
-
recomputeFromRD
protected void recomputeFromRD()Recomputes the year, month, and day fields from the current Rata Die.- Specified by:
recomputeFromRDin classAlternateCalendar
-
set
public void set(long rataDie) Sets this calendar to the specified Rata Die and recomputes the date fields.- Specified by:
setin classAlternateCalendar- Parameters:
rataDie- the new Rata Die value
-
monthName
Returns the name of the current month.- Specified by:
monthNamein classMonthDayYear- Returns:
- the month name
-
getSuffix
Returns the era suffix for display.- Specified by:
getSuffixin classMonthDayYear- Returns:
- " A.M." (Anno Mundi)
-
getMonths
Returns an enumeration of month names.- Specified by:
getMonthsin classMonthDayYear- Returns:
- month names enumeration
-