@@ -155,6 +155,13 @@ public class JewishCalendar extends JewishDate {
155
155
*/
156
156
private boolean inIsrael = false ;
157
157
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
+
158
165
/**
159
166
* Is the calendar set to use modern Israeli holidays such as Yom Haatzmaut.
160
167
* @see #isUseModernHolidays()
@@ -335,6 +342,28 @@ public boolean getInIsrael() {
335
342
return inIsrael ;
336
343
}
337
344
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
+
338
367
/**
339
368
* <a href="https://en.wikipedia.org/wiki/Birkat_Hachama">Birkas Hachamah</a> is recited every 28 years based on
340
369
* <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() {
495
524
return clone .getParshah ();
496
525
}
497
526
498
-
499
527
/**
500
528
* Returns a {@link Parsha <em>Parsha</em>} enum if the <em>Shabbos</em> is one of the four <em>parshiyos</em> of {@link
501
529
* 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() {
819
847
public boolean isAseresYemeiTeshuva () {
820
848
return getJewishMonth () == TISHREI && getJewishDayOfMonth () <= 10 ;
821
849
}
822
-
850
+
823
851
/**
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>) .
825
853
*
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>).
827
855
* @see #isYomTov()
856
+ * @see #isCholHamoedPesach()
857
+ * @see #PESACH
828
858
* @see #CHOL_HAMOED_PESACH
829
- * @see #CHOL_HAMOED_SUCCOS
830
859
*/
831
- public boolean isCholHamoed () {
832
- return isCholHamoedPesach () || isCholHamoedSuccos ();
860
+ public boolean isPesach () {
861
+ int holidayIndex = getYomTovIndex ();
862
+ return holidayIndex == PESACH || holidayIndex == CHOL_HAMOED_PESACH ;
833
863
}
834
-
864
+
835
865
/**
836
866
* Returns true if the current day is <em>Chol Hamoed</em> of <em>Pesach</em>.
837
867
*
838
868
* @return true if the current day is <em>Chol Hamoed</em> of <em>Pesach</em>
839
869
* @see #isYomTov()
870
+ * @see #isPesach()
840
871
* @see #CHOL_HAMOED_PESACH
841
872
*/
842
873
public boolean isCholHamoedPesach () {
843
874
int holidayIndex = getYomTovIndex ();
844
875
return holidayIndex == CHOL_HAMOED_PESACH ;
845
876
}
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
+
847
968
/**
848
969
* Returns true if the current day is <em>Chol Hamoed</em> of <em>Succos</em>.
849
970
*
@@ -853,7 +974,19 @@ public boolean isCholHamoedPesach() {
853
974
*/
854
975
public boolean isCholHamoedSuccos () {
855
976
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 ();
857
990
}
858
991
859
992
/**
@@ -989,6 +1122,22 @@ public int getDayOfChanukah() {
989
1122
public boolean isChanukah () {
990
1123
return getYomTovIndex () == CHANUKAH ;
991
1124
}
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
+ }
992
1141
993
1142
/**
994
1143
* Returns if the day is Rosh Chodesh. Rosh Hashana will return false
@@ -1041,6 +1190,15 @@ public int getDayOfOmer() {
1041
1190
}
1042
1191
return omer ;
1043
1192
}
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
+ }
1044
1202
1045
1203
/**
1046
1204
* Returns the <em>molad</em> in Standard Time in Yerushalayim as a Date. The traditional calculation uses local time.
0 commit comments