diff --git a/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java b/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java
index 48efef65..be679acb 100644
--- a/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java
+++ b/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java
@@ -356,10 +356,9 @@ public Date getAlos72() {
* zmaniyos after sunrise), while the NOAACalculator calculates it more accurately as {@link #getSunTransit() astronomical
* chatzos}. See The Definition of Chatzos
* for a detailed explanation of the ways to calculate Chatzos. Since half-day chatzos can be null
in
- * the Arctic on a day when either sunrise or sunset did not happen and astronomical chatzos can be calculated even in that
- * case, even if it is not configured to use astronomical chatzos, if half-day chatzos is null and astronomical
- * chatzos is supported by the calculator, astronomical chatzos will be returned in an effort to not return a
- * null
.
+ * the Arctic on a day when either sunrise or sunset did not happen and astronomical chatzos can be calculated even in the
+ * Arctic, if half-day chatzos calculates as null
and astronomical chatzos is supported by the
+ * calculator, astronomical chatzos will be returned to avoid returning a null
.
*
* @see AstronomicalCalendar#getSunTransit()
* @see #getChatzosAsHalfDay()
@@ -417,15 +416,19 @@ public Date getChatzosAsHalfDay() {
}
/**
- * A generic method for calculating the latest zman krias shema (time to recite shema in the morning)
- * that is 3 * 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 the latest zman krias shema is calculated as 3 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 sunrise} and {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()}
- * elevation setting) to this method will return sof zman krias shema according to the opinion of the
- * GRA.
+ * A generic method for calculating the latest zman krias shema (time to recite shema in the morning) that is 3 *
+ * 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 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
+ * #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
+ * 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.
*
* @param startOfDay
* the start of day for calculating zman krias shema. This can be sunrise or any alos passed
@@ -433,13 +436,42 @@ public Date getChatzosAsHalfDay() {
* @param endOfDay
* the end of day for calculating zman krias shema. 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
+ * definition chatzos will not be the middle of the day for the zman.
+ * @see #isUseAstronomicalChatzosForOtherZmanim()
* @return the Date
of the latest zman shema 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
will be returned. See
* detailed explanation on top of the {@link AstronomicalCalendar} documentation.
*/
+ public Date getSofZmanShma(Date startOfDay, Date endOfDay, boolean synchronous) {
+ if(isUseAstronomicalChatzosForOtherZmanim() && synchronous) {
+ return getHalfDayBasedZman(startOfDay, getChatzos(), 3);
+ } else {
+ return getShaahZmanisBasedZman(startOfDay, endOfDay, 3);
+ }
+ }
+
+ /**
+ * A generic method for calculating the latest zman krias shema that calls {@link #getSofZmanShma(Date, Date, boolean)}
+ * passing false
to the synchronous parameter since there is now 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 zman krias shema. This can be sunrise or any alos passed
+ * to this method.
+ * @param endOfDay
+ * the end of day for calculating zman krias shema. This can be sunset or any tzais passed to
+ * this method.
+ * @return the Date
of the latest zman shema 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
will be returned. See
+ * detailed explanation on top of the {@link AstronomicalCalendar} documentation.
+ * @see #getSofZmanShma(Date, Date, boolean)
+ */
public Date getSofZmanShma(Date startOfDay, Date endOfDay) {
- return getShaahZmanisBasedZman(startOfDay, endOfDay, 3);
+ return getSofZmanShma(startOfDay, endOfDay, false);
}
/**
@@ -461,7 +493,7 @@ public Date getSofZmanShma(Date startOfDay, Date endOfDay) {
* of the {@link AstronomicalCalendar} documentation.
*/
public Date getSofZmanShmaGRA() {
- return getSofZmanShma(getElevationAdjustedSunrise(), getElevationAdjustedSunset());
+ return getSofZmanShma(getElevationAdjustedSunrise(), getElevationAdjustedSunset(), true);
}
/**
@@ -482,7 +514,7 @@ public Date getSofZmanShmaGRA() {
* @see ComplexZmanimCalendar#getSofZmanShmaMGA72Minutes() that
*/
public Date getSofZmanShmaMGA() {
- return getSofZmanShma(getAlos72(), getTzais72());
+ return getSofZmanShma(getAlos72(), getTzais72(), true);
}
/**
@@ -532,7 +564,13 @@ public Date getCandleLighting() {
* 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.
+ * "https://en.wikipedia.org/wiki/Vilna_Gaon">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 genoim 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 zman tfilah. This can be sunrise or any alos passed
@@ -540,13 +578,41 @@ public Date getCandleLighting() {
* @param endOfDay
* the end of day for calculating zman tfilah. 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
+ * definition chatzos will not be the middle of the day for the zman.
* @return the Date
of the latest zman tfilah 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
will be
* returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
*/
+ public Date getSofZmanTfila(Date startOfDay, Date endOfDay, boolean synchronous) {
+ if(isUseAstronomicalChatzosForOtherZmanim() && synchronous) {
+ return getHalfDayBasedZman(startOfDay, getChatzos(), 4);
+ } else {
+ return getShaahZmanisBasedZman(startOfDay, endOfDay, 4);
+ }
+ }
+
+ /**
+ * A generic method for calculating the latest zman tfila that calls {@link #getSofZmanTfila(Date, Date, boolean)}
+ * passing false
to the synchronous parameter since there is now 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 zman tfilah. This can be sunrise or any alos passed
+ * to this method.
+ * @param endOfDay
+ * the end of day for calculating zman tfilah. This can be sunset or any tzais passed to
+ * this method.
+ * @return the Date
of the latest zman tfilah 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
will be returned. See
+ * detailed explanation on top of the {@link AstronomicalCalendar} documentation.
+ * @see #getSofZmanShma(Date, Date, boolean)
+ */
public Date getSofZmanTfila(Date startOfDay, Date endOfDay) {
- return getShaahZmanisBasedZman(startOfDay, endOfDay, 4);
+ return getSofZmanTfila(startOfDay, endOfDay, false);
}
/**
@@ -567,7 +633,7 @@ public Date getSofZmanTfila(Date startOfDay, Date endOfDay) {
* {@link AstronomicalCalendar} documentation.
*/
public Date getSofZmanTfilaGRA() {
- return getSofZmanTfila(getElevationAdjustedSunrise(), getElevationAdjustedSunset());
+ return getSofZmanTfila(getElevationAdjustedSunrise(), getElevationAdjustedSunset(), true);
}
/**
@@ -587,22 +653,28 @@ public Date getSofZmanTfilaGRA() {
* @see #getAlos72()
*/
public Date getSofZmanTfilaMGA() {
- return getSofZmanTfila(getAlos72(), getTzais72());
+ return getSofZmanTfila(getAlos72(), getTzais72(), true);
}
/**
- * A generic method for calculating the latest mincha gedola (the earliest time to recite the mincha1
- * prayers) that 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 #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
+ * A generic method for calculating mincha gedola (the earliest time to recite the mincha1 prayers) that
+ * 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
+ * #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
* #isUseAstronomicalChatzosForOtherZmanim()} to control if the time is based on 6.5 sha'os 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.
+ * #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 genoim
+ * 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 Mincha gedola. This can be sunrise or any alos passed
@@ -610,6 +682,10 @@ public Date getSofZmanTfilaMGA() {
* @param endOfDay
* the end of day for calculating Mincha gedola. 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
+ * definition chatzos will not be the middle of the day for the zman.
* @return the Date
of the time of Mincha gedola 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
will
@@ -620,13 +696,34 @@ public Date getSofZmanTfilaMGA() {
* @see #isUseAstronomicalChatzos()
* @see #isUseAstronomicalChatzosForOtherZmanim()
*/
- public Date getMinchaGedola(Date startOfDay, Date endOfDay) {
- if(isUseAstronomicalChatzosForOtherZmanim()) {
+ public Date getMinchaGedola(Date startOfDay, Date endOfDay, boolean synchronous) {
+ if(isUseAstronomicalChatzosForOtherZmanim() && synchronous) {
return getHalfDayBasedZman(getChatzos(), endOfDay, 0.5);
} else {
return getShaahZmanisBasedZman(startOfDay, endOfDay, 6.5);
}
}
+
+ /**
+ * A generic method for calculating mincha gedola that calls {@link #getMinchaGedola(Date, Date, boolean)} passing
+ * false
to the synchronous parameter since there is now 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 Mincha gedola. This can be sunrise or any alos passed
+ * to this method.
+ * @param endOfDay
+ * the end of day for calculating Mincha gedola. This can be sunset or any tzais passed to
+ * this method.
+ * @return the Date
of the latest Mincha gedola 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
will be returned. See
+ * detailed explanation on top of the {@link AstronomicalCalendar} documentation.
+ * @see #getMinchaGedola(Date, Date, boolean)
+ */
+ public Date getMinchaGedola(Date startOfDay, Date endOfDay) {
+ return getMinchaGedola(startOfDay, endOfDay, false);
+ }
/**
* This method returns the latest mincha gedola,the earliest time one can pray mincha that is 6.5 *
@@ -653,11 +750,7 @@ public Date getMinchaGedola(Date startOfDay, Date endOfDay) {
* {@link AstronomicalCalendar} documentation.
*/
public Date getMinchaGedola() {
- if(isUseAstronomicalChatzosForOtherZmanim()) {
- return getHalfDayBasedZman(getChatzos(), getSunset(), 0.5);
- } else {
- return getMinchaGedola(getElevationAdjustedSunrise(), getElevationAdjustedSunset());
- }
+ return getMinchaGedola(getElevationAdjustedSunrise(), getElevationAdjustedSunset(), true);
}
/**
@@ -677,6 +770,10 @@ public Date getMinchaGedola() {
* @param endOfDay
* the end of day for calculating samuch lemincha ketana. 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
+ * definition chatzos will not be the middle of the day for the zman.
* @return the Date
of the time of Mincha ketana 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
will
@@ -686,8 +783,32 @@ public Date getMinchaGedola() {
* @see ComplexZmanimCalendar#getSamuchLeMinchaKetana16Point1Degrees()
* @see ComplexZmanimCalendar#getSamuchLeMinchaKetana72Minutes()
*/
+ public Date getSamuchLeMinchaKetana(Date startOfDay, Date endOfDay, boolean synchronous) {
+ if(isUseAstronomicalChatzosForOtherZmanim()) {
+ return getHalfDayBasedZman(getChatzos(), endOfDay, 3);
+ } else {
+ return getShaahZmanisBasedZman(startOfDay, endOfDay, 9);
+ }
+ }
+
+ /**
+ * A generic method for calculating samuch lemincha ketana that calls {@link #getSamuchLeMinchaKetana(Date, Date, boolean)}
+ * passing false
to the synchronous parameter since there is now 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 samuch lemincha ketana. This can be sunrise or any alos
+ * passed to to this method.
+ * @param endOfDay
+ * the end of day for calculating samuch lemincha ketana. This can be sunset or any tzais
+ * passed to this method.
+ * @return the Date
of the time of samuch lemincha ketana 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
will
+ * be returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
+ * @see #getSamuchLeMinchaKetana(Date, Date, boolean)
+ */
public Date getSamuchLeMinchaKetana(Date startOfDay, Date endOfDay) {
- return getShaahZmanisBasedZman(startOfDay, endOfDay, 9);
+ return getSamuchLeMinchaKetana(startOfDay, endOfDay, false);
}
/**
@@ -700,7 +821,13 @@ public Date getSamuchLeMinchaKetana(Date startOfDay, Date endOfDay) {
* 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.
+ * GRA. This method's synchronous parameter indicates ifthe 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 genoim 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 Mincha ketana. This can be sunrise or any alos passed
@@ -708,13 +835,41 @@ public Date getSamuchLeMinchaKetana(Date startOfDay, Date endOfDay) {
* @param endOfDay
* the end of day for calculating Mincha ketana. 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
+ * definition chatzos will not be the middle of the day for the zman.
+ * @return the Date
of the time of Mincha ketana 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
will
+ * be returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
+ */
+ public Date getMinchaKetana(Date startOfDay, Date endOfDay, boolean synchronous) {
+ if(isUseAstronomicalChatzosForOtherZmanim()) {
+ return getHalfDayBasedZman(getChatzos(), endOfDay, 3.5);
+ } else {
+ return getShaahZmanisBasedZman(startOfDay, endOfDay, 9.5);
+ }
+ }
+
+ /**
+ * A generic method for calculating mincha ketana that calls {@link #getMinchaKetana(Date, Date, boolean)} passing
+ * false
to the synchronous parameter since there is now 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 Mincha ketana. This can be sunrise or any alos passed
+ * to this method.
+ * @param endOfDay
+ * the end of day for calculating Mincha ketana. This can be sunset or any tzais passed to
+ * this method.
* @return the Date
of the time of Mincha ketana 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
will
* be returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
+ * @see #getMinchaKetana(Date, Date, boolean)
*/
public Date getMinchaKetana(Date startOfDay, Date endOfDay) {
- return getShaahZmanisBasedZman(startOfDay, endOfDay, 9.5);
+ return getMinchaKetana(startOfDay, endOfDay, false);
}
/**
@@ -738,7 +893,7 @@ public Date getMinchaKetana(Date startOfDay, Date endOfDay) {
* {@link AstronomicalCalendar} documentation.
*/
public Date getMinchaKetana() {
- return getMinchaKetana(getElevationAdjustedSunrise(), getElevationAdjustedSunset());
+ return getMinchaKetana(getElevationAdjustedSunrise(), getElevationAdjustedSunset(), true);
}
/**
@@ -750,19 +905,51 @@ public Date getMinchaKetana() {
* 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.
+ * 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 genoim 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.
* @param endOfDay
* the end of day for calculating plag. 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
+ * definition chatzos will not be the middle of the day for the zman.
+ * @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
+ * will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
+ */
+ public Date getPlagHamincha(Date startOfDay, Date endOfDay, boolean synchronous) {
+ if(isUseAstronomicalChatzosForOtherZmanim() && synchronous) {
+ return getHalfDayBasedZman(getChatzos(), endOfDay, 4.75);
+ } else {
+ return getShaahZmanisBasedZman(startOfDay, endOfDay, 10.75);
+ }
+ }
+
+ /**
+ * A generic method for calculating plag hamincha that calls {@link #getPlagHamincha(Date, Date, boolean)} passing
+ * false
to the synchronous parameter since there is now 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.
+ * @param endOfDay
+ * the end of day for calculating plag. 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
* will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation.
+ * @see #getPlagHamincha(Date, Date, boolean)
*/
public Date getPlagHamincha(Date startOfDay, Date endOfDay) {
- return getShaahZmanisBasedZman(startOfDay, endOfDay, 10.75);
+ return getPlagHamincha(startOfDay, endOfDay, false);
}
/**
@@ -773,6 +960,7 @@ public Date getPlagHamincha(Date startOfDay, Date endOfDay) {
* The day is calculated 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()}
*
+ * @see #getPlagHamincha(Date, Date, boolean)
* @see #getPlagHamincha(Date, Date)
* @see ComplexZmanimCalendar#getPlagHaminchaBaalHatanya()
* @return the Date
of the time of plag hamincha. If the calculation can't be computed such as
@@ -781,7 +969,7 @@ public Date getPlagHamincha(Date startOfDay, Date endOfDay) {
* {@link AstronomicalCalendar} documentation.
*/
public Date getPlagHamincha() {
- return getPlagHamincha(getElevationAdjustedSunrise(), getElevationAdjustedSunset());
+ return getPlagHamincha(getElevationAdjustedSunrise(), getElevationAdjustedSunset(), true);
}
/**
@@ -1031,6 +1219,7 @@ public Date getHalfDayBasedZman(Date startOfHalfDay, Date endOfHalfDay, double h
* {@link AstronomicalCalendar} documentation.
* @see #getHalfDayBasedZman(Date, Date, double)
* @see #isUseAstronomicalChatzosForOtherZmanim()
+ * @todo Consider adjusting various shaah zmanis times to use this.
*/
public long getHalfDayBasedShaahZmanis(Date startOfHalfDay, Date endOfHalfDay) {
if (startOfHalfDay == null || endOfHalfDay == null) {