Skip to content

Commit e11417f

Browse files
authored
Move Repeated Erev Pesach zmanim Logic to the parent class
This change required moving the previously private Baal Hatanya sunrise and sunset methods, to protected methods in the parent ZmanimCalendar class.
1 parent 95199fb commit e11417f

1 file changed

Lines changed: 26 additions & 160 deletions

File tree

src/main/java/com/kosherjava/zmanim/ComprehensiveZmanimCalendar.java

Lines changed: 26 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -295,16 +295,6 @@ public class ComprehensiveZmanimCalendar extends ZmanimCalendar {
295295
*/
296296
protected static final double ZENITH_5_POINT_88 = GEOMETRIC_ZENITH + 5.88;
297297

298-
/**
299-
* The zenith of 1.583° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for
300-
* calculating <em>netz amiti</em> (sunrise) and <em>shkiah amiti</em> (sunset) based on the opinion of the
301-
* <a href="https://en.wikipedia.org/wiki/Shneur_Zalman_of_Liadi">Baal Hatanya</a>.
302-
*
303-
* @see #getSunriseBaalHatanya()
304-
* @see #getSunsetBaalHatanya()
305-
*/
306-
protected static final double ZENITH_1_POINT_583 = GEOMETRIC_ZENITH + 1.583;
307-
308298
/**
309299
* The zenith of 16.9&deg; below geometric zenith (90&deg;). This calculation is used for determining <em>alos</em>
310300
* (dawn) based on the opinion of the Baal Hatanya. It is based on the calculation that the time between dawn
@@ -3543,22 +3533,16 @@ public Instant getTchilasZmanKidushLevana7Days() {
35433533
* <a href="https://en.wikipedia.org/wiki/Vilna_Gaon">GRA</a> that the day is calculated from sunrise to sunset.
35443534
* This returns the time 4 * {@link #getShaahZmanisGra()} after {@link #getSeaLevelSunrise() sea level sunrise}. If it
35453535
* is not <em>erev Pesach</em>, a null will be returned.
3546-
*
3547-
* @see ZmanimCalendar#getShaahZmanisGra()
3548-
* @see ZmanimCalendar#getSofZmanTfilaGRA()
35493536
* @return the <code>Instant</code> one is allowed eating <em>chametz</em> on <em>Erev Pesach</em>. If it is not <em>erev
35503537
* Pesach</em> or the calculation can't be computed such as in the Arctic Circle where there is at least one
35513538
* day a year where the sun does not rise, and one where it does not set, a <code>null</code> will be returned.
35523539
* See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
3540+
* @see ZmanimCalendar#getShaahZmanisGra()
3541+
* @see ZmanimCalendar#getSofZmanTfilaGRA()
3542+
* @see #getSofZmanAchilasChametz(Instant, Instant, boolean)
35533543
*/
35543544
public Instant getSofZmanAchilasChametzGRA() {
3555-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3556-
3557-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3558-
return getSofZmanTfilaGRA();
3559-
} else {
3560-
return null;
3561-
}
3545+
return getSofZmanAchilasChametz(getSunriseBasedOnElevationSetting(), getSunsetBasedOnElevationSetting(), true);
35623546
}
35633547

35643548
/**
@@ -3578,15 +3562,10 @@ public Instant getSofZmanAchilasChametzGRA() {
35783562
* @see #getShaahZmanisMGA()
35793563
* @see #getAlos72()
35803564
* @see #getSofZmanTfilaMGA72Minutes()
3565+
* @see #getSofZmanAchilasChametz(Instant, Instant, boolean)
35813566
*/
35823567
public Instant getSofZmanAchilasChametzMGA72Minutes() {
3583-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3584-
3585-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3586-
return getSofZmanTfilaMGA72Minutes();
3587-
} else {
3588-
return null;
3589-
}
3568+
return getSofZmanAchilasChametz(getAlos72(), getTzais72(), true);
35903569
}
35913570

35923571
/**
@@ -3606,15 +3585,10 @@ public Instant getSofZmanAchilasChametzMGA72Minutes() {
36063585
* @see #getShaahZmanis72MinutesZmanis()
36073586
* @see #getAlos72Zmanis()
36083587
* @see #getSofZmanTfilaMGA72MinutesZmanis()
3588+
* @see #getSofZmanAchilasChametz(Instant, Instant, boolean)
36093589
*/
36103590
public Instant getSofZmanAchilasChametzMGA72MinutesZmanis() {
3611-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3612-
3613-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3614-
return getSofZmanTfilaMGA72MinutesZmanis();
3615-
} else {
3616-
return null;
3617-
}
3591+
return getSofZmanAchilasChametz(getAlos72Zmanis(), getTzais72Zmanis(), true);
36183592
}
36193593

36203594
/**
@@ -3633,42 +3607,30 @@ public Instant getSofZmanAchilasChametzMGA72MinutesZmanis() {
36333607
* @see #getShaahZmanis16Point1Degrees()
36343608
* @see #getAlos16Point1Degrees()
36353609
* @see #getSofZmanTfilaMGA16Point1Degrees()
3610+
* @see #getSofZmanAchilasChametz(Instant, Instant, boolean)
36363611
*/
36373612
public Instant getSofZmanAchilasChametzMGA16Point1Degrees() {
3638-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3639-
3640-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3641-
return getSofZmanTfilaMGA16Point1Degrees();
3642-
} else {
3643-
return null;
3644-
}
3613+
return getSofZmanAchilasChametz(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true);
36453614
}
36463615

36473616
/**
3648-
* FIXME adjust for synchronous
36493617
* This method returns the latest time for burning <em>chametz</em> on <em>Erev Pesach</em> according to the opinion
36503618
* of the <a href="https://en.wikipedia.org/wiki/Vilna_Gaon">GRA</a>. This time is 5 hours into the day based on the
36513619
* opinion of the <a href="https://en.wikipedia.org/wiki/Vilna_Gaon">GRA</a> that the day is calculated from
36523620
* sunrise to sunset. This returns the time 5 * {@link #getShaahZmanisGra()} after {@link #getSeaLevelSunrise() sea
36533621
* level sunrise}. If it is not <em>erev Pesach</em>, a null will be returned.
3654-
* @see ZmanimCalendar#getShaahZmanisGra()
36553622
* @return the <code>Instant</code> of the latest time for burning <em>chametz</em> on <em>Erev Pesach</em>. If it is not
36563623
* <em>erev Pesach</em> or the calculation can't be computed such as in the Arctic Circle where there is at least
36573624
* one day a year where the sun does not rise, and one where it does not set, a <code>null</code> will be
36583625
* returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
3626+
* @see ZmanimCalendar#getShaahZmanisGra()
3627+
* @see #getSofZmanBiurChametz(Instant, Instant, boolean)
36593628
*/
36603629
public Instant getSofZmanBiurChametzGRA() {
3661-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3662-
3663-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3664-
return getTimeOffset(getSunriseBasedOnElevationSetting(), getShaahZmanisGra() * 5);
3665-
} else {
3666-
return null;
3667-
}
3630+
return getSofZmanBiurChametz(getSunriseBasedOnElevationSetting(), getSunsetBasedOnElevationSetting(), true);
36683631
}
36693632

36703633
/**
3671-
* FIXME adjust for synchronous
36723634
* This method returns the latest time for burning <em>chametz</em> on <em>Erev Pesach</em> according to the opinion of
36733635
* the <a href="https://en.wikipedia.org/wiki/Avraham_Gombiner">Magen Avraham (MGA)</a> based on <em>alos</em>
36743636
* being {@link #getAlos72() 72} minutes before {@link #getSunriseWithElevation() sunrise}. This time is 5 {@link
@@ -3682,19 +3644,13 @@ public Instant getSofZmanBiurChametzGRA() {
36823644
* returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
36833645
* @see #getShaahZmanisMGA()
36843646
* @see #getAlos72()
3647+
* @see #getSofZmanBiurChametz(Instant, Instant, boolean)
36853648
*/
36863649
public Instant getSofZmanBiurChametzMGA72Minutes() {
3687-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3688-
3689-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3690-
return getTimeOffset(getAlos72(), getShaahZmanisMGA() * 5);
3691-
} else {
3692-
return null;
3693-
}
3650+
return getSofZmanBiurChametz(getAlos72(), getTzais72(), true);
36943651
}
36953652

36963653
/**
3697-
* FIXME adjust for synchronous
36983654
* This method returns the latest time for burning <em>chametz</em> on <em>Erev Pesach</em> according to the opinion of
36993655
* the <a href="https://en.wikipedia.org/wiki/Avraham_Gombiner">Magen Avraham (MGA)</a> based on <em>alos</em>
37003656
* being {@link #getAlos72Zmanis() 72} minutes zmanis before {@link #getSunriseWithElevation() sunrise}. This time is 5 {@link
@@ -3708,19 +3664,13 @@ public Instant getSofZmanBiurChametzMGA72Minutes() {
37083664
* returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
37093665
* @see #getShaahZmanis72MinutesZmanis()
37103666
* @see #getAlos72Zmanis()
3667+
* @see #getSofZmanBiurChametz(Instant, Instant, boolean)
37113668
*/
37123669
public Instant getSofZmanBiurChametzMGA72MinutesZmanis() {
3713-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3714-
3715-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3716-
return getTimeOffset(getAlos72Zmanis(), getShaahZmanis72MinutesZmanis() * 5);
3717-
} else {
3718-
return null;
3719-
}
3670+
return getSofZmanBiurChametz(getAlos72Zmanis(), getTzais72Zmanis(), true);
37203671
}
37213672

37223673
/**
3723-
* FIXME adjust for synchronous
37243674
* This method returns the latest time for burning <em>chametz</em> on <em>Erev Pesach</em> according to the opinion
37253675
* of the <a href="https://en.wikipedia.org/wiki/Avraham_Gombiner">Magen Avraham (MGA)</a> based on <em>alos</em>
37263676
* being {@link #getAlos16Point1Degrees() 16.1&deg;} before {@link #getSunriseWithElevation() sunrise}. This time is 5
@@ -3736,84 +3686,10 @@ public Instant getSofZmanBiurChametzMGA72MinutesZmanis() {
37363686
*
37373687
* @see #getShaahZmanis16Point1Degrees()
37383688
* @see #getAlos16Point1Degrees()
3689+
* @see #getSofZmanBiurChametz(Instant, Instant, boolean)
37393690
*/
37403691
public Instant getSofZmanBiurChametzMGA16Point1Degrees() {
3741-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3742-
3743-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3744-
return getTimeOffset(getAlos16Point1Degrees(), getShaahZmanis16Point1Degrees() * 5);
3745-
} else {
3746-
return null;
3747-
}
3748-
}
3749-
3750-
/**
3751-
* A method that returns the <a href="https://en.wikipedia.org/wiki/Shneur_Zalman_of_Liadi">Baal Hatanya</a>'s
3752-
* <em>netz amiti</em> (sunrise) without {@link AstronomicalCalculator#getElevationAdjustment(double)
3753-
* elevation adjustment}. This forms the base for the Baal Hatanya's dawn-based calculations that are
3754-
* calculated as a dip below the horizon before sunrise.
3755-
*
3756-
* According to the Baal Hatanya, <em>netz amiti</em>, or true (halachic) sunrise, is when the top of the sun's
3757-
* disk is visible at an elevation similar to the mountains of Eretz Yisrael. The time is calculated as the point at which
3758-
* the center of the sun's disk is 1.583&deg; below the horizon. This degree-based calculation can be found in Rabbi Shalom
3759-
* DovBer Levine's commentary on The <a href="https://www.chabadlibrary.org/books/pdf/Seder-Hachnosas-Shabbos.pdf">Baal
3760-
* Hatanya's Seder Hachnasas Shabbos</a>. From an elevation of 546 meters, the top of <a href=
3761-
* "https://en.wikipedia.org/wiki/Mount_Carmel">Har Hacarmel</a>, the sun disappears when it is 1&deg; 35' or 1.583&deg;
3762-
* below the sea level horizon. This in turn is based on the Gemara <a href=
3763-
* "https://hebrewbooks.org/shas.aspx?mesechta=2&daf=35">Shabbos 35a</a>. There are other opinions brought down by
3764-
* Rabbi Levine, including Rabbi Yosef Yitzchok Feigelstock who calculates it as the degrees below the horizon 4 minutes after
3765-
* sunset in Yerushalayim (on the equinox). That is brought down as 1.583&deg;. This is identical to the 1&deg; 35' <em>zman</em>
3766-
* and is probably a typo and should be 1.683&deg;. These calculations are used by most <a href=
3767-
* "https://en.wikipedia.org/wiki/Chabad">Chabad</a> calendars that use the Baal Hatanya's <em>zmanim</em>. See
3768-
* <a href="https://www.chabad.org/library/article_cdo/aid/3209349/jewish/About-Our-Zmanim-Calculations.htm">About Our
3769-
* <em>Zmanim</em> Calculations @ Chabad.org</a>.
3770-
*
3771-
* Note: <em>netz amiti</em> is used only for calculating certain <em>zmanim</em>, and is intentionally unpublished. For
3772-
* practical purposes, daytime <em>mitzvos</em> like <em>shofar</em> and <em>lulav</em> should not be done until after the
3773-
* published time for <em>netz</em> / sunrise.
3774-
*
3775-
* @return the <code>Instant</code> representing the exact sea level <em>netz amiti</em> (sunrise) time. If the calculation can't be
3776-
* computed such as in the Arctic Circle where there is at least one day a year where the sun does not rise, and one
3777-
* where it does not set, a <code>null</code> will be returned. See detailed explanation on top of the page.
3778-
*
3779-
* @see #getSunriseWithElevation()
3780-
* @see #getSeaLevelSunrise()
3781-
* @see #getSunsetBaalHatanya()
3782-
* @see #ZENITH_1_POINT_583
3783-
*/
3784-
private Instant getSunriseBaalHatanya() {
3785-
return getSunriseOffsetByDegrees(ZENITH_1_POINT_583);
3786-
}
3787-
3788-
/**
3789-
* A method that returns the <a href="https://en.wikipedia.org/wiki/Shneur_Zalman_of_Liadi">Baal Hatanya</a>'s
3790-
* <em>shkiah amiti</em> (sunset) without {@link AstronomicalCalculator#getElevationAdjustment(double)
3791-
* elevation adjustment}. This forms the base for the Baal Hatanya's dusk-based calculations that are calculated
3792-
* as a dip below the horizon after sunset.
3793-
*
3794-
* According to the Baal Hatanya, <em>shkiah amiti</em>, true (<em>halachic</em>) sunset, is when the top of the
3795-
* sun's disk disappears from view at an elevation similar to the mountains of <em>Eretz Yisrael</em>.
3796-
* This time is calculated as the point at which the center of the sun's disk is 1.583 degrees below the horizon.
3797-
*
3798-
* Note: <em>shkiah amiti</em> is used only for calculating certain <em>zmanim</em>, and is intentionally unpublished. For
3799-
* practical purposes, all daytime mitzvos should be completed before the published time for <em>shkiah</em> / sunset.
3800-
*
3801-
* For further explanation of the calculations used for the Baal Hatanya's <em>zmanim</em> in this library, see
3802-
* <a href="https://www.chabad.org/library/article_cdo/aid/3209349/jewish/About-Our-Zmanim-Calculations.htm">About Our
3803-
* <em>Zmanim</em> Calculations @ Chabad.org</a>.
3804-
*
3805-
* @return the <code>Instant</code> representing the exact sea level <em>shkiah amiti</em> (sunset) time. If the calculation
3806-
* can't be computed such as in the Arctic Circle where there is at least one day a year where the sun does not
3807-
* rise, and one where it does not set, a <code>null</code> will be returned. See detailed explanation on top of
3808-
* the {@link AstronomicalCalendar} documentation.
3809-
*
3810-
* @see #getSunsetWithElevation()
3811-
* @see #getSeaLevelSunset()
3812-
* @see #getSunriseBaalHatanya()
3813-
* @see #ZENITH_1_POINT_583
3814-
*/
3815-
private Instant getSunsetBaalHatanya() {
3816-
return getSunsetOffsetByDegrees(ZENITH_1_POINT_583);
3692+
return getSofZmanBiurChametz(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true);
38173693
}
38183694

38193695
/**
@@ -3903,42 +3779,32 @@ public Instant getSofZmanTfilaBaalHatanya() {
39033779
* is calculated from sunrise to sunset. This returns the time 4 {@link #getShaahZmanisBaalHatanya()} after
39043780
* {@link #getSunriseBaalHatanya() <em>netz amiti</em> (sunrise)}. If it is not <em>erev Pesach</em>, a null will be
39053781
* returned.
3906-
* @see #getShaahZmanisBaalHatanya()
3907-
* @see #getSofZmanTfilaBaalHatanya()
39083782
* @return the <code>Instant</code> one is allowed eating <em>chametz</em> on <em>Erev Pesach</em>. If it is not <em>erev
39093783
* Pesach</em> or the calculation can't be computed such as in the Arctic Circle where there is at least one
39103784
* day a year where the sun does not rise, and one where it does not set, a <code>null</code> will be returned.
39113785
* See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
3786+
* @see #getShaahZmanisBaalHatanya()
3787+
* @see #getSofZmanTfilaBaalHatanya()
3788+
* @see #getSofZmanAchilasChametz(Instant, Instant, boolean)
39123789
*/
39133790
public Instant getSofZmanAchilasChametzBaalHatanya() {
3914-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3915-
3916-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3917-
return getSofZmanTfilaBaalHatanya();
3918-
} else {
3919-
return null;
3920-
}
3791+
return getSofZmanAchilasChametz(getSunriseBaalHatanya(), getSunsetBaalHatanya(), true);
39213792
}
39223793

39233794
/**
39243795
* This method returns the latest time for burning <em>chametz</em> on <em>Erev Pesach</em> according to the opinion of
39253796
* the Baal Hatanya. This time is 5 hours into the day based on the opinion of the Baal Hatanya that the day is calculated
39263797
* from sunrise to sunset. This returns the time 5 * {@link #getShaahZmanisBaalHatanya()} after
39273798
* {@link #getSunriseBaalHatanya() <em>netz amiti</em> (sunrise)}. If it is not <em>erev Pesach</em>, a null will be returned.
3928-
* @see #getShaahZmanisBaalHatanya()
39293799
* @return the <code>Instant</code> of the latest time for burning <em>chametz</em> on <em>Erev Pesach</em>. If it is not
39303800
* <em>erev Pesach</em> or the calculation can't be computed such as in the Arctic Circle where there is at
39313801
* least one day a year where the sun does not rise, and one where it does not set, a <code>null</code> will be
39323802
* returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
3803+
* @see #getShaahZmanisBaalHatanya()
3804+
* @see #getSofZmanBiurChametz(Instant, Instant, boolean)
39333805
*/
39343806
public Instant getSofZmanBiurChametzBaalHatanya() {
3935-
JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate());
3936-
3937-
if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) {
3938-
return getTimeOffset(getSunriseBaalHatanya(), getShaahZmanisBaalHatanya() * 5);
3939-
} else {
3940-
return null;
3941-
}
3807+
return getSofZmanBiurChametz(getSunriseBaalHatanya(), getSunsetBaalHatanya(), true);
39423808
}
39433809

39443810
/**

0 commit comments

Comments
 (0)