Skip to content

Commit 81bed16

Browse files
authored
Add Isru Chag and Deprecate Tefila Rule Methods
The deprecated methods are now part of the new TefilaRules class.
1 parent dc7d330 commit 81bed16

File tree

1 file changed

+54
-4
lines changed

1 file changed

+54
-4
lines changed

src/main/java/com/kosherjava/zmanim/hebrewcalendar/JewishCalendar.java

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Zmanim Java API
3-
* Copyright (C) 2011 - 2021 Eliyahu Hershfeld
3+
* Copyright (C) 2011 - 2022 Eliyahu Hershfeld
44
* Copyright (C) September 2002 Avrom Finkelstien
55
* Copyright (C) 2019 - 2021 Y Paritcher
66
*
@@ -35,15 +35,14 @@
3535
*
3636
* @todo Some do not belong in this class, but here is a partial list of what should still be implemented in some form:
3737
* <ol>
38-
* <li>Add Isru Chag</li>
3938
* <li>Mishna yomis etc</li>
4039
* </ol>
4140
*
4241
* @see java.util.Date
4342
* @see java.util.Calendar
4443
* @author &copy; Y. Paritcher 2019 - 2021
4544
* @author &copy; Avrom Finkelstien 2002
46-
* @author &copy; Eliyahu Hershfeld 2011 - 2021
45+
* @author &copy; Eliyahu Hershfeld 2011 - 2022
4746
*/
4847
public class JewishCalendar extends JewishDate {
4948
/** The 14th day of Nisan, the day before of Pesach (Passover).*/
@@ -131,6 +130,9 @@ public class JewishCalendar extends JewishDate {
131130

132131
/** The holiday of Purim Katan on the 15th day of Adar I on a leap year when Purim is on Adar II, a minor holiday.*/
133132
public static final int SHUSHAN_PURIM_KATAN = 34;
133+
134+
/** The day following the last day of Pesach, Shavuos and Sukkos.*/
135+
public static final int ISRU_CHAG = 35;
134136

135137
/**
136138
* Is the calendar set to Israel, where some holidays have different rules.
@@ -517,6 +519,9 @@ public int getYomTovIndex() {
517519
|| (day == 16 && inIsrael)) {
518520
return CHOL_HAMOED_PESACH;
519521
}
522+
if((day == 22 && inIsrael) || (day == 23 && !inIsrael)) {
523+
return ISRU_CHAG;
524+
}
520525
if (isUseModernHolidays()
521526
&& ((day == 26 && dayOfWeek == Calendar.THURSDAY)
522527
|| (day == 28 && dayOfWeek == Calendar.MONDAY)
@@ -554,6 +559,9 @@ public int getYomTovIndex() {
554559
if (day == 6 || (day == 7 && !inIsrael)) {
555560
return SHAVUOS;
556561
}
562+
if((day == 7 && inIsrael) || (day == 8 && !inIsrael)) {
563+
return ISRU_CHAG;
564+
}
557565
break;
558566
case TAMMUZ:
559567
// push off the fast day if it falls on Shabbos
@@ -609,6 +617,9 @@ public int getYomTovIndex() {
609617
if (day == 23 && !inIsrael) {
610618
return SIMCHAS_TORAH;
611619
}
620+
if((day == 23 && inIsrael) || (day == 24 && !inIsrael)) {
621+
return ISRU_CHAG;
622+
}
612623
break;
613624
case KISLEV: // no yomtov in CHESHVAN
614625
// if (day == 24) {
@@ -690,7 +701,7 @@ public int getYomTovIndex() {
690701
public boolean isYomTov() {
691702
int holidayIndex = getYomTovIndex();
692703
if ((isErevYomTov() && (holidayIndex != HOSHANA_RABBA && (holidayIndex == CHOL_HAMOED_PESACH && getJewishDayOfMonth() != 20)))
693-
|| (isTaanis() && holidayIndex != YOM_KIPPUR)) {
704+
|| (isTaanis() && holidayIndex != YOM_KIPPUR) || holidayIndex == ISRU_CHAG) {
694705
return false;
695706
}
696707
return getYomTovIndex() != -1;
@@ -1119,12 +1130,15 @@ public int getTekufasTishreiElapsedDays() {
11191130
* <em>Shabbos</em> and the start date will be delayed a day when the start day is on a <em>Shabbos</em> (this
11201131
* can only occur out of Israel).
11211132
*
1133+
* @deprecated Use {@link TefilaRules#isVeseinTalUmatarStartDate(JewishCalendar)} instead.
1134+
*
11221135
* @return true if it is the first Jewish day (starting the prior evening of reciting <em>Vesein Tal Umatar
11231136
* Livracha</em> (<em>Sheailas Geshamim</em>).
11241137
*
11251138
* @see #isVeseinTalUmatarStartingTonight()
11261139
* @see #isVeseinTalUmatarRecited()
11271140
*/
1141+
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
11281142
public boolean isVeseinTalUmatarStartDate() {
11291143
if (inIsrael) {
11301144
// The 7th Cheshvan can't occur on Shabbos, so always return true for 7 Cheshvan
@@ -1152,12 +1166,15 @@ public boolean isVeseinTalUmatarStartDate() {
11521166
* <em>Vesein tal umatar</em> is not recited on <em>Shabbos</em> and the start date will be delayed a day when
11531167
* the start day is on a <em>Shabbos</em> (this can only occur out of Israel).
11541168
*
1169+
* @deprecated Use {@link TefilaRules#isVeseinTalUmatarStartingTonight(JewishCalendar)} instead.
1170+
*
11551171
* @return true if it is the first Jewish day (starting the prior evening of reciting <em>Vesein Tal Umatar
11561172
* Livracha</em> (<em>Sheailas Geshamim</em>).
11571173
*
11581174
* @see #isVeseinTalUmatarStartDate()
11591175
* @see #isVeseinTalUmatarRecited()
11601176
*/
1177+
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
11611178
public boolean isVeseinTalUmatarStartingTonight() {
11621179
if (inIsrael) {
11631180
// The 7th Cheshvan can't occur on Shabbos, so always return true for 6 Cheshvan
@@ -1180,11 +1197,15 @@ public boolean isVeseinTalUmatarStartingTonight() {
11801197
/**
11811198
* Returns if <em>Vesein Tal Umatar Livracha</em> (<em>Sheailas Geshamim</em>) is recited. This will return
11821199
* true for the entire season, even on <em>Shabbos</em> when it is not recited.
1200+
*
1201+
* @deprecated Use {@link TefilaRules#isVeseinTalUmatarRecited(JewishCalendar)} instead.
1202+
*
11831203
* @return true if <em>Vesein Tal Umatar Livracha</em> (<em>Sheailas Geshamim</em>) is recited.
11841204
*
11851205
* @see #isVeseinTalUmatarStartDate()
11861206
* @see #isVeseinTalUmatarStartingTonight()
11871207
*/
1208+
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
11881209
public boolean isVeseinTalUmatarRecited() {
11891210
if (getJewishMonth() == NISSAN && getJewishDayOfMonth() < 15) {
11901211
return true;
@@ -1203,34 +1224,43 @@ public boolean isVeseinTalUmatarRecited() {
12031224
* Returns if <em>Vesein Beracha</em> is recited. It is recited from 15 <em>Nissan</em> to the point that {@link
12041225
* #isVeseinTalUmatarRecited() <em>vesein tal umatar</em> is recited}.
12051226
*
1227+
* @deprecated Use {@link TefilaRules#isVeseinBerachaRecited(JewishCalendar)} instead.
1228+
*
12061229
* @return true if <em>Vesein Beracha</em> is recited.
12071230
*
12081231
* @see #isVeseinTalUmatarRecited()
12091232
*/
1233+
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
12101234
public boolean isVeseinBerachaRecited() {
12111235
return !isVeseinTalUmatarRecited();
12121236
}
12131237

12141238
/**
12151239
* Returns if the date is the start date for reciting <em>Mashiv Haruach Umorid Hageshem</em>. The date is 22 <em>Tishrei</em>.
12161240
*
1241+
* @deprecated Use {@link TefilaRules#isMashivHaruachStartDate(JewishCalendar)} instead.
1242+
*
12171243
* @return true if the date is the start date for reciting <em>Mashiv Haruach Umorid Hageshem</em>.
12181244
*
12191245
* @see #isMashivHaruachEndDate()
12201246
* @see #isMashivHaruachRecited()
12211247
*/
1248+
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
12221249
public boolean isMashivHaruachStartDate() {
12231250
return getJewishMonth() == TISHREI && getJewishDayOfMonth() == 22;
12241251
}
12251252

12261253
/**
12271254
* Returns if the date is the end date for reciting <em>Mashiv Haruach Umorid Hageshem</em>. The date is 15 <em>Nissan</em>.
12281255
*
1256+
* @deprecated Use {@link TefilaRules#isMashivHaruachEndDate(JewishCalendar)} instead.
1257+
*
12291258
* @return true if the date is the end date for reciting <em>Mashiv Haruach Umorid Hageshem</em>.
12301259
*
12311260
* @see #isMashivHaruachStartDate()
12321261
* @see #isMashivHaruachRecited()
12331262
*/
1263+
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
12341264
public boolean isMashivHaruachEndDate() {
12351265
return getJewishMonth() == NISSAN && getJewishDayOfMonth() == 15;
12361266
}
@@ -1240,11 +1270,14 @@ public boolean isMashivHaruachEndDate() {
12401270
* on the 15th day of <em>Nissan</em>.
12411271
* <em>Marcheshvan</em>. Outside of Israel recitation starts on December 4/5.
12421272
*
1273+
* @deprecated Use {@link TefilaRules#isMashivHaruachRecited(JewishCalendar)} instead.
1274+
*
12431275
* @return true if <em>Mashiv Haruach Umorid Hageshem</em> is recited.
12441276
*
12451277
* @see #isMashivHaruachStartDate()
12461278
* @see #isMashivHaruachEndDate()
12471279
*/
1280+
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
12481281
public boolean isMashivHaruachRecited() {
12491282
JewishDate startDate = new JewishDate(getJewishYear(), TISHREI, 22);
12501283
JewishDate endDate = new JewishDate(getJewishYear(), NISSAN, 15);
@@ -1256,11 +1289,28 @@ public boolean isMashivHaruachRecited() {
12561289
* This period starts on 22 <em>Tishrei</em> and ends on the 15th day of
12571290
* <em>Nissan</em>.
12581291
*
1292+
* @deprecated Use {@link TefilaRules#isMoridHatalRecited(JewishCalendar)} instead.
1293+
*
12591294
* @return true if <em>Morid Hatal</em> (or the lack of reciting <em>Mashiv Haruach</em> following <em>nussach Ashkenaz</em>) is recited.
12601295
*/
1296+
@Deprecated // (forRemoval=true) // add back once Java 9 is the minimum supported version
12611297
public boolean isMoridHatalRecited() {
12621298
return !isMashivHaruachRecited() || isMashivHaruachStartDate() || isMashivHaruachEndDate();
12631299
}
1300+
1301+
/**
1302+
* Returns true if the current day is erev Yom Tov. The method returns true for <em>Erev</em> - <em>Pesach</em> (first and
1303+
* last days), <em>Shavuos</em>, <em>Rosh Hashana</em>, <em>Yom Kippur</em>, <em>Succos</em> and <em>Hoshana Rabba</em>.
1304+
*
1305+
* @return true if the current day is <em>Erev</em> - <em>Pesach</em>, <em>Shavuos</em>, <em>Rosh Hashana</em>, <em>Yom
1306+
* Kippur</em>, <em>Succos</em> and <em>Hoshana Rabba</em>.
1307+
* @see #isYomTov()
1308+
* @see #isErevYomTovSheni()
1309+
*/
1310+
public boolean isIsruChag() {
1311+
int holidayIndex = getYomTovIndex();
1312+
return holidayIndex == ISRU_CHAG;
1313+
}
12641314

12651315
/**
12661316
* Indicates whether some other object is "equal to" this one.

0 commit comments

Comments
 (0)