Skip to content

Commit d8234b8

Browse files
authored
Add isHallelRecited and isHallelShalemRecited
1 parent 65451db commit d8234b8

File tree

1 file changed

+71
-4
lines changed

1 file changed

+71
-4
lines changed

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

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@
5353
* <li><em>Mizmor Lesoda</em></li>
5454
* <li><em>Behab</em></li>
5555
* <li><em>Selichos</em></li>
56-
* <li><em>Yom Kippur Kattan</em></li>
57-
* <li><em>Hallel Shalem / Chatzi Hallel</em></li>
5856
* <li>...</li>
5957
* </ol>
6058
*/
@@ -141,8 +139,8 @@ public class TefilaRules {
141139
* @see #isTachanunRecitedMinchaAllYear()
142140
* @see #setTachanunRecitedMinchaAllYear(boolean)
143141
*/
144-
private boolean tachanunRecitedMinchaAllYear = true;
145-
142+
private boolean tachanunRecitedMinchaAllYear = true;
143+
146144
/**
147145
* Returns if <em>tachanun</em> is recited during <em>shacharis</em> on the day in question. See the many
148146
* <em>minhag</em> based settings that are available in this class.
@@ -373,6 +371,75 @@ public boolean isMoridHatalRecited(JewishCalendar jewishCalendar) {
373371
return !isMashivHaruachRecited(jewishCalendar) || isMashivHaruachStartDate(jewishCalendar) || isMashivHaruachEndDate(jewishCalendar);
374372
}
375373

374+
/**
375+
* Returns if <em>hallel</em> is recited on the day in question. This will return true for both <em>hallel shalem</em>
376+
* and <em>chatzi hallel</em>. See {@link #isHallelShalemRecited(JewishCalendar)} to know if the complete <em>hallel</em>
377+
* is recited.
378+
*
379+
* @param jewishCalendar the Jewish calendar day.
380+
* @return if <em>hallel</em> is recited.
381+
* @see #isHallelShalemRecited(JewishCalendar)
382+
*/
383+
public boolean isHallelRecited(JewishCalendar jewishCalendar) {
384+
int day = jewishCalendar.getJewishDayOfMonth();
385+
int month = jewishCalendar.getJewishMonth();
386+
int holidayIndex = jewishCalendar.getYomTovIndex();
387+
boolean inIsrael = jewishCalendar.getInIsrael();
388+
389+
if(jewishCalendar.isRoshChodesh()) { //RH returns false for RC
390+
return true;
391+
}
392+
if(jewishCalendar.isChanukah()) {
393+
return true;
394+
}
395+
switch (month) {
396+
case JewishDate.NISSAN:
397+
if(day >= 15 && ((inIsrael && day <= 21) || (!inIsrael && day <= 22))){
398+
return true;
399+
}
400+
break;
401+
case JewishDate.IYAR: // modern holidays
402+
if(jewishCalendar.isUseModernHolidays() && (holidayIndex == JewishCalendar.YOM_HAATZMAUT
403+
|| holidayIndex == JewishCalendar.YOM_YERUSHALAYIM)){
404+
return true;
405+
}
406+
break;
407+
case JewishDate.SIVAN:
408+
if (day == 6 || (!inIsrael && (day == 7))){
409+
return true;
410+
}
411+
break;
412+
case JewishDate.TISHREI:
413+
if (day >= 15 && (day <= 22 || (!inIsrael && (day <= 23)))){
414+
return true;
415+
}
416+
}
417+
return false;
418+
}
419+
420+
/**
421+
* Returns if <em>hallel shalem</em> is recited on the day in question. This will always return false if {@link
422+
* #isHallelRecited(JewishCalendar)} returns false.
423+
*
424+
* @param jewishCalendar the Jewish calendar day.
425+
* @return if <em>hallel shalem</em> is recited.
426+
* @see #isHallelRecited(JewishCalendar)
427+
*/
428+
public boolean isHallelShalemRecited(JewishCalendar jewishCalendar) {
429+
int day = jewishCalendar.getJewishDayOfMonth();
430+
int month = jewishCalendar.getJewishMonth();
431+
boolean inIsrael = jewishCalendar.getInIsrael();
432+
if(isHallelRecited(jewishCalendar)) {
433+
if((jewishCalendar.isRoshChodesh() && ! jewishCalendar.isChanukah())
434+
|| (month == JewishDate.NISSAN && ((inIsrael && day > 15) || (!inIsrael && day > 16)))) {
435+
return false;
436+
} else {
437+
return true;
438+
}
439+
}
440+
return false;
441+
}
442+
376443
/**
377444
* Is <em>tachanun</em> recited during the week of Purim, from the 11th through the 17th of {@link
378445
* JewishDate#ADAR <em>Adar</em>} (on a non-leap year, or {@link JewishDate#ADAR_II <em>Adar II</em>} on a leap year). Some

0 commit comments

Comments
 (0)