Class IslamicCalendar
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.IslamicCalendar
- All Implemented Interfaces:
Serializable
Implementation of the Islamic (Hijri) calendar using the tabular arithmetic method.
The Islamic calendar is a purely lunar calendar with 12 months alternating between
29 and 30 days, resulting in either 354 or 355 days per year.
Key features:
- Epoch: July 16, 622 CE (Julian) - the Hijra of Prophet Muhammad
- Uses a 30-year cycle with 11 leap years (years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29)
- Months alternate between 29 and 30 days
- Years are marked with "A.H." (Anno Hegirae)
Note: This is the tabular/arithmetic Islamic calendar. The actual religious calendar may differ as it is based on lunar observation.
* @version 2.0- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic longThe Islamic epoch: July 16, 622 CE (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 an Islamic calendar set to the epoch (1 Muharram, 1 AH).IslamicCalendar(int year, int month, int day) Creates an Islamic calendar set to the specified date.IslamicCalendar(long rataDie) Creates an Islamic calendar set to the specified Rata Die.IslamicCalendar(AlternateCalendar calendar) Creates an Islamic calendar from another calendar's date. -
Method Summary
Modifier and TypeMethodDescriptionReturns 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 Islamic calendar.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.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
public static long EPOCHThe Islamic epoch: July 16, 622 CE (Julian calendar).
-
-
Constructor Details
-
IslamicCalendar
public IslamicCalendar()Creates an Islamic calendar set to the epoch (1 Muharram, 1 AH). -
IslamicCalendar
public IslamicCalendar(long rataDie) Creates an Islamic calendar set to the specified Rata Die.- Parameters:
rataDie- the day number
-
IslamicCalendar
public IslamicCalendar(int year, int month, int day) Creates an Islamic calendar set to the specified date.- Parameters:
year- the Hijri yearmonth- the month (1-12)day- the day of month (1-30)
-
IslamicCalendar
Creates an Islamic calendar from another calendar's date.- Parameters:
calendar- the source calendar
-
-
Method Details
-
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
-
isLeapYear
public static boolean isLeapYear(int year) Determines if the specified year is a leap year in the Islamic calendar. Leap years in the 30-year cycle are: 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29.- Parameters:
year- the Hijri year- Returns:
- true if it's a leap year
-
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.H." (Anno Hegirae)
-
getMonths
Returns an enumeration of month names.- Specified by:
getMonthsin classMonthDayYear- Returns:
- month names enumeration
-