Class HebrewCalendar

All Implemented Interfaces:
Serializable

public class HebrewCalendar extends MonthDayYear
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 Details

    • EPOCH

      protected static final long EPOCH
      The 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

      public HebrewCalendar(AlternateCalendar calendar)
      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:
      recomputeRD in class AlternateCalendar
    • recomputeFromRD

      protected void recomputeFromRD()
      Recomputes the year, month, and day fields from the current Rata Die.
      Specified by:
      recomputeFromRD in class AlternateCalendar
    • set

      public void set(long rataDie)
      Sets this calendar to the specified Rata Die and recomputes the date fields.
      Specified by:
      set in class AlternateCalendar
      Parameters:
      rataDie - the new Rata Die value
    • monthName

      protected String monthName()
      Returns the name of the current month.
      Specified by:
      monthName in class MonthDayYear
      Returns:
      the month name
    • getSuffix

      protected String getSuffix()
      Returns the era suffix for display.
      Specified by:
      getSuffix in class MonthDayYear
      Returns:
      " A.M." (Anno Mundi)
    • getMonths

      public Enumeration<String> getMonths()
      Returns an enumeration of month names.
      Specified by:
      getMonths in class MonthDayYear
      Returns:
      month names enumeration