From fbf7a3a45cc72d88bfa05379227789e1d787eded Mon Sep 17 00:00:00 2001 From: Ely Date: Thu, 22 Aug 2024 01:26:59 -0400 Subject: [PATCH] add support for safek mukaf choma --- .../zmanim/hebrewcalendar/JewishCalendar.java | 42 +++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java b/src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java index acc987f2..99264183 100644 --- a/src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java +++ b/src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java @@ -162,6 +162,13 @@ public class JewishCalendar extends JewishDate { */ private boolean isMukafChoma = false; + /** + * Is the calendar set to have a safek (doubtful) Purim demukafim, where Purim is celebrated (mainly) on the 14th and the 15th of Adar. + * @see #getIsSafekMukafChoma() + * @see #setIsSafekMukafChoma(boolean) + */ + private boolean isSafekMukafChoma = false; + /** * Is the calendar set to use modern Israeli holidays such as Yom Haatzmaut. * @see #isUseModernHolidays() @@ -368,6 +375,30 @@ public boolean getIsMukafChoma() { public void setIsMukafChoma(boolean isMukafChoma) { this.isMukafChoma = isMukafChoma; } + + + /** + * Returns if the city is set as a city that may have been surrounded by a wall from the time of Yehoshua, and + * Shushan Purim should be celebrated as well as regular Purim. + * @return if the city is set as a city that may have been surrounded by a wall from the time of Yehoshua, and + * Shushan Purim should be celebrated as well as regular Purim. + * @see #setIsSafekMukafChoma(boolean) + */ + public boolean getIsSafekMukafChoma() { + return isSafekMukafChoma; + } + + /** + * Sets if the location may have been surrounded by a wall from the time of Yehoshua, and Shushan Purim should be + * celebrated as well as regular Purim. This can be set for Baghdad Iraq, or other cities around the world that + * have the status of a "Safek Mukaf Choma". There are multiple cities in Israel that have this status. + * The exception being Yerushalayim. + * @param isSafekMukafChoma if the city may have been surrounded by a wall from the time of Yehoshua. + * @see #getIsSafekMukafChoma() + */ + public void setIsSafekMukafChoma(boolean isSafekMukafChoma) { + this.isSafekMukafChoma = isSafekMukafChoma; + } /** * Birkas Hachamah is recited every 28 years based on @@ -1146,15 +1177,20 @@ public boolean isChanukah() { /** * Returns if the day is Purim (Shushan Purim - * in a mukaf choma and regular Purim in a non-mukaf choma). - * @return if the day is Purim (Shushan Purim in a mukaf choma and regular Purim in a non-mukaf choma) - * + * in a mukaf choma and regular Purim in a non-mukaf choma. On both days if {@link #setIsSafekMukafChoma(boolean)} is true). + * @return if the day is Purim (Shushan Purim in a mukaf choma and regular Purim in a non-mukaf choma or on both days + * if {@link #setIsSafekMukafChoma(boolean)} is true) + * * @see #getIsMukafChoma() * @see #setIsMukafChoma(boolean) + * @see #getIsSafekMukafChoma() + * @see #setIsSafekMukafChoma(boolean) */ public boolean isPurim() { if (isMukafChoma) { return getYomTovIndex() == SHUSHAN_PURIM; + } else if (isSafekMukafChoma) { + return getYomTovIndex() == PURIM || getYomTovIndex() == SHUSHAN_PURIM; } else { return getYomTovIndex() == PURIM; }