@@ -155,6 +155,13 @@ public class JewishCalendar extends JewishDate {
155155 */
156156 private boolean inIsrael = false ;
157157
158+ /**
159+ * Is the calendar set to have Purim <em>demukafim</em>, where Purim is celebrated on Shushan Purim.
160+ * @see #getIsMukafChoma()
161+ * @see #setIsMukafChoma(boolean)
162+ */
163+ private boolean isMukafChoma = false ;
164+
158165 /**
159166 * Is the calendar set to use modern Israeli holidays such as Yom Haatzmaut.
160167 * @see #isUseModernHolidays()
@@ -335,6 +342,28 @@ public boolean getInIsrael() {
335342 return inIsrael ;
336343 }
337344
345+ /**
346+ * Returns if the city is set as a city surrounded by a wall from the time of Yehoshua, and Shushan Purim
347+ * should be celebrated as opposed to regular Purim.
348+ * @return if the city is set as a city surrounded by a wall from the time of Yehoshua, and Shushan Purim
349+ * should be celebrated as opposed to regular Purim.
350+ * @see #setIsMukafChoma(boolean)
351+ */
352+ public boolean getIsMukafChoma () {
353+ return isMukafChoma ;
354+ }
355+
356+ /**
357+ * Sets if the location is surrounded by a wall from the time of Yehoshua, and Shushan Purim should be
358+ * celebrated as opposed to regular Purim. This should be set for Yerushalayim, Shushan and other cities.
359+ * @param isMukafChoma is the city surrounded by a wall from the time of Yehoshua.
360+ *
361+ * @see #getIsMukafChoma()
362+ */
363+ public void setIsMukafChoma (boolean isMukafChoma ) {
364+ this .isMukafChoma = isMukafChoma ;
365+ }
366+
338367 /**
339368 * <a href="https://en.wikipedia.org/wiki/Birkat_Hachama">Birkas Hachamah</a> is recited every 28 years based on
340369 * <em>Tekufas Shmuel</em> (Julian years) that a year is 365.25 days. The <a href="https://en.wikipedia.org/wiki/Maimonides"
@@ -495,7 +524,6 @@ public Parsha getUpcomingParshah() {
495524 return clone .getParshah ();
496525 }
497526
498-
499527 /**
500528 * Returns a {@link Parsha <em>Parsha</em>} enum if the <em>Shabbos</em> is one of the four <em>parshiyos</em> of {@link
501529 * Parsha#SHKALIM <em>Shkalim</em>}, {@link Parsha#ZACHOR <em>Zachor</em>}, {@link Parsha#PARA <em>Para</em>}, {@link
@@ -819,31 +847,124 @@ public boolean isErevYomTovSheni() {
819847 public boolean isAseresYemeiTeshuva () {
820848 return getJewishMonth () == TISHREI && getJewishDayOfMonth () <= 10 ;
821849 }
822-
850+
823851 /**
824- * Returns true if the current day is <em>Chol Hamoed< /em> of <em>Pesach</em> or <em>Succos </em>.
852+ * Returns true if the current day is <em>Pesach</em> (either the <em>Yom Tov< /em> of <em>Pesach</em> or<em>Chol Hamoed Pesach </em>) .
825853 *
826- * @return true if the current day is <em>Chol Hamoed< /em> of <em>Pesach</em> or <em>Succos </em>
854+ * @return true if the current day is <em>Pesach</em> (either the <em>Yom Tov< /em> of <em>Pesach</em> or<em>Chol Hamoed Pesach </em>).
827855 * @see #isYomTov()
856+ * @see #isCholHamoedPesach()
857+ * @see #PESACH
828858 * @see #CHOL_HAMOED_PESACH
829- * @see #CHOL_HAMOED_SUCCOS
830859 */
831- public boolean isCholHamoed () {
832- return isCholHamoedPesach () || isCholHamoedSuccos ();
860+ public boolean isPesach () {
861+ int holidayIndex = getYomTovIndex ();
862+ return holidayIndex == PESACH || holidayIndex == CHOL_HAMOED_PESACH ;
833863 }
834-
864+
835865 /**
836866 * Returns true if the current day is <em>Chol Hamoed</em> of <em>Pesach</em>.
837867 *
838868 * @return true if the current day is <em>Chol Hamoed</em> of <em>Pesach</em>
839869 * @see #isYomTov()
870+ * @see #isPesach()
840871 * @see #CHOL_HAMOED_PESACH
841872 */
842873 public boolean isCholHamoedPesach () {
843874 int holidayIndex = getYomTovIndex ();
844875 return holidayIndex == CHOL_HAMOED_PESACH ;
845876 }
846-
877+
878+ /**
879+ * Returns true if the current day is <em>Shavuos</em>.
880+ *
881+ * @return true if the current day is <em>Shavuos</em>.
882+ * @see #isYomTov()
883+ * @see #SHAVUOS
884+ */
885+ public boolean isShavuos () {
886+ int holidayIndex = getYomTovIndex ();
887+ return holidayIndex == SHAVUOS ;
888+ }
889+
890+ /**
891+ * Returns true if the current day is <em>Rosh Hashana</em>.
892+ *
893+ * @return true if the current day is <em>Rosh Hashana</em>.
894+ * @see #isYomTov()
895+ * @see #ROSH_HASHANA
896+ */
897+ public boolean isRoshHashana () {
898+ int holidayIndex = getYomTovIndex ();
899+ return holidayIndex == ROSH_HASHANA ;
900+ }
901+
902+ /**
903+ * Returns true if the current day is <em>Yom Kippur</em>.
904+ *
905+ * @return true if the current day is <em>Yom Kippur</em>.
906+ * @see #isYomTov()
907+ * @see #YOM_KIPPUR
908+ */
909+ public boolean isYomKippur () {
910+ int holidayIndex = getYomTovIndex ();
911+ return holidayIndex == YOM_KIPPUR ;
912+ }
913+
914+ /**
915+ * Returns true if the current day is <em>Succos</em> (either the <em>Yom Tov</em> of <em>Succos</em> or<em>Chol Hamoed Succos</em>).
916+ * It will return false for {@link #isShminiAtzeres() Shmini Atzeres} and {@link #isSimchasTorah() Simchas Torah}.
917+ *
918+ * @return true if the current day is <em>Succos</em> (either the <em>Yom Tov</em> of <em>Succos</em> or<em>Chol Hamoed Succos</em>.
919+ * @see #isYomTov()
920+ * @see #isCholHamoedSuccos()
921+ * @see #isHoshanaRabba()
922+ * @see #SUCCOS
923+ * @see #CHOL_HAMOED_SUCCOS
924+ * @see #HOSHANA_RABBA
925+ */
926+ public boolean isSuccos () {
927+ int holidayIndex = getYomTovIndex ();
928+ return holidayIndex == SUCCOS || holidayIndex == CHOL_HAMOED_SUCCOS || holidayIndex == HOSHANA_RABBA ;
929+ }
930+
931+ /**
932+ * Returns true if the current day is <em>Hoshana Rabba</em>.
933+ *
934+ * @return true true if the current day is <em>Hoshana Rabba</em>.
935+ * @see #isYomTov()
936+ * @see #HOSHANA_RABBA
937+ */
938+ public boolean isHoshanaRabba () {
939+ int holidayIndex = getYomTovIndex ();
940+ return holidayIndex == HOSHANA_RABBA ;
941+ }
942+
943+ /**
944+ * Returns true if the current day is <em>Shmini Atzeres</em>.
945+ *
946+ * @return true if the current day is <em>Shmini Atzeres</em>.
947+ * @see #isYomTov()
948+ * @see #SHEMINI_ATZERES
949+ */
950+ public boolean isShminiAtzeres () {
951+ int holidayIndex = getYomTovIndex ();
952+ return holidayIndex == SHEMINI_ATZERES ;
953+ }
954+
955+ /**
956+ * Returns true if the current day is <em>Simchas Torah</em>. This will always return false if {@link #getInIsrael() in Israel}
957+ *
958+ * @return true if the current day is <em>Shmini Atzeres</em>.
959+ * @see #isYomTov()
960+ * @see #SIMCHAS_TORAH
961+ */
962+ public boolean isSimchasTorah () {
963+ int holidayIndex = getYomTovIndex ();
964+ //if in Israel, Holiday index of SIMCHAS_TORAH will not be returned by getYomTovIndex()
965+ return holidayIndex == SIMCHAS_TORAH ;
966+ }
967+
847968 /**
848969 * Returns true if the current day is <em>Chol Hamoed</em> of <em>Succos</em>.
849970 *
@@ -853,7 +974,19 @@ public boolean isCholHamoedPesach() {
853974 */
854975 public boolean isCholHamoedSuccos () {
855976 int holidayIndex = getYomTovIndex ();
856- return holidayIndex == CHOL_HAMOED_SUCCOS ;
977+ return holidayIndex == CHOL_HAMOED_SUCCOS || holidayIndex == HOSHANA_RABBA ;
978+ }
979+
980+ /**
981+ * Returns true if the current day is <em>Chol Hamoed</em> of <em>Pesach</em> or <em>Succos</em>.
982+ *
983+ * @return true if the current day is <em>Chol Hamoed</em> of <em>Pesach</em> or <em>Succos</em>
984+ * @see #isYomTov()
985+ * @see #CHOL_HAMOED_PESACH
986+ * @see #CHOL_HAMOED_SUCCOS
987+ */
988+ public boolean isCholHamoed () {
989+ return isCholHamoedPesach () || isCholHamoedSuccos ();
857990 }
858991
859992 /**
@@ -989,6 +1122,22 @@ public int getDayOfChanukah() {
9891122 public boolean isChanukah () {
9901123 return getYomTovIndex () == CHANUKAH ;
9911124 }
1125+
1126+ /**
1127+ * Returns if the day is Purim (<a href="https://en.wikipedia.org/wiki/Purim#Shushan_Purim">Shushan Purim</a>
1128+ * in a mukaf choma and regular Purim in a non-mukaf choma).
1129+ * @return if the day is Purim (Shushan Purim in a mukaf choma and regular Purin in a non-mukaf choma)
1130+ *
1131+ * @see #getIsMukafChoma()
1132+ * @see #setIsMukafChoma(boolean)
1133+ */
1134+ public boolean isPurim () {
1135+ if (isMukafChoma ) {
1136+ return getYomTovIndex () == SHUSHAN_PURIM ;
1137+ } else {
1138+ return getYomTovIndex () == PURIM ;
1139+ }
1140+ }
9921141
9931142 /**
9941143 * Returns if the day is Rosh Chodesh. Rosh Hashana will return false
@@ -1041,6 +1190,15 @@ public int getDayOfOmer() {
10411190 }
10421191 return omer ;
10431192 }
1193+
1194+ /**
1195+ * Returns if the day is Tisha Be'Av (the 9th of Av).
1196+ * @return if the day is Tisha Be'Av (the 9th of Av).
1197+ */
1198+ public boolean isTishaBav () {
1199+ int holidayIndex = getYomTovIndex ();
1200+ return holidayIndex == TISHA_BEAV ;
1201+ }
10441202
10451203 /**
10461204 * Returns the <em>molad</em> in Standard Time in Yerushalayim as a Date. The traditional calculation uses local time.
0 commit comments