diff --git a/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java b/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java index 47a42513..0d68ebdb 100644 --- a/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java +++ b/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java @@ -1,6 +1,6 @@ /* * Zmanim Java API - * Copyright (C) 2004-2023 Eliyahu Hershfeld + * Copyright (C) 2004-2024 Eliyahu Hershfeld * * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) @@ -66,7 +66,7 @@ *
Date
representing the time. If the calculation can't be computed such as in the Arctic
* Circle where there is at least one day a year where the sun does not rise, and one where it does not set,
@@ -384,8 +387,8 @@ public Date getChatzos() {
/**
* Returns chatzos calculated as halfway between sunrise and sunset. Many are of the opinion that
- * chatzos is calculated as the midpoint between {@link #getSeaLevelSunrise sea level sunrise} and
- * {@link #getSeaLevelSunset sea level sunset}, despite it not being the most accurate way to calculate it. A day
+ * chatzos is calculated as the midpoint between {@link #getSeaLevelSunrise() sea level sunrise} and
+ * {@link #getSeaLevelSunset() sea level sunset}, despite it not being the most accurate way to calculate it. A day
* starting at alos and ending at tzais using the same time or degree offset will also return
* the same time. In reality due to lengthening or shortening of day, this is not necessarily the exact midpoint of
* the day, but it is very close. This method allows you to use the NOAACalculator and still calculate chatzos
@@ -422,10 +425,10 @@ public Date getChatzosAsHalfDay() {
* hours), and the latest zman krias shema is calculated as 3 of those shaos zmaniyos after the beginning of
* the day. If {@link #isUseAstronomicalChatzosForOtherZmanim()} is true
, the 3 shaos zmaniyos will be
* based on 1/6 of the time between sunrise and {@link #getSunTransit() astronomical chatzos}. As an example, passing
- * {@link #getSunrise() sunrise} and {@link #getSunset sunset} or {@link #getSeaLevelSunrise() sea level sunrise} and {@link
+ * {@link #getSunrise() sunrise} and {@link #getSunset() sunset} or {@link #getSeaLevelSunrise() sea level sunrise} and {@link
* #getSeaLevelSunset() sea level sunset} to this method (or {@link #getElevationAdjustedSunrise()} and {@link
* #getElevationAdjustedSunset()} that is driven off the {@link #isUseElevation()} setting) will return sof zman krias
- * shema according to the opinion of the GRA. In cases
+ * shema according to the opinion of the GRA. In cases
* where the start and end dates are not synchronous such as in {@link ComplexZmanimCalendar
* #getSofZmanShmaAlos16Point1ToTzaisGeonim7Point083Degrees()} false
should be passed to the synchronous parameter
* to ensure that {@link #isUseAstronomicalChatzosForOtherZmanim()} will not be used.
@@ -480,8 +483,8 @@ public Date getSofZmanShma(Date startOfDay, Date endOfDay) {
* {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link #isUseElevation()} setting), according
* to the GRA.
* The day is calculated from {@link #getSeaLevelSunrise() sea level sunrise} to {@link #getSeaLevelSunset() sea level
- * sunset} or from {@link #getSunrise() sunrise} to {@link #getSunset() sunset} (depending on the {@link #isUseElevation()}
- * setting).
+ * sunset} or from {@link #getSunrise() sunrise} to {@link #getSunset() sunset} (depending on the
+ * {@link #isUseElevation()} setting).
*
* @see #getSofZmanShma(Date, Date)
* @see #getShaahZmanisGra()
@@ -519,12 +522,13 @@ public Date getSofZmanShmaMGA() {
/**
* This method returns the tzais (nightfall) based on the opinion of Rabbeinu Tam that
- * tzais hakochavim is calculated as 72 minutes, the time it takes to walk 4 Mil at 18 minutes
- * a Mil. According to the Machtzis Hashekel in
- * Orach Chaim 235:3, the Pri Megadim in Orach
+ * tzais hakochavim is calculated as 72 minutes after sunset, the time it takes to walk 4 mil at 18 minutes a mil.
+ * According to the Machtzis Hashekel in Orach Chaim
+ * 235:3, the Pri Megadim in Orach
* Chaim 261:2 (see the Biur Halacha) and others (see Hazmanim Bahalacha 17:3 and 17:5) the 72 minutes are standard
- * clock minutes any time of the year in any location. Depending on the {@link #isUseElevation()} setting, a
- * 72-minute offset from either {@link #getSunset() sunset} or {@link #getSeaLevelSunset() sea level sunset} is used.
+ * clock minutes any time of the year in any location. Depending on the {@link #isUseElevation()} setting, a 72-minute
+ * offset from either {@link #getSunset() sunset} or {@link #getSeaLevelSunset() sea level sunset} is used.
*
* @see ComplexZmanimCalendar#getTzais16Point1Degrees()
* @return the Date
representing 72 minutes after sunset. If the calculation can't be
@@ -561,13 +565,13 @@ public Date getCandleLighting() {
* end of the day passed to this method.
* The time from the start of day to the end of day are divided into 12 shaos zmaniyos (temporal hours),
* and sof zman tfila is calculated as 4 of those shaos zmaniyos after the beginning of the day.
- * As an example, passing {@link #getSunrise() sunrise} and {@link #getSunset sunset} or {@link #getSeaLevelSunrise()
+ * As an example, passing {@link #getSunrise() sunrise} and {@link #getSunset() sunset} or {@link #getSeaLevelSunrise()
* sea level sunrise} and {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()}
- * elevation setting) to this method will return zman tfilah according to the opinion of the GRA. This method's synchronous parameter indicates if the start
+ * elevation setting) to this method will return zman tfilah according to the opinion of the GRA. This method's synchronous parameter indicates if the start
* and end of day for the calculation are synchronous, having the same offset. This is typically the case, but some
* zmanim calculations are based on a start and end at different offsets from the real start and end of the day,
- * such as starting the day at alos and an ending it at tzais geonim or some other variant. If the day
+ * such as starting the day at alos and an ending it at tzais Geonim or some other variant. If the day
* is not synchronous a {@link #getHalfDayBasedZman(Date, Date, double) half-day based calculations} will be bypassed.
* It would be illogical to use a half-day based calculation that start/end at chatzos when the two "halves" of
* the day are not equal, and the halfway point between them is not at chatzos.
@@ -621,8 +625,8 @@ public Date getSofZmanTfila(Date startOfDay, Date endOfDay) {
* {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link #isUseElevation()} setting), according
* to the GRA.
* The day is calculated from {@link #getSeaLevelSunrise() sea level sunrise} to {@link #getSeaLevelSunset() sea level
- * sunset} or from {@link #getSunrise() sunrise} to {@link #getSunset() sunset} (depending on the {@link #isUseElevation()}
- * setting).
+ * sunset} or from {@link #getSunrise() sunrise} to {@link #getSunset() sunset} (depending on the
+ * {@link #isUseElevation()} setting).
*
* @see #getSofZmanTfila(Date, Date)
* @see #getShaahZmanisGra()
@@ -661,17 +665,17 @@ public Date getSofZmanTfilaMGA() {
* is 6.5 * shaos zmaniyos (temporal hours) after the start of the day, calculated using the start and end of the
* day passed to this method. The time from the start of day to the end of day are divided into 12 shaos zmaniyos
* (temporal hours), and mincha gedola is calculated as 6.5 of those shaos zmaniyos after the beginning
- * of the day. As an example, passing {@link #getSunrise() sunrise} and {@link #getSunset sunset} or {@link
+ * of the day. As an example, passing {@link #getSunrise() sunrise} and {@link #getSunset() sunset} or {@link
* #getSeaLevelSunrise() sea level sunrise} and {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link
* #isUseElevation()} elevation setting) to this method will return mincha gedola according to the opinion of the
- * GRA. Alternatively, this method uses {@link
+ * GRA. Alternatively, this method uses {@link
* #isUseAstronomicalChatzosForOtherZmanim()} to control if the time is based on 6.5 shaos zmaniyos into the day
* mentioned above, or as half an hour zmaniyos based on the second half of the day after chatzos ({@link
* #getSunTransit() astronomical chatzos} if supported by the {@link AstronomicalCalculator calculator} and {@link
* #isUseAstronomicalChatzos() configured} or {@link #getChatzosAsHalfDay() chatzos as half a day} if not. This
* method's synchronous parameter indicates if the start and end of day for the calculation are synchronous, having the same
* offset. This is typically the case, but some zmanim calculations are based on a start and end at different offsets
- * from the real start and end of the day, such as starting the day at alos and an ending it at tzais geonim
+ * from the real start and end of the day, such as starting the day at alos and an ending it at tzais Geonim
* or some other variant. If the day is not synchronous a {@link #getHalfDayBasedZman(Date, Date, double) half-day based
* calculations} will be bypassed. It would be illogical to use a half-day based calculation that start/end at chatzos
* when the two "halves" of the day are not equal, and the halfway point between them is not at chatzos.
@@ -729,9 +733,9 @@ public Date getMinchaGedola(Date startOfDay, Date endOfDay) {
* This method returns the latest mincha gedola,the earliest time one can pray mincha that is 6.5 *
* {@link #getShaahZmanisGra() shaos zmaniyos} (solar hours) after {@link #getSunrise() sunrise} or
* {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link #isUseElevation()} setting), according
- * to the GRA. Mincha gedola is the earliest
+ * to the GRA. Mincha gedola is the earliest
* time one can pray mincha. The Ramba"m is of the opinion that it is better to delay mincha until
- * {@link #getMinchaKetana() mincha ketana} while the Ra"sh, Tur, GRA and others are of the
+ * {@link #getMinchaKetana() mincha ketana} while the Ra"sh, Tur, GRA and others are of the
* opinion that mincha can be prayed lechatchila starting at mincha gedola.
* The day is calculated from {@link #getSeaLevelSunrise() sea level sunrise} to {@link #getSeaLevelSunset() sea level
* sunset} or {@link #getSunrise() sunrise} to {@link #getSunset() sunset} (depending on the {@link #isUseElevation()}
@@ -759,10 +763,12 @@ public Date getMinchaGedola() {
* start of the day, calculated using the start and end of the day passed to this method.
* The time from the start of day to the end of day are divided into 12 shaos zmaniyos (temporal hours), and
* samuch lemincha ketana is calculated as 9 of those shaos zmaniyos after the beginning of the day.
- * For example, passing {@link #getSunrise() sunrise} and {@link #getSunset sunset} or {@link #getSeaLevelSunrise() sea
+ * For example, passing {@link #getSunrise() sunrise} and {@link #getSunset() sunset} or {@link #getSeaLevelSunrise() sea
* level sunrise} and {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()} elevation
* setting) to this method will return samuch lemincha ketana according to the opinion of the
- * GRA.
+ * GRA. See the Mechaber and Mishna Berurah 232 and 249:2.
*
* @param startOfDay
* the start of day for calculating samuch lemincha ketana. This can be sunrise or any alos
@@ -818,13 +824,13 @@ public Date getSamuchLeMinchaKetana(Date startOfDay, Date endOfDay) {
* of the day passed to this method.
* The time from the start of day to the end of day are divided into 12 shaos zmaniyos (temporal hours), and
* mincha ketana is calculated as 9.5 of those shaos zmaniyos after the beginning of the day. As an
- * example, passing {@link #getSunrise() sunrise} and {@link #getSunset sunset} or {@link #getSeaLevelSunrise() sea
+ * example, passing {@link #getSunrise() sunrise} and {@link #getSunset() sunset} or {@link #getSeaLevelSunrise() sea
* level sunrise} and {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()}
* elevation setting) to this method will return mincha ketana according to the opinion of the
* GRA. This method's synchronous parameter indicates if the start
* and end of day for the calculation are synchronous, having the same offset. This is typically the case, but some
* zmanim calculations are based on a start and end at different offsets from the real start and end of the day,
- * such as starting the day at alos and an ending it at tzais geonim or some other variant. If the day
+ * such as starting the day at alos and an ending it at tzais Geonim or some other variant. If the day
* is not synchronous a {@link #getHalfDayBasedZman(Date, Date, double) half-day based calculations} will be bypassed.
* It would be illogical to use a half-day based calculation that start/end at chatzos when the two "halves" of
* the day are not equal, and the halfway point between them is not at chatzos.
@@ -902,21 +908,23 @@ public Date getMinchaKetana() {
* the day passed to the method.
* The time from the start of day to the end of day are divided into 12 shaos zmaniyos (temporal hours), and
* plag hamincha is calculated as 10.75 of those shaos zmaniyos after the beginning of the day. As an
- * example, passing {@link #getSunrise() sunrise} and {@link #getSunset sunset} or {@link #getSeaLevelSunrise() sea level
+ * example, passing {@link #getSunrise() sunrise} and {@link #getSunset() sunset} or {@link #getSeaLevelSunrise() sea level
* sunrise} and {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()} elevation
* setting) to this method will return plag mincha according to the opinion of the
- * GRA. This method's synchronous parameter indicates if
- * the start and end of day for the calculation are synchronous, having the same offset. This is typically the case, but
- * some zmanim calculations are based on a start and end at different offsets from the real start and end of the
- * day, such as starting the day at alos and an ending it at tzais geonim or some other variant. If the
- * day is not synchronous a {@link #getHalfDayBasedZman(Date, Date, double) half-day based calculations} will be bypassed.
- * It would be illogical to use a half-day based calculation that start/end at chatzos when the two "halves" of
- * the day are not equal, and the halfway point between them is not at chatzos.
+ * GRA. This method's synchronous parameter indicates if the start
+ * and end of day for the calculation are synchronous, having the same offset. This is typically the case, but some
+ * zmanim calculations are based on a start and end at different offsets from the real start and end of the day,
+ * such as starting the day at alos and an ending it at tzais Geonim or some other variant. If the day
+ * is not synchronous a {@link #getHalfDayBasedZman(Date, Date, double) half-day based calculations} will be bypassed. It
+ * would be illogical to use a half-day based calculation that start/end at chatzos when the two "halves" of the
+ * day are not equal, and the halfway point between them is not at chatzos.
*
* @param startOfDay
- * the start of day for calculating plag. This can be sunrise or any alos passed to this method.
+ * the start of day for calculating plag hamincha. This can be sunrise or any alos passed to
+ * this method.
* @param endOfDay
- * the end of day for calculating plag. This can be sunset or any tzais passed to this method.
+ * the end of day for calculating plag hamincha. This can be sunset or any tzais passed to
+ * this method.
* @param synchronous
* If the zman has a synchronous start and end of the day. If this is false
, using a {@link
* #isUseAstronomicalChatzosForOtherZmanim()} makes no sense and will be ignored even if set to true, since by
@@ -939,9 +947,9 @@ public Date getPlagHamincha(Date startOfDay, Date endOfDay, boolean synchronous)
* false
to the synchronous parameter since there is no way to know if the start and end of the day are synchronous.
* Passing true when they are not synchronous is too much of a risk. See information on that method for more details.
* @param startOfDay
- * the start of day for calculating plag. This can be sunrise or any alos passed to this method.
+ * the start of day for calculating plag hamincha. This can be sunrise or any alos passed to this method.
* @param endOfDay
- * the end of day for calculating plag. This can be sunset or any tzais passed to this method.
+ * the end of day for calculating plag hamincha. This can be sunset or any tzais passed to this method.
* @return the Date
of the time of plag hamincha based on the start and end of day times
* passed to this method. If the calculation can't be computed such as in the Arctic Circle where there is
* at least one day a year where the sun does not rise, and one where it does not set, a null
@@ -955,8 +963,8 @@ public Date getPlagHamincha(Date startOfDay, Date endOfDay) {
/**
* This method returns plag hamincha, that is 10.75 * {@link #getShaahZmanisGra() shaos zmaniyos}
* (solar hours) after {@link #getSunrise() sunrise} or {@link #getSeaLevelSunrise() sea level sunrise} (depending on
- * the {@link #isUseElevation()} setting), according to the GRA. Plag hamincha is the earliest time that Shabbos can be started.
+ * the {@link #isUseElevation()} setting), according to the GRA. Plag hamincha is the earliest time that Shabbos can be started.
* The day is calculated from {@link #getSeaLevelSunrise() sea level sunrise} to {@link #getSeaLevelSunset() sea level
* sunset} or {@link #getSunrise() sunrise} to {@link #getSunset() sunset} (depending on the {@link #isUseElevation()}
*
@@ -974,12 +982,11 @@ public Date getPlagHamincha() {
/**
* A method that returns a shaah zmanis ({@link #getTemporalHour(Date, Date) temporal hour}) according to
- * the opinion of the GRA. This calculation divides
- * the day based on the opinion of the GRA that the day runs from {@link #getSeaLevelSunrise() sea
- * level sunrise} to {@link #getSeaLevelSunrise sea level sunset} or {@link #getSunrise() sunrise} to
- * {@link #getSunset() sunset} (depending on the {@link #isUseElevation()} setting). The day is split into 12 equal
- * parts with each one being a shaah zmanis. This method is similar to {@link #getTemporalHour}, but can
- * account for elevation.
+ * the opinion of the GRA. This calculation divides the day
+ * based on the opinion of the GRA that the day runs from from {@link #getSeaLevelSunrise() sea level
+ * sunrise} to {@link #getSeaLevelSunset() sea level sunset} or {@link #getSunrise() sunrise} to {@link #getSunset()
+ * sunset} (depending on the {@link #isUseElevation()} setting). The day is split into 12 equal parts with each one
+ * being a shaah zmanis. This method is similar to {@link #getTemporalHour()}, but can account for elevation.
*
* @return the long
millisecond length of a shaah zmanis calculated from sunrise to sunset.
* If the calculation can't be computed such as in the Arctic Circle where there is at least one day a year
@@ -996,11 +1003,11 @@ public long getShaahZmanisGra() {
/**
* A method that returns a shaah zmanis (temporal hour) according to the opinion of the Magen Avraham (MGA) based on 72 minutes alos
+ * "https://en.wikipedia.org/wiki/Avraham_Gombinern">Magen Avraham (MGA) based on a 72-minute alos
* and tzais. This calculation divides the day that runs from dawn to dusk (for sof zman krias shema and
* tfila). Dawn for this calculation is 72 minutes before {@link #getSunrise() sunrise} or {@link #getSeaLevelSunrise()
* sea level sunrise} (depending on the {@link #isUseElevation()} elevation setting) and dusk is 72 minutes after {@link
- * #getSunset sunset} or {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()} elevation
+ * #getSunset() sunset} or {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()} elevation
* setting). This day is split into 12 equal parts with each part being a shaah zmanis. Alternate methods of calculating
* a shaah zmanis according to the Magen Avraham (MGA) are available in the subclass {@link ComplexZmanimCalendar}.
*
@@ -1086,19 +1093,19 @@ public boolean isAssurBemlacha(Date currentTime, Date tzais, boolean inIsrael) {
if (jewishCalendar.hasCandleLighting() && currentTime.compareTo(getElevationAdjustedSunset()) >= 0) { //erev shabbos, YT or YT sheni and after shkiah
return true;
}
-
- //is shabbos or YT and it is before tzais
- return jewishCalendar.isAssurBemelacha() && currentTime.compareTo(tzais) <= 0;
- }
+
+ //is shabbos or YT and it is before tzais
+ return jewishCalendar.isAssurBemelacha() && currentTime.compareTo(tzais) <= 0;
+ }
/**
* A generic utility method for calculating any shaah zmanis (temporal hour) based zman with the
* day defined as the start and end of day (or night) and the number of shaos zmaniyos passed to the
* method. This simplifies the code in other methods such as {@link #getPlagHamincha(Date, Date)} and cuts down on
- * code replication. As an example, passing {@link #getSunrise() sunrise} and {@link #getSunset sunset} or {@link
+ * code replication. As an example, passing {@link #getSunrise() sunrise} and {@link #getSunset() sunset} or {@link
* #getSeaLevelSunrise() sea level sunrise} and {@link #getSeaLevelSunset() sea level sunset} (depending on the
* {@link #isUseElevation()} elevation setting) and 10.75 hours to this method will return plag mincha
- * according to the opinion of the GRA.
+ * according to the opinion of the GRA.
*
* @param startOfDay
* the start of day for calculating the zman. This can be sunrise or any alos passed
@@ -1127,7 +1134,7 @@ public Date getShaahZmanisBasedZman(Date startOfDay, Date endOfDay, double hours
* for those who want to use the Minchas Cohen in Ma'amar 2:4
* and the Pri Chadash who calculate tzais as a percentage
* of the day after sunset. While the Minchas Cohen only applies this to 72 minutes or a 1/10 of the day around the world (based
- * on the equinox / equilux in Israel, this method allows calculations for any degrees level for any location.
+ * on the equinox / equilux in Israel), this method allows calculations for any degree level for any location.
*
* @param degrees
* the number of degrees below the horizon after sunset.
@@ -1140,7 +1147,7 @@ public Date getShaahZmanisBasedZman(Date startOfDay, Date endOfDay, double hours
public double getPercentOfShaahZmanisFromDegrees(double degrees, boolean sunset) {
Date seaLevelSunrise = getSeaLevelSunrise();
Date seaLevelSunset = getSeaLevelSunset();
- Date twilight;
+ Date twilight = null;
if (sunset) {
twilight = getSunsetOffsetByDegrees(GEOMETRIC_ZENITH + degrees);
} else {