diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 92f186bf..b36e3c0f 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -7,10 +7,10 @@ name: "CodeQL" on: push: - branches: [master] + branches: [3-0-mdernization] pull_request: # The branches below must be a subset of the branches above - branches: [master] + branches: [3-0-mdernization] schedule: - cron: '0 5 * * 1' @@ -63,4 +63,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 diff --git a/.gitignore b/.gitignore index e82f6727..28c4c146 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ target/ .idea/ zmanim.iml .gradle -build \ No newline at end of file +build +local.properties +*.class \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fcf1729..ca38b6ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ * `getTzais120()` -> `getTzais120Minutes()` * `getChatzos()` -> `getChatzosHayom()` * `getChatzosAsHalfDay()` -> `getChatzosHayomAsHalfDay()` + * `isAssurBemlacha()` -> `isAssurBemelacha()` * Rename some classes the confusingly named `ComplexZmanimCalendar` to `ComrehensiveZmanimCalendar`. * Move "legacy" classes to `java.time` equivelants * All zmanim now return `Instant`s insead of `Date` objects. @@ -69,7 +70,8 @@ * Tweaked logic in `AstronomicalCalendar.getInstantFromTime()` to address issues near the dateline. * Improve null handling in `ComprehensiveZmanimCalendar.getMoladBasedTime()` * Add `ComprehensiveZmanimCalendar.getMisheyakir12Point85Degrees()` -* `ComprehensiveZmanimcalendar.getMinchaGedolaGreaterThan30()` was moved to the parent `ZmanimCalendar.getMinchaGedolaGreaterThan30(Instant)` that allows it to work with any mincha gedola claculation. +* Add `getMinchaGedolaGreaterThan30(Instant)` that allows it to work with any mincha gedola claculation. +* `ComprehensiveZmanimcalendar.getMinchaGedolaGreaterThan30()` was renamed `getMinchaGedolaGRAGreaterThan30()` for clarity. * Change / remove `ComprehensiveZmanimcalendar` zmanim that were too early. * `getTzaisGeonim4Point37Degrees()` -> `getTzaisGeonim4Point42Degrees()`. * `getTzaisGeonim4Point61Degrees()` -> `getTzaisGeonim4Point66Degrees()` @@ -99,6 +101,7 @@ * [Add null checks in `getMinchaGedolaAhavatShalom()`](https://github.com/KosherJava/zmanim/commit/93f441f1ff87d4669c91b596eed157c9cf448bca) * [Fix `getAlos60()` to use `getElevationAdjustedSunrise()`](https://github.com/KosherJava/zmanim/commit/f5a5b2c68e1f0e2f9f4fbdd2cc585085f2914b74) * Update Tefila method to Use [Consistent Spelling](https://github.com/KosherJava/zmanim/commit/bca6ddb85542683f229d905636a06fbfc66fbe03). + * Add [`getSunsetOrWesternmostSolarAzimuth()` and `getSunriseOrEasternmostSolarAzimuth()`](https://github.com/KosherJava/zmanim/commit/ab9a903e94c33d31f1ce006a6102cdfa259786ad) methods. * `HebrewdateFormatter` * add method [`formatParsha(JewishCalendar.Parsha parsha)`](https://github.com/KosherJava/zmanim/commit/ee3347b04bf0f4221bc8aa71af59437cd7533f72) to allow formatting of a parsha retrieved from `JewishCalendar.getUpcomingParshah()`. * Add `getHebrewMonthList()` and `setHebrewMonthList(String[])`. This allows overriding the default month of Chesvan to Marcheshvan etc. @@ -113,7 +116,10 @@ * [add missing brace to `isYomTov()` and simplify logic](https://github.com/KosherJava/zmanim/commit/e34fc879313b045f35e70b5947e2c2e20a4364c5) * `GeoLocation` - [add NaN validation to `setLatitude` and `setLongitude`](https://github.com/KosherJava/zmanim/commit/d064715ebeaead29a01ec673f3885ee9bd9c78b4) * `NOAACalculator` - [fix Solar Azimuth and Elevation](https://github.com/KosherJava/zmanim/commit/860f1939c25b38dd4d23adb1772b12ccbc71fc76) -* `AstronomicalCalculator` - [add `getSolarAzimuth()` and `getSolarElevation()`](https://github.com/KosherJava/zmanim/commit/feecf7ad2d9ce527cfe0314ae01710d68c6c3c2e) +* `AstronomicalCalculator` Add some methods + * `getSolarAzimuth()` + * `getSolarElevation()` + * `getTimeAtAzimuth()` * `AstronomicalCalendar` * [Fix null handling in `getSunTransit(Date,Date)`](https://github.com/KosherJava/zmanim/commit/8221e2895cbab62b037c16de1711f9faacd78a7b) * [Deprecate `getSunriseSolarDipFromOffset` and `getSunsetSolarDipFromOffset`](https://github.com/KosherJava/zmanim/commit/0ce858258bff15c11235b1f1063d2eb0ef22b994) @@ -121,6 +127,7 @@ * [Add `getLocalMeanTime()`](https://github.com/KosherJava/zmanim/commit/14bcdc085011ccce327f69d6a001772c0581fcc2). * [Move `getSolarMidnight()`](https://github.com/KosherJava/zmanim/commit/a4535717353eb77da10b6951e4a627b10258ac9e) to the parent class where it belongs. * [Correct USNO noon calculation](https://github.com/KosherJava/zmanim/commit/3735c92289a66039b24d7e2b470955b5297f0ca5) in some locations where it was sometimes 12 hours off. + * [Add `getTimeAtAzimuth(double azimuth)`](https://github.com/KosherJava/zmanim/commit/05a3bc3cdb2dbc88ffca89be0828f50abf62969f) ## [2.5.0](https://github.com/KosherJava/zmanim/compare/2.4.0...2.5.0) (2023-06-09) diff --git a/src/main/java/com/kosherjava/zmanim/AstronomicalCalendar.java b/src/main/java/com/kosherjava/zmanim/AstronomicalCalendar.java index 04f829d6..33cbee37 100644 --- a/src/main/java/com/kosherjava/zmanim/AstronomicalCalendar.java +++ b/src/main/java/com/kosherjava/zmanim/AstronomicalCalendar.java @@ -1,6 +1,6 @@ /* * Zmanim Java API - * Copyright (C) 2004-2025 Eliyahu Hershfeld + * Copyright (C) 2004-2026 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) @@ -16,29 +16,33 @@ package com.kosherjava.zmanim; import java.math.BigDecimal; -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.util.Objects; import com.kosherjava.zmanim.util.AstronomicalCalculator; import com.kosherjava.zmanim.util.GeoLocation; import com.kosherjava.zmanim.util.ZmanimFormatter; /** - * A Java calendar that calculates astronomical times such as {@link #getSunrise() sunrise}, {@link #getSunset() - * sunset} and twilight times. This class contains a {@link #getCalendar() Calendar} and can therefore use the standard - * Calendar functionality to change dates etc. The calculation engine used to calculate the astronomical times can be - * changed to a different implementation by implementing the abstract {@link AstronomicalCalculator} and setting it with - * the {@link #setAstronomicalCalculator(AstronomicalCalculator)}. A number of different calculation engine - * implementations are included in the util package. - * Note: There are times when the algorithms can't calculate proper values for sunrise, sunset and twilight. This - * is usually caused by trying to calculate times for areas either very far North or South, where sunrise / sunset never - * happen on that date. This is common when calculating twilight with a deep dip below the horizon for locations as far - * south of the North Pole as London, in the northern hemisphere. The sun never reaches this dip at certain times of the - * year. When the calculations encounter this condition a null will be returned when a - * {@link java.util.Date} is expected and {@link Long#MIN_VALUE} when a long is expected. The - * reason that Exceptions are not thrown in these cases is because the lack of a rise/set or twilight is - * not an exception, but an expected condition in many parts of the world. + * A Java calendar that calculates astronomical times such as {@link getSunrise() sunrise}, {@link + * getSunset() sunset} and twilight times. This class contains a {@link getLocalDate() LocalDate} and can therefore + * use the standard Calendar functionality to change dates etc. The calculation engine used to calculate the astronomical times can + * be changed to a different implementation by implementing the abstract {@link AstronomicalCalculator} and setting it withthe {@link + * setAstronomicalCalculator(AstronomicalCalculator)}. A number of different calculation engine implementations are included in the + * util package. + * Note: There are times when the algorithms can't calculate proper values for sunrise, sunset and twilight. This is usually + * caused by trying to calculate times for areas either very far North or South, where sunrise / sunset never happen on that date. + * This is common when calculating twilight with a deep dip below the horizon for locations as far south of the North Pole as London, + * in the northern hemisphere. The sun never reaches this dip at certain times of the year. When the calculations encounter this + * condition a null will be returned when a {@link java.time.Instant} is expected and {@link Long#MIN_VALUE} + * when a long is expected. The reason that Exceptions are not thrown in these cases is because the lack of + * a rise/set or twilight is not an exception, but an expected condition in many parts of the world. *

* Here is a simple example of how to use the API to calculate sunrise. * First create the Calendar for the location you would like to calculate sunrise or sunset times for: @@ -48,31 +52,30 @@ * double latitude = 40.0828; // Lakewood, NJ * double longitude = -74.2094; // Lakewood, NJ * double elevation = 20; // optional elevation correction in Meters - * // the String parameter in getTimeZone() has to be a valid timezone listed in - * // {@link java.util.TimeZone#getAvailableIDs()} - * TimeZone timeZone = TimeZone.getTimeZone("America/New_York"); - * GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone); + * // the String parameter in getZoneId() has to be a valid ZoneId listed in {@link java.time.ZoneId#getAvailableZoneIds()} + * ZoneId zoneId = ZoneId.of("America/New_York"); + * GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, zoneId); * AstronomicalCalendar ac = new AstronomicalCalendar(location); * * * To get the time of sunrise, first set the date you want (if not set, the date will default to today): * *

- * ac.getCalendar().set(Calendar.MONTH, Calendar.FEBRUARY);
- * ac.getCalendar().set(Calendar.DAY_OF_MONTH, 8);
- * Date sunrise = ac.getSunrise();
+ * LocalDate localDate = LocalDate.of(1969, Month.FEBRUARY, 8);
+ * ac.setLocalDate(localDate);
+ * Instant sunrise = ac.getSunrise();
  * 
* - * @author © Eliyahu Hershfeld 2004 - 2025 + * @author © Eliyahu Hershfeld 2004 - 2026 */ public class AstronomicalCalendar implements Cloneable { /** - * 90° below the vertical. Used as a basis for most calculations since the location of the sun is 90° below - * the horizon at sunrise and sunset. - * Note : it is important to note that for sunrise and sunset the {@link AstronomicalCalculator#adjustZenith - * adjusted zenith} is required to account for the radius of the sun and refraction. The adjusted zenith should not - * be used for calculations above or below 90° since they are usually calculated as an offset to 90°. + * 90° below the vertical. Used as a basis for most calculations since the location of the sun is 90° below the horizon + * at sunrise and sunset. + * Note : it is important to note that for sunrise and sunset the {@link AstronomicalCalculator#adjustZenith(double, + * double) adjusted zenith} is required to account for the radius of the sun and refraction. The adjusted zenith should not be + * used for calculations above or below 90° since they are usually calculated as an offset to 90°. */ public static final double GEOMETRIC_ZENITH = 90; @@ -90,11 +93,11 @@ public class AstronomicalCalendar implements Cloneable { /** constant for milliseconds in an hour (3,600,000) */ public static final long HOUR_MILLIS = MINUTE_MILLIS * 60; - + /** - * The Java Calendar encapsulated by this class to track the current date used by the class + * The LocalDate encapsulated by this class to track the current date used by the class */ - private Calendar calendar; + private LocalDate localDate; /** * the {@link GeoLocation} used for calculations. @@ -107,27 +110,26 @@ public class AstronomicalCalendar implements Cloneable { private AstronomicalCalculator astronomicalCalculator; /** - * The getSunrise method returns a Date representing the - * {@link AstronomicalCalculator#getElevationAdjustment(double) elevation adjusted} sunrise time. The zenith used - * for the calculation uses {@link #GEOMETRIC_ZENITH geometric zenith} of 90° plus - * {@link AstronomicalCalculator#getElevationAdjustment(double)}. This is adjusted by the - * {@link AstronomicalCalculator} to add approximately 50/60 of a degree to account for 34 archminutes of refraction - * and 16 archminutes for the sun's radius for a total of {@link AstronomicalCalculator#adjustZenith 90.83333°}. + * The getSunrise method returns a Instant representing the {@link AstronomicalCalculator + * #getElevationAdjustment(double) elevation adjusted} sunrise time. The zenith used for the calculation uses {@link + * GEOMETRIC_ZENITH geometric zenith} of 90° plus {@link AstronomicalCalculator#getElevationAdjustment(double)}. This is + * adjusted by the {@link AstronomicalCalculator} to add approximately 50/60 of a degree to account for 34 archminutes of + * refraction and 16 archminutes for the sun's radius for a total of {@link AstronomicalCalculator#adjustZenith 90.83333°}. * See documentation for the specific implementation of the {@link AstronomicalCalculator} that you are using. * - * @return the Date representing the exact sunrise 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, a null will be returned. See detailed explanation on top of the page. - * @see AstronomicalCalculator#adjustZenith - * @see #getSeaLevelSunrise() - * @see AstronomicalCalendar#getUTCSunrise + * @return the Instant representing the exact sunrise 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, a + * null will be returned. See detailed explanation on top of the page. + * @see AstronomicalCalculator#adjustZenith(double, double) + * @see getSeaLevelSunrise() + * @see getUTCSunrise(double) */ - public Date getSunrise() { + public Instant getSunrise() { double sunrise = getUTCSunrise(GEOMETRIC_ZENITH); if (Double.isNaN(sunrise)) { return null; } else { - return getDateFromTime(sunrise, SolarEvent.SUNRISE); + return getInstantFromTime(sunrise, SolarEvent.SUNRISE); } } @@ -137,253 +139,236 @@ public Date getSunrise() { * something that is not affected by elevation. This method returns sunrise calculated at sea level. This forms the * base for dawn calculations that are calculated as a dip below the horizon before sunrise. * - * @return the Date representing the exact sea-level sunrise time. If the calculation can't be computed + * @return the Instant representing the exact sea-level sunrise 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, a null will be returned. See detailed explanation on top of the page. - * @see AstronomicalCalendar#getSunrise - * @see AstronomicalCalendar#getUTCSeaLevelSunrise - * @see #getSeaLevelSunset() + * @see getSunrise() + * @see getUTCSeaLevelSunrise(double) + * @see getSeaLevelSunset() */ - public Date getSeaLevelSunrise() { + public Instant getSeaLevelSunrise() { double sunrise = getUTCSeaLevelSunrise(GEOMETRIC_ZENITH); if (Double.isNaN(sunrise)) { return null; } else { - return getDateFromTime(sunrise, SolarEvent.SUNRISE); + return getInstantFromTime(sunrise, SolarEvent.SUNRISE); } } /** * A method that returns the beginning of civil twilight - * (dawn) using a zenith of {@link #CIVIL_ZENITH 96°}. + * (dawn) using a zenith of {@link CIVIL_ZENITH 96°}. * - * @return The Date of the beginning of civil twilight using a zenith of 96°. If the calculation + * @return The Instant of the beginning of civil twilight using a zenith of 96°. If the calculation * can't be computed, null will be returned. See detailed explanation on top of the page. - * @see #CIVIL_ZENITH */ - public Date getBeginCivilTwilight() { + public Instant getBeginCivilTwilight() { return getSunriseOffsetByDegrees(CIVIL_ZENITH); } /** - * A method that returns the beginning of nautical twilight using a zenith of {@link - * #NAUTICAL_ZENITH 102°}. + * A method that returns the beginning of nautical twilight + * using a zenith of {@link NAUTICAL_ZENITH 102°}. * - * @return The Date of the beginning of nautical twilight using a zenith of 102°. If the calculation + * @return The Instant of the beginning of nautical twilight using a zenith of 102°. If the calculation * can't be computed null will be returned. See detailed explanation on top of the page. - * @see #NAUTICAL_ZENITH */ - public Date getBeginNauticalTwilight() { + public Instant getBeginNauticalTwilight() { return getSunriseOffsetByDegrees(NAUTICAL_ZENITH); } /** - * A method that returns the beginning of astronomical twilight using a zenith of - * {@link #ASTRONOMICAL_ZENITH 108°}. + * A method that returns the beginning of astronomical + * twilight using a zenith of {@link ASTRONOMICAL_ZENITH 108°}. * - * @return The Date of the beginning of astronomical twilight using a zenith of 108°. If the calculation + * @return The Instant of the beginning of astronomical twilight using a zenith of 108°. If the calculation * can't be computed, null will be returned. See detailed explanation on top of the page. - * @see #ASTRONOMICAL_ZENITH */ - public Date getBeginAstronomicalTwilight() { + public Instant getBeginAstronomicalTwilight() { return getSunriseOffsetByDegrees(ASTRONOMICAL_ZENITH); } - /** - * The getSunset method returns a Date representing the - * {@link AstronomicalCalculator#getElevationAdjustment(double) elevation adjusted} sunset time. The zenith used for - * the calculation uses {@link #GEOMETRIC_ZENITH geometric zenith} of 90° plus - * {@link AstronomicalCalculator#getElevationAdjustment(double)}. This is adjusted by the - * {@link AstronomicalCalculator} to add approximately 50/60 of a degree to account for 34 archminutes of refraction - * and 16 archminutes for the sun's radius for a total of {@link AstronomicalCalculator#adjustZenith 90.83333°}. - * See documentation for the specific implementation of the {@link AstronomicalCalculator} that you are using. Note: - * In certain cases the calculates sunset will occur before sunrise. This will typically happen when a timezone - * other than the local timezone is used (calculating Los Angeles sunset using a GMT timezone for example). In this - * case the sunset date will be incremented to the following date. - * - * @return the Date representing the exact sunset 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, a null will be returned. See detailed explanation on top of the page. - * @see AstronomicalCalculator#adjustZenith - * @see #getSeaLevelSunset() - * @see AstronomicalCalendar#getUTCSunset - */ - public Date getSunset() { - double sunset = getUTCSunset(GEOMETRIC_ZENITH); - if (Double.isNaN(sunset)) { - return null; - } else { - return getDateFromTime(sunset, SolarEvent.SUNSET); - } - } - - /** - * A method that returns the sunset without {@link AstronomicalCalculator#getElevationAdjustment(double) elevation - * adjustment}. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, - * something that is not affected by elevation. This method returns sunset calculated at sea level. This forms the - * base for dusk calculations that are calculated as a dip below the horizon after sunset. - * - * @return the Date representing the exact sea-level sunset time. If the calculation can't be computed + /** + * The getSunset method returns an Instant representing the + * {@link AstronomicalCalculator#getElevationAdjustment(double) elevation adjusted} sunset time. The zenith used for the + * calculation uses {@link GEOMETRIC_ZENITH geometric zenith} of 90° plus {@link AstronomicalCalculator + * #getElevationAdjustment(double)}. This is adjusted by the {@link AstronomicalCalculator} to add approximately 50/60 of a + * degree to account for 34 archminutes of refraction and 16 archminutes for the sun's radius for a total of {@link + * AstronomicalCalculator#adjustZenith(double, double) 90.83333°}. See documentation for the specific implementation of the + * {@link AstronomicalCalculator} that you are using. + * Note: In certain cases the calculates sunset will occur before sunrise. This will typically happen when a time zone other than + * the local timezone is used (calculating Los Angeles sunset using a GMT time zone for example). In this case the sunset date + * will be incremented to the following date. + * + * @return the Instant representing the exact sunset 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, a + * null will be returned. See detailed explanation on top of the page. + * @see AstronomicalCalculator#adjustZenith(double, double) + * @see getSeaLevelSunset() + * @see getUTCSunset(double) + */ + public Instant getSunset() { + double sunset = getUTCSunset(GEOMETRIC_ZENITH); + if (Double.isNaN(sunset)) { + return null; + } else { + return getInstantFromTime(sunset, SolarEvent.SUNSET); + } + } + + /** + * A method that returns the sunset without {@link AstronomicalCalculator#getElevationAdjustment(double) elevation adjustment}. + * Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, something that is not + * affected by elevation. This method returns sunset calculated at sea level. This forms the base for dusk calculations that are + * calculated as a dip below the horizon after sunset. + * + * @return the Instant representing the exact sea-level sunset 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, a null will be returned. See detailed explanation on top of the page. - * @see AstronomicalCalendar#getSunset - * @see AstronomicalCalendar#getUTCSeaLevelSunset - * @see #getSunset() + * @see getSunset() + * @see getUTCSeaLevelSunset(double) */ - public Date getSeaLevelSunset() { + public Instant getSeaLevelSunset() { double sunset = getUTCSeaLevelSunset(GEOMETRIC_ZENITH); if (Double.isNaN(sunset)) { return null; } else { - return getDateFromTime(sunset, SolarEvent.SUNSET); + return getInstantFromTime(sunset, SolarEvent.SUNSET); } } /** * A method that returns the end of civil twilight - * using a zenith of {@link #CIVIL_ZENITH 96°}. + * using a zenith of {@link CIVIL_ZENITH 96°}. * - * @return The Date of the end of civil twilight using a zenith of {@link #CIVIL_ZENITH 96°}. If the + * @return The Instant of the end of civil twilight using a zenith of {@link CIVIL_ZENITH 96°}. If the * calculation can't be computed, null will be returned. See detailed explanation on top of the page. - * @see #CIVIL_ZENITH */ - public Date getEndCivilTwilight() { + public Instant getEndCivilTwilight() { return getSunsetOffsetByDegrees(CIVIL_ZENITH); } /** - * A method that returns the end of nautical twilight using a zenith of {@link #NAUTICAL_ZENITH 102°}. + * A method that returns the end of nautical twilight using a zenith of {@link NAUTICAL_ZENITH 102°}. * - * @return The Date of the end of nautical twilight using a zenith of {@link #NAUTICAL_ZENITH 102°}. If + * @return The Instant of the end of nautical twilight using a zenith of {@link NAUTICAL_ZENITH 102°}. If * the calculation can't be computed, null will be returned. See detailed explanation on top of the * page. - * @see #NAUTICAL_ZENITH */ - public Date getEndNauticalTwilight() { + public Instant getEndNauticalTwilight() { return getSunsetOffsetByDegrees(NAUTICAL_ZENITH); } /** - * A method that returns the end of astronomical twilight using a zenith of {@link #ASTRONOMICAL_ZENITH 108°}. + * A method that returns the end of astronomical twilight using a zenith of {@link ASTRONOMICAL_ZENITH 108°}. * - * @return the Date of the end of astronomical twilight using a zenith of {@link #ASTRONOMICAL_ZENITH + * @return the Instant of the end of astronomical twilight using a zenith of {@link ASTRONOMICAL_ZENITH * 108°}. If the calculation can't be computed, null will be returned. See detailed * explanation on top of the page. - * @see #ASTRONOMICAL_ZENITH */ - public Date getEndAstronomicalTwilight() { + public Instant getEndAstronomicalTwilight() { return getSunsetOffsetByDegrees(ASTRONOMICAL_ZENITH); } /** * A utility method that returns a date offset by the offset time passed in as a parameter. This method casts the - * offset as a long and calls {@link #getTimeOffset(Date, long)}. + * offset as a long and calls {@link getTimeOffset(Instant, long)}. * * @param time * the start time * @param offset * the offset in milliseconds to add to the time - * @return the {@link java.util.Date}with the offset added to it + * @return the {@link java.time.Instant} with the offset added to it */ - public static Date getTimeOffset(Date time, double offset) { + public static Instant getTimeOffset(Instant time, double offset) { return getTimeOffset(time, (long) offset); } - + /** - * A utility method that returns a date offset by the offset time passed in. Please note that the level of light - * during twilight is not affected by elevation, so if this is being used to calculate an offset before sunrise or - * after sunset with the intent of getting a rough "level of light" calculation, the sunrise or sunset time passed - * to this method should be sea level sunrise and sunset. + * A utility method that returns an Instant offset by the offset time passed in. Please note that the level of light + * during twilight is not affected by elevation, so if this is being used to calculate an offset before sunrise or after sunset + * with the intent of getting a rough "level of light" calculation, the sunrise or sunset time passed to this method should be + * sea level sunrise and sunset. * * @param time * the start time - * @param offset + * @param offsetMillis * the offset in milliseconds to add to the time. - * @return the {@link java.util.Date} with the offset in milliseconds added to it + * @return the {@link java.time.Instant} with the offset in milliseconds added to it */ - public static Date getTimeOffset(Date time, long offset) { - if (time == null || offset == Long.MIN_VALUE) { - return null; - } - return new Date(time.getTime() + offset); + public static Instant getTimeOffset(Instant time, long offsetMillis) { + if (time == null || offsetMillis == Long.MIN_VALUE) { + return null; + } + return time.plusMillis(offsetMillis); } - + /** - * A utility method that returns the time of an offset by degrees below or above the horizon of - * {@link #getSunrise() sunrise}. Note that the degree offset is from the vertical, so for a calculation of 14° - * before sunrise, an offset of 14 + {@link #GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter. + * A utility method that returns the time of an offset by degrees below or above the horizon of {@link getSunrise() + * sunrise}. Note that the degree offset is from the vertical, so for a calculation of 14° before sunrise, an offset of 14 + * + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter. * * @param offsetZenith - * the degrees before {@link #getSunrise()} to use in the calculation. For time after sunrise use - * negative numbers. Note that the degree offset is from the vertical, so for a calculation of 14° - * before sunrise, an offset of 14 + {@link #GEOMETRIC_ZENITH} = 104 would have to be passed as a - * parameter. - * @return The {@link java.util.Date} of the offset after (or before) {@link #getSunrise()}. If the calculation + * the degrees before {@link getSunrise()} to use in the calculation. For time after sunrise use negative + * numbers. Note that the degree offset is from the vertical, so for a calculation of 14° before sunrise, an offset + * of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter. + * @return The {@link java.time.Instant} of the offset after (or before) {@link getSunrise()}. 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 page. */ - public Date getSunriseOffsetByDegrees(double offsetZenith) { - double dawn = getUTCSunrise(offsetZenith); - if (Double.isNaN(dawn)) { - return null; - } else { - return getDateFromTime(dawn, SolarEvent.SUNRISE); - } + public Instant getSunriseOffsetByDegrees(double offsetZenith) { + double dawn = getUTCSunrise(offsetZenith); + return Double.isNaN(dawn) ? null + : getInstantFromTime(dawn, SolarEvent.SUNRISE); } /** - * A utility method that returns the time of an offset by degrees below or above the horizon of {@link #getSunset() - * sunset}. Note that the degree offset is from the vertical, so for a calculation of 14° after sunset, an - * offset of 14 + {@link #GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter. + * A utility method that returns the time of an offset by degrees below or above the horizon of {@link getSunset() + * sunset}. Note that the degree offset is from the vertical, so for a calculation of 14° after sunset, an offset of 14 + + * {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter. * * @param offsetZenith - * the degrees after {@link #getSunset()} to use in the calculation. For time before sunset use negative - * numbers. Note that the degree offset is from the vertical, so for a calculation of 14° after - * sunset, an offset of 14 + {@link #GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter. - * @return The {@link java.util.Date}of the offset after (or before) {@link #getSunset()}. 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 page. - */ - public Date getSunsetOffsetByDegrees(double offsetZenith) { - double sunset = getUTCSunset(offsetZenith); - if (Double.isNaN(sunset)) { - return null; - } else { - return getDateFromTime(sunset, SolarEvent.SUNSET); - } + * the degrees after {@link getSunset()} to use in the calculation. For time before sunset use negative + * numbers. Note that the degree offset is from the vertical, so for a calculation of 14° after sunset, an offset + * of 14 + {@link GEOMETRIC_ZENITH} = 104 would have to be passed as a parameter. + * @return The {@link java.time.Instant} of the offset after (or before) {@link getSunset()}. 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 + * and one where it does not set, a null will be returned. See detailed explanation on top of the page. + */ + public Instant getSunsetOffsetByDegrees(double offsetZenith) { + double sunset = getUTCSunset(offsetZenith); + return Double.isNaN(sunset) ? null + : getInstantFromTime(sunset, SolarEvent.SUNSET); } /** - * Default constructor will set a default {@link GeoLocation#GeoLocation()}, a default - * {@link AstronomicalCalculator#getDefault() AstronomicalCalculator} and default the calendar to the current date. + * Default constructor will set a default {@link GeoLocation#GeoLocation()}, a default {@link AstronomicalCalculator#getDefault() + * AstronomicalCalculator} and default the LocalDate to the current date. */ public AstronomicalCalendar() { this(new GeoLocation()); } /** - * A constructor that takes in geolocation information as a - * parameter. The default {@link AstronomicalCalculator#getDefault() AstronomicalCalculator} used for solar - * calculations is the more accurate {@link com.kosherjava.zmanim.util.NOAACalculator}. + * A constructor that takes in geolocation information as a parameter. + * The default {@link AstronomicalCalculator#getDefault() AstronomicalCalculator} used for solar calculations is the more + * accurate {@link com.kosherjava.zmanim.util.NOAACalculator}. * * @param geoLocation * The location information used for calculating astronomical sun times. * - * @see #setAstronomicalCalculator(AstronomicalCalculator) for changing the calculator class. + * @see setAstronomicalCalculator(AstronomicalCalculator) for changing the calculator class. */ public AstronomicalCalendar(GeoLocation geoLocation) { - setCalendar(Calendar.getInstance(geoLocation.getTimeZone())); - setGeoLocation(geoLocation);// duplicate call + setLocalDate(LocalDate.now(geoLocation.getZoneId())); + setGeoLocation(geoLocation); setAstronomicalCalculator(AstronomicalCalculator.getDefault()); } /** - * A method that returns the sunrise in UTC time without correction for time zone offset from GMT and without using - * daylight savings time. + * A method that returns the sunrise in UTC time without correction for time zone offset from GMT and without using daylight + * savings time. * * @param zenith * the degrees below the horizon. For time after sunrise use negative numbers. @@ -392,7 +377,7 @@ public AstronomicalCalendar(GeoLocation geoLocation) { * not set, {@link Double#NaN} will be returned. See detailed explanation on top of the page. */ public double getUTCSunrise(double zenith) { - return getAstronomicalCalculator().getUTCSunrise(getAdjustedCalendar(), getGeoLocation(), zenith, true); + return getAstronomicalCalculator().getUTCSunrise(getAdjustedLocalDate(), getGeoLocation(), zenith, true); } /** @@ -406,11 +391,11 @@ public double getUTCSunrise(double zenith) { * @return The time in the format: 18.75 for 18:45:00 UTC/GMT. 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, {@link Double#NaN} will be returned. See detailed explanation on top of the page. - * @see AstronomicalCalendar#getUTCSunrise - * @see AstronomicalCalendar#getUTCSeaLevelSunset + * @see getUTCSunrise(double) + * @see getUTCSeaLevelSunset(double) */ public double getUTCSeaLevelSunrise(double zenith) { - return getAstronomicalCalculator().getUTCSunrise(getAdjustedCalendar(), getGeoLocation(), zenith, false); + return getAstronomicalCalculator().getUTCSunrise(getAdjustedLocalDate(), getGeoLocation(), zenith, false); } /** @@ -422,54 +407,50 @@ public double getUTCSeaLevelSunrise(double zenith) { * @return The time in the format: 18.75 for 18:45:00 UTC/GMT. 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, {@link Double#NaN} will be returned. See detailed explanation on top of the page. - * @see AstronomicalCalendar#getUTCSeaLevelSunset + * @see getUTCSeaLevelSunset(double) */ public double getUTCSunset(double zenith) { - return getAstronomicalCalculator().getUTCSunset(getAdjustedCalendar(), getGeoLocation(), zenith, true); + return getAstronomicalCalculator().getUTCSunset(getAdjustedLocalDate(), getGeoLocation(), zenith, true); } /** - * A method that returns the sunset in UTC time without correction for elevation, time zone offset from GMT and - * without using daylight savings time. Non-sunrise and sunset calculations such as dawn and dusk, depend on the - * amount of visible light, something that is not affected by elevation. This method returns UTC sunset calculated - * at sea level. This forms the base for dusk calculations that are calculated as a dip below the horizon after - * sunset. + * A method that returns the sunset in UTC time without correction for elevation, time zone offset from GMT and without using + * daylight savings time. Non-sunrise and sunset calculations such as dawn and dusk, depend on the amount of visible light, + * something that is not affected by elevation. This method returns UTC sunset calculated at sea level. This forms the base for + * dusk calculations that are calculated as a dip below the horizon after sunset. * * @param zenith * the degrees below the horizon. For time before sunset use negative numbers. * @return The time in the format: 18.75 for 18:45:00 UTC/GMT. 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, {@link Double#NaN} will be returned. See detailed explanation on top of the page. - * @see AstronomicalCalendar#getUTCSunset - * @see AstronomicalCalendar#getUTCSeaLevelSunrise + * @see getUTCSunset(double) + * @see getUTCSeaLevelSunrise(double) */ public double getUTCSeaLevelSunset(double zenith) { - return getAstronomicalCalculator().getUTCSunset(getAdjustedCalendar(), getGeoLocation(), zenith, false); + return getAstronomicalCalculator().getUTCSunset(getAdjustedLocalDate(), getGeoLocation(), zenith, false); } /** - * A method that returns a sea-level based temporal (solar) hour. The day from {@link #getSeaLevelSunrise() - * sea-level sunrise} to {@link #getSeaLevelSunset() sea-level sunset} is split into 12 equal parts with each - * one being a temporal hour. + * A method that returns a sea-level based temporal (solar) hour. The day from {@link getSeaLevelSunrise() sea-level sunrise} to + * {@link getSeaLevelSunset() sea-level sunset} is split into 12 equal parts with each one being a temporal hour. * - * @see #getSeaLevelSunrise() - * @see #getSeaLevelSunset() - * @see #getTemporalHour(Date, Date) + * @see getSeaLevelSunrise() + * @see getSeaLevelSunset() + * @see getTemporalHour(Instant, Instant) * * @return the long millisecond length of a temporal hour. If the calculation can't be computed, * {@link Long#MIN_VALUE} will be returned. See detailed explanation on top of the page. * - * @see #getTemporalHour(Date, Date) */ public long getTemporalHour() { return getTemporalHour(getSeaLevelSunrise(), getSeaLevelSunset()); } /** - * A utility method that will allow the calculation of a temporal (solar) hour based on the sunrise and sunset - * passed as parameters to this method. An example of the use of this method would be the calculation of a - * elevation adjusted temporal hour by passing in {@link #getSunrise() sunrise} and - * {@link #getSunset() sunset} as parameters. + * A utility method that will allow the calculation of a temporal (solar) hour based on the sunrise and sunset passed as + * parameters to this method. An example of the use of this method would be the calculation of a elevation adjusted temporal + * hour by passing in {@link getSunrise() sunrise} and {@link getSunset() sunset} as parameters. * * @param startOfDay * The start of the day. @@ -479,124 +460,90 @@ public long getTemporalHour() { * @return the long millisecond length of the temporal hour. If the calculation can't be computed a * {@link Long#MIN_VALUE} will be returned. See detailed explanation on top of the page. * - * @see #getTemporalHour() + * @see getTemporalHour() */ - public long getTemporalHour(Date startOfDay, Date endOfDay) { - if (startOfDay == null || endOfDay == null) { - return Long.MIN_VALUE; - } - return (endOfDay.getTime() - startOfDay.getTime()) / 12; + public long getTemporalHour(Instant startOfDay, Instant endOfDay) { + if (startOfDay == null || endOfDay == null) { + return Long.MIN_VALUE; + } + + return Duration.between(startOfDay, endOfDay).toMillis() / 12; } /** * A method that returns sundial or solar noon. It occurs when the Sun is transiting the celestial meridian. The calculations used by - * this class depend on the {@link AstronomicalCalculator} used. If this calendar instance is {@link - * #setAstronomicalCalculator(AstronomicalCalculator) set} to use the {@link com.kosherjava.zmanim.util.NOAACalculator} - * (the default) it will calculate astronomical noon. If the calendar instance is to use the - * {@link com.kosherjava.zmanim.util.SunTimesCalculator}, that does not have code to calculate astronomical noon, the - * sun transit is calculated as halfway between sea level sunrise and sea level sunset, which can be slightly off the - * real transit time due to changes in declination (the lengthening or shortening day). See The Definition of Chatzos for details on the proper + * href="https://en.wikipedia.org/wiki/Meridian_%28astronomy%29">celestial meridian. The calculations used by this class + * depend on the {@link AstronomicalCalculator} used. If this calendar instance is {@link setAstronomicalCalculator( + * AstronomicalCalculator) set} to use the {@link com.kosherjava.zmanim.util.NOAACalculator} (the default) it will calculate + * astronomical noon. If the calendar instance is to use the {@link com.kosherjava.zmanim.util.SunTimesCalculator}, that does + * not have code to calculate astronomical noon, the sun transit is calculated as halfway between sea level sunrise and sea level + * sunset, which can be slightly off the real transit time due to changes in declination (the lengthening or shortening day). See + * The Definition of Chatzos for details on the proper * definition of solar noon / midday. * - * @return the Date representing Sun's transit. If the calculation can't be computed such as when using - * the {@link com.kosherjava.zmanim.util.SunTimesCalculator USNO calculator} that does not support getting solar - * noon for 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 page. - * @see #getSunTransit(Date, Date) - * @see #getTemporalHour() + * @return the Instant representing Sun's transit. If the calculation can't be computed such as when using the {@link + * com.kosherjava.zmanim.util.SunTimesCalculator USNO calculator} that does not support getting solar noon for 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 page. + * @see getSunTransit(Instant, Instant) + * @see getTemporalHour() * @see com.kosherjava.zmanim.util.NOAACalculator#getUTCNoon(Calendar, GeoLocation) * @see com.kosherjava.zmanim.util.SunTimesCalculator#getUTCNoon(Calendar, GeoLocation) */ - public Date getSunTransit() { - double noon = getAstronomicalCalculator().getUTCNoon(getAdjustedCalendar(), getGeoLocation()); - return getDateFromTime(noon, SolarEvent.NOON); - } - - /** - * A method that returns solar midnight. It occurs when the Sun is transiting the lower celestial meridian, or when the sun is at it's - * nadir. The calculations used by this class depend on the {@link - * AstronomicalCalculator} used. If this calendar instance is {@link #setAstronomicalCalculator(AstronomicalCalculator) - * set} to use the {@link com.kosherjava.zmanim.util.NOAACalculator} (the default) it will calculate astronomical - * midnight. If the calendar instance is to use the {@link com.kosherjava.zmanim.util.SunTimesCalculator}, that does not - * have code to calculate astronomical noon, midnight is calculated as halfway between sea level sunrise and sea level - * sunset on the other side of the world (180° away), which can be slightly off the real transit time due to changes - * in declination (the lengthening or shortening day). See The Definition of Chatzos for details on the proper - * definition of solar noon / midday. - * - * @deprecated This method was replaced by {@link #getSolarMidnight()} and will be removed in v3.0. - * - * @return the Date representing Sun's lower transit at the end of the current day. If the calculation can't - * be computed such as when using the {@link com.kosherjava.zmanim.util.SunTimesCalculator USNO calculator} that - * does not support getting solar noon or midnight for 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. This is not - * relevant when using the {@link com.kosherjava.zmanim.util.NOAACalculator NOAA Calculator} that is never expected - * to return null. See the detailed explanation on top of the page. - * - * @see #getSunTransit() - * @see #getSolarMidnight() - * @see com.kosherjava.zmanim.util.NOAACalculator#getUTCNoon(Calendar, GeoLocation) - * @see com.kosherjava.zmanim.util.SunTimesCalculator#getUTCNoon(Calendar, GeoLocation) - */ - @Deprecated // (since="2.6", forRemoval=true)// add back once Java 9 is the minimum supported version - public Date getSunLowerTransit() { - return getSolarMidnight(); + public Instant getSunTransit() { + double noon = getAstronomicalCalculator().getUTCNoon(getAdjustedLocalDate(), getGeoLocation()); + return getInstantFromTime(noon, SolarEvent.NOON); } /** - * A method that returns solar midnight at the end of the current day (that may actually be after midnight of the day it - * is being calculated for). It occurs when the Sun is transiting the lower celestial meridian, or - * when the sun is at it's nadir. The calculations used by this class - * depend on the {@link AstronomicalCalculator} used. If this calendar instance is {@link - * #setAstronomicalCalculator(AstronomicalCalculator) set} to use the {@link com.kosherjava.zmanim.util.NOAACalculator} - * (the default) it will calculate astronomical midnight. If the calendar instance is to use the {@link - * com.kosherjava.zmanim.util.SunTimesCalculator USNO Calculator}, that does not have code to calculate astronomical noon, - * midnight is calculated as 12 hours after halfway between sea level sunrise and sea level sunset of that day. This can - * be slightly off the real transit time due to changes in declination (the lengthening or shortening day). See The Definition of Chatzos for details on the proper + * A method that returns solar midnight as the end of the day (that may actually be after midnight of the day it is + * being calculated for). For example calculating solar midnight for February 8, will calculate it for midnight between February + * 8 and February 9. It occurs when the Sun is transiting the + * lower celestial meridian, or when the sun is at it's + * nadir. The calculations used by this class depend on the {@link + * AstronomicalCalculator} used. If this calendar instance is {@link setAstronomicalCalculator(AstronomicalCalculator) set} to use + * the {@link com.kosherjava.zmanim.util.NOAACalculator} (the default) it will calculate astronomical midnight. If the calendar + * instance is to use the {@link com.kosherjava.zmanim.util.SunTimesCalculator USNO Calculator}, that does not have code to + * calculate astronomical noon, midnight is calculated as 12 hours after halfway between sea level sunrise and sea level sunset + * of that day. This can be slightly off the real transit time due to changes in declination (the lengthening or shortening day). + * See The Definition of Chatzos for details on the proper * definition of solar noon / midday. * - * @return the Date representing Sun's lower transit at the end of the current day. If the calculation can't - * be computed such as when using the {@link com.kosherjava.zmanim.util.SunTimesCalculator USNO calculator} that - * does not support getting solar noon or midnight for 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. This is not - * relevant when using the {@link com.kosherjava.zmanim.util.NOAACalculator NOAA Calculator} that is never expected - * to return null. See the detailed explanation on top of the page. + * @return the Instant representing Sun's lower transit at the end of the current day. If the calculation + * can't be computed such as when using the {@link com.kosherjava.zmanim.util.SunTimesCalculator USNO calculator} that does + * not support getting solar noon or midnight for 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. This is not relevant when using the + * {@link com.kosherjava.zmanim.util.NOAACalculator NOAA Calculator} that is never expected to return null. + * See the detailed explanation on top of the page. * - * @see #getSunTransit() + * @see getSunTransit() * @see com.kosherjava.zmanim.util.NOAACalculator#getUTCNoon(Calendar, GeoLocation) * @see com.kosherjava.zmanim.util.SunTimesCalculator#getUTCNoon(Calendar, GeoLocation) */ - public Date getSolarMidnight() { - double noon = getAstronomicalCalculator().getUTCMidnight(getAdjustedCalendar(), getGeoLocation()); - return getDateFromTime(noon, SolarEvent.MIDNIGHT); + public Instant getSolarMidnight() { + double noon = getAstronomicalCalculator().getUTCMidnight(getAdjustedLocalDate(), getGeoLocation()); + return getInstantFromTime(noon, SolarEvent.MIDNIGHT); } /** - * A method that returns sundial or solar noon. It occurs when the Sun is transiting the celestial meridian. In this class it is - * calculated as halfway between the sunrise and sunset passed to this method. This time can be slightly off the - * real transit time due to changes in declination (the lengthening or shortening day). + * A method that returns sundial or solar noon (or midnight) calculated as halfway between the times passed in. It is close to, + * but not exactly occurs when the Sun is transiting the + * celestial meridian. It will not exactly match the + * astronomical transit, due to changes in declination (the lengthening or shortening day). * * @param startOfDay - * the start of day for calculating the sun's transit. This can be sea level sunrise, visual sunrise (or - * any arbitrary start of day) passed to this method. + * the start of day for calculating the sun's transit. This can be sea level sunrise, visual sunrise (or any arbitrary + * start of day) passed to this method. * @param endOfDay - * the end of day for calculating the sun's transit. This can be sea level sunset, visual sunset (or any - * arbitrary end of day) passed to this method. + * the end of day for calculating the sun's transit. This can be sea level sunset, visual sunset (or any arbitrary end + * of day) passed to this method. * - * @return the Date representing Sun's transit. If the calculation can't be computed such as in the + * @return the Instant representing Sun's transit. 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, null will be returned. See detailed explanation on top of the page. */ - public Date getSunTransit(Date startOfDay, Date endOfDay) { + public Instant getSunTransit(Instant startOfDay, Instant endOfDay) { long temporalHour = getTemporalHour(startOfDay, endOfDay); if (temporalHour == Long.MIN_VALUE) { return null; @@ -609,56 +556,58 @@ public Date getSunTransit(Date startOfDay, Date endOfDay) { */ protected enum SolarEvent { /**SUNRISE A solar event related to sunrise*/SUNRISE, /**SUNSET A solar event related to sunset*/SUNSET, - /**NOON A solar event related to noon*/NOON, /**MIDNIGHT A solar event related to midnight*/MIDNIGHT + /**NOON A solar event related to noon*/NOON, /**MIDNIGHT A solar event related to midnight*/MIDNIGHT, + /**NONE solar event representing azimuth or elevation calculations that that can be any time of the day*/ NONE; } - + /** - * A method that returns a Date from the time passed in as a parameter. + * Return the time at a given azimuth. This often will not occur and a null will be returned. + * @param azimuth the azimuth that you want to get the time of day for. + * @return the time that the azimuth will be reached. There are cases where this azimuth will never be reached for the date + * and location, and a null will be returned in that case. + * @see com.kosherjava.zmanim.util.AstronomicalCalculator#getTimeAtAzimuth(LocalDate, GeoLocation, double) + */ + public Instant getTimeAtAzimuth(double azimuth) { + double rawAzimuth = getAstronomicalCalculator().getTimeAtAzimuth(getAdjustedLocalDate(), getGeoLocation(), azimuth); + return getInstantFromTime(rawAzimuth, SolarEvent.NONE); + } + + /** + * A method that returns an Instant from the time passed in as a parameter. * * @param time - * The time to be set as the time for the Date. The time expected is in the format: 18.75 + * The time to be set as the time for the Instant. The time expected is in the format: 18.75 * for 6:45:00 PM.time is sunrise and false if it is sunset * @param solarEvent the type of {@link SolarEvent} - * @return The Date object representation of the time double + * @return The Instant object representation of the time double */ - protected Date getDateFromTime(double time, SolarEvent solarEvent) { - if (Double.isNaN(time)) { - return null; - } - double calculatedTime = time; - - Calendar adjustedCalendar = getAdjustedCalendar(); - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); - cal.clear();// clear all fields - cal.set(Calendar.YEAR, adjustedCalendar.get(Calendar.YEAR)); - cal.set(Calendar.MONTH, adjustedCalendar.get(Calendar.MONTH)); - cal.set(Calendar.DAY_OF_MONTH, adjustedCalendar.get(Calendar.DAY_OF_MONTH)); - - int hours = (int) calculatedTime; // retain only the hours - calculatedTime -= hours; - int minutes = (int) (calculatedTime *= 60); // retain only the minutes - calculatedTime -= minutes; - int seconds = (int) (calculatedTime *= 60); // retain only the seconds - calculatedTime -= seconds; // remaining milliseconds - - // Check if a date transition has occurred, or is about to occur - this indicates the date of the event is - // actually not the target date, but the day prior or after - int localTimeHours = (int)getGeoLocation().getLongitude() / 15; - if (solarEvent == SolarEvent.SUNRISE && localTimeHours + hours > 18) { - cal.add(Calendar.DAY_OF_MONTH, -1); - } else if (solarEvent == SolarEvent.SUNSET && localTimeHours + hours < 6) { - cal.add(Calendar.DAY_OF_MONTH, 1); - } else if (solarEvent == SolarEvent.MIDNIGHT && localTimeHours + hours < 12) { - cal.add(Calendar.DAY_OF_MONTH, 1); - } else if (solarEvent == SolarEvent.NOON && localTimeHours + hours > 24) { - cal.add(Calendar.DAY_OF_MONTH, -1); - } + protected Instant getInstantFromTime(double time, SolarEvent solarEvent) { + if (Double.isNaN(time)) { + return null; + } - cal.set(Calendar.HOUR_OF_DAY, hours); - cal.set(Calendar.MINUTE, minutes); - cal.set(Calendar.SECOND, seconds); - cal.set(Calendar.MILLISECOND, (int) (calculatedTime * 1000)); - return cal.getTime(); + LocalDate date = getAdjustedLocalDate(); + + double localTimeHours = (getGeoLocation().getLongitude() / 15) + time; + + if (solarEvent == SolarEvent.SUNRISE && localTimeHours > 18) { + date = date.minusDays(1); + } else if (solarEvent == SolarEvent.SUNSET && localTimeHours < 6) { + date = date.plusDays(1); + } else if (solarEvent == SolarEvent.MIDNIGHT && localTimeHours < 12) { + date = date.plusDays(1); + } else if (solarEvent == SolarEvent.NOON) { + if (localTimeHours < 0) { + date = date.plusDays(1); + } else if (localTimeHours > 24) { + date = date.minusDays(1); + } + } + + LocalDateTime dateTime = date.atStartOfDay().plusNanos(Math.round(time * HOUR_MILLIS * 1_000_000L)); // tiny change from 3.0 code + + // The computed time is in UTC fractional hours; anchor in UTC before converting. + return ZonedDateTime.of(dateTime, ZoneOffset.UTC).toInstant(); } /** @@ -675,21 +624,21 @@ protected Date getDateFromTime(double time, SolarEvent solarEvent) { * efficiently return the the solar elevation (the sun's position in degrees below (or above) the horizon) * at the given time even in the arctic when there is no sunrise. * @see AstronomicalCalculator#getSolarElevation(Calendar, GeoLocation) - * @see #getSunsetSolarDipFromOffset(double) + * @see getSunsetSolarDipFromOffset(double) */ - @Deprecated // (forRemoval=false) // add back once Java 9 is the minimum supported version + @Deprecated(forRemoval=false) public double getSunriseSolarDipFromOffset(double minutes) { - Date offsetByDegrees = getSeaLevelSunrise(); + Instant offsetByDegrees = getSeaLevelSunrise(); if(offsetByDegrees == null) { return Double.NaN; } - Date offsetByTime = getTimeOffset(getSeaLevelSunrise(), -(minutes * MINUTE_MILLIS)); + Instant offsetByTime = getTimeOffset(getSeaLevelSunrise(), -(minutes * MINUTE_MILLIS)); BigDecimal degrees = new BigDecimal(0); BigDecimal incrementor = new BigDecimal("0.0001"); - while (offsetByDegrees == null || ((minutes < 0.0 && offsetByDegrees.getTime() < offsetByTime.getTime()) || - (minutes > 0.0 && offsetByDegrees.getTime() > offsetByTime.getTime()))) { + while (offsetByDegrees == null || ((minutes < 0.0 && offsetByDegrees.toEpochMilli() < offsetByTime.toEpochMilli()) || + (minutes > 0.0 && offsetByDegrees.toEpochMilli() > offsetByTime.toEpochMilli()))) { if (minutes > 0.0) { degrees = degrees.add(incrementor); } else { @@ -710,23 +659,23 @@ public double getSunriseSolarDipFromOffset(double minutes) { * @return the degrees below the horizon after sunset that match the offset in minutes passed it as a parameter. If * the calculation can't be computed (no sunset occurs on this day) a {@link Double#NaN} will be returned. * @deprecated This method is slow and inefficient and should NEVER be used in a loop. This method should be replaced - * by calls to {@link AstronomicalCalculator#getSolarElevation(Calendar, GeoLocation)}. That method will + * by calls to {@link AstronomicalCalculator#getSolarElevation(ZonedDateTime, GeoLocation)}. That method will * efficiently return the the solar elevation (the sun's position in degrees below (or above) the horizon) * at the given time even in the arctic when there is no sunrise. - * @see AstronomicalCalculator#getSolarElevation(Calendar, GeoLocation) - * @see #getSunriseSolarDipFromOffset(double) + * @see AstronomicalCalculator#getSolarElevation(ZonedDateTime, GeoLocation) + * @see getSunriseSolarDipFromOffset(double) */ - @Deprecated // (forRemoval=false) // add back once Java 9 is the minimum supported version + @Deprecated(forRemoval=false) public double getSunsetSolarDipFromOffset(double minutes) { - Date offsetByDegrees = getSeaLevelSunset(); + Instant offsetByDegrees = getSeaLevelSunset(); if(offsetByDegrees == null) { return Double.NaN; } - Date offsetByTime = getTimeOffset(getSeaLevelSunset(), minutes * MINUTE_MILLIS); + Instant offsetByTime = getTimeOffset(getSeaLevelSunset(), minutes * MINUTE_MILLIS); BigDecimal degrees = new BigDecimal(0); BigDecimal incrementor = new BigDecimal("0.001"); - while (offsetByDegrees == null || ((minutes > 0.0 && offsetByDegrees.getTime() < offsetByTime.getTime()) || - (minutes < 0.0 && offsetByDegrees.getTime() > offsetByTime.getTime()))) { + while (offsetByDegrees == null || ((minutes > 0.0 && offsetByDegrees.toEpochMilli() < offsetByTime.toEpochMilli()) || + (minutes < 0.0 && offsetByDegrees.toEpochMilli() > offsetByTime.toEpochMilli()))) { if (minutes > 0.0) { degrees = degrees.add(incrementor); } else { @@ -738,45 +687,53 @@ public double getSunsetSolarDipFromOffset(double minutes) { } /** - * A method that returns local mean time (LMT) time - * converted to regular clock time for the number of hours (0.0 to 23.999...) passed to this method. This time is - * adjusted from standard time to account for the local latitude. The 360° of the globe divided by 24 calculates - * to 15° per hour with 4 minutes per degree, so at a longitude of 0 , 15, 30 etc... noon is at exactly 12:00pm. - * Lakewood, N.J., with a longitude of -74.222, is 0.7906 away from the closest multiple of 15 at -75°. This is - * multiplied by 4 clock minutes (per degree) to yield 3 minutes and 7 seconds for a noon time of 11:56:53am. This - * method is not tied to the theoretical 15° time zones, but will adjust to the actual time zone and Daylight saving time to return LMT. - * - * @param hours - * the hour (such as 12.0 for noon and 0.0 for midnight) to calculate as LMT. Valid values are in the range of - * 0.0 to 23.999.... An IllegalArgumentException will be thrown if the value does not fit in the expected range. - * @return the Date representing the local mean time (LMT) for the number of hours passed in. In Lakewood, NJ, passing 12 - * (noon) will return 11:56:50am. - * @see GeoLocation#getLocalMeanTimeOffset() - */ - public Date getLocalMeanTime(double hours) { - if (hours < 0 || hours >= 24) { - throw new IllegalArgumentException("Hours must between 0 and 23.9999..."); - } - return getTimeOffset(getDateFromTime(hours - getGeoLocation().getTimeZone().getRawOffset() - / (double) HOUR_MILLIS, SolarEvent.SUNRISE), -getGeoLocation().getLocalMeanTimeOffset()); + * A method that returns local mean time (LMT) time converted to + * regular clock time for the local wall-clock time passed to this method. This time is adjusted from standard time to account for + * the local latitude. The 360° of the globe divided by 24 calculates to 15° per hour with 4 minutes per degree, so at a + * longitude of 0 , 15, 30 etc... noon is at exactly 12:00pm. Lakewood, N.J., with a longitude of -74.222, is 0.7906 away from the + * closest multiple of 15 at -75°. This is multiplied by 4 clock minutes (per degree) to yield 3 minutes and 7 seconds for a + * noon time of 11:56:53am. This method is not tied to the theoretical 15° time zones, but will adjust to the actual time zone + * and Daylight saving time to return LMT. + * + * @param localTime + * the local wall-clock time (such as 12:00 for noon and 00:00 for midnight) to calculate as LMT. + * @return the Instant representing the local mean time (LMT) for the time passed in. In Lakewood, + * NJ, passing noon will return 11:56:50am. + * @see GeoLocation#getLocalMeanTimeOffset(Instant) + */ + public Instant getLocalMeanTime(LocalTime localTime) { + Instant localMeanTime = LocalDateTime.of(getAdjustedLocalDate(), localTime).toInstant(ZoneOffset.UTC); + long longitudeOffsetMillis = (long) (getGeoLocation().getLongitude() * 4 * MINUTE_MILLIS); + return getTimeOffset(localMeanTime, -longitudeOffsetMillis); } - + /** - * Adjusts the Calendar to deal with edge cases where the location crosses the antimeridian. + * Adjusts the LocalDate to deal with edge cases where the location crosses the antimeridian. * - * @see GeoLocation#getAntimeridianAdjustment() + * @see GeoLocation#getAntimeridianAdjustment(Instant) * @return the adjusted Calendar */ - private Calendar getAdjustedCalendar(){ - int offset = getGeoLocation().getAntimeridianAdjustment(); - if (offset == 0) { - return getCalendar(); - } - Calendar adjustedCalendar = (Calendar) getCalendar().clone(); - adjustedCalendar.add(Calendar.DAY_OF_MONTH, offset); - return adjustedCalendar; - } + protected LocalDate getAdjustedLocalDate(){ + int offset = getGeoLocation().getAntimeridianAdjustment(getMidnightLastNight().toInstant()); + return offset == 0 ? getLocalDate() : getLocalDate().plusDays(offset); + } + + /** + * Used by Molad based zmanim to determine if zmanim occur during the current day. This is also used as the + * anchor for current timezone-offset calculations. + * @return midnight at the start of the current local date in the configured timezone + */ + protected ZonedDateTime getMidnightLastNight() { + return ZonedDateTime.of(getLocalDate(),LocalTime.MIDNIGHT,getGeoLocation().getZoneId()); + } + + /** + * Used by Molad based zmanim to determine if zmanim occur during the current day. + * @return following midnight + */ + protected ZonedDateTime getMidnightTonight() { + return ZonedDateTime.of(getLocalDate().plusDays(1),LocalTime.MIDNIGHT,getGeoLocation().getZoneId()); + } /** * Returns an XML formatted representation of the class using the default output of the @@ -809,12 +766,13 @@ public boolean equals(Object object) { if (this == object) { return true; } - if (!(object instanceof AstronomicalCalendar)) { + if (object == null || getClass() != object.getClass()) { return false; } AstronomicalCalendar aCal = (AstronomicalCalendar) object; - return getCalendar().equals(aCal.getCalendar()) && getGeoLocation().equals(aCal.getGeoLocation()) - && getAstronomicalCalculator().equals(aCal.getAstronomicalCalculator()); + return Objects.equals(getLocalDate(), aCal.getLocalDate()) + && Objects.equals(getGeoLocation(), aCal.getGeoLocation()) + && Objects.equals(getAstronomicalCalculator(), aCal.getAstronomicalCalculator()); } /** @@ -823,9 +781,9 @@ public boolean equals(Object object) { public int hashCode() { int result = 17; result = 37 * result + getClass().hashCode(); // needed or this and subclasses will return identical hash - result += 37 * result + getCalendar().hashCode(); - result += 37 * result + getGeoLocation().hashCode(); - result += 37 * result + getAstronomicalCalculator().hashCode(); + result += 37 * result + Objects.hashCode(getLocalDate()); + result += 37 * result + Objects.hashCode(getGeoLocation()); + result += 37 * result + Objects.hashCode(getAstronomicalCalculator()); return result; } @@ -849,14 +807,13 @@ public GeoLocation getGeoLocation() { */ public void setGeoLocation(GeoLocation geoLocation) { this.geoLocation = geoLocation; - getCalendar().setTimeZone(geoLocation.getTimeZone()); } /** * A method that returns the currently set AstronomicalCalculator. * * @return Returns the astronomicalCalculator. - * @see #setAstronomicalCalculator(AstronomicalCalculator) + * @see setAstronomicalCalculator(AstronomicalCalculator) */ public AstronomicalCalculator getAstronomicalCalculator() { return this.astronomicalCalculator; @@ -876,35 +833,27 @@ public AstronomicalCalculator getAstronomicalCalculator() { public void setAstronomicalCalculator(AstronomicalCalculator astronomicalCalculator) { this.astronomicalCalculator = astronomicalCalculator; } - + /** - * returns the Calendar object encapsulated in this class. + * returns the LocalDate object encapsulated in this class. * - * @return Returns the calendar. + * @return Returns the LocalDate. */ - public Calendar getCalendar() { - return this.calendar; + public LocalDate getLocalDate() { + return this.localDate; } - + /** - * Sets the Calendar object for us in this class. - * @param calendar - * The calendar to set. + * Sets the LocalDate object for us in this class. + * @param localDate + * The LocalDate to set. */ - public void setCalendar(Calendar calendar) { - this.calendar = calendar; - if (getGeoLocation() != null) {// if available set the Calendar's timezone to the GeoLocation TimeZone - getCalendar().setTimeZone(getGeoLocation().getTimeZone()); - } + public void setLocalDate(LocalDate localDate) { + this.localDate = localDate; } /** * A method that creates a deep copy of the object. - * Note: If the {@link java.util.TimeZone} in the cloned {@link com.kosherjava.zmanim.util.GeoLocation} will - * be changed from the original, it is critical that - * {@link com.kosherjava.zmanim.AstronomicalCalendar#getCalendar()}. - * {@link java.util.Calendar#setTimeZone(TimeZone) setTimeZone(TimeZone)} be called in order for the - * AstronomicalCalendar to output times in the expected offset after being cloned. * * @see java.lang.Object#clone() */ @@ -916,9 +865,8 @@ public Object clone() { // Required by the compiler. Should never be reached since we implement clone() } if (clone != null) { - clone.setGeoLocation((GeoLocation) getGeoLocation().clone()); - clone.setCalendar((Calendar) getCalendar().clone()); - clone.setAstronomicalCalculator((AstronomicalCalculator) getAstronomicalCalculator().clone()); + clone.setGeoLocation((GeoLocation) getGeoLocation().clone()); // consider converting the GeoLocation class to be immutable to avoid the deep copy + clone.setAstronomicalCalculator((AstronomicalCalculator) getAstronomicalCalculator().clone()); // likely not needed } return clone; } diff --git a/src/main/java/com/kosherjava/zmanim/ComprehensiveZmanimCalendar.java b/src/main/java/com/kosherjava/zmanim/ComprehensiveZmanimCalendar.java index 99d96397..9add93b3 100644 --- a/src/main/java/com/kosherjava/zmanim/ComprehensiveZmanimCalendar.java +++ b/src/main/java/com/kosherjava/zmanim/ComprehensiveZmanimCalendar.java @@ -15,8 +15,8 @@ */ package com.kosherjava.zmanim; -import java.util.Calendar; -import java.util.Date; +import java.time.Instant; +import java.time.LocalTime; import com.kosherjava.zmanim.util.AstronomicalCalculator; import com.kosherjava.zmanim.util.GeoLocation; import com.kosherjava.zmanim.hebrewcalendar.JewishCalendar; @@ -30,8 +30,8 @@ * API. The real power of this API is the ease in calculating zmanim that are not part of the library. The methods for * zmanim calculations not present in this class or it's superclass {@link ZmanimCalendar} are contained in the * {@link AstronomicalCalendar}, the base class of the calendars in our API since they are generic methods for calculating - * time based on degrees or time before or after {@link #getSunrise() sunrise} and {@link #getSunset() sunset} and are of interest - * for calculation beyond zmanim calculations. Here are some examples. + * time based on degrees or time before or after {@link #getSunset() sunrise} and {@link #getSunset() + * sunset} and are of interest for calculation beyond zmanim calculations. Here are some examples. *

First create the Calendar for the location you would like to calculate: * *

@@ -39,35 +39,34 @@
  * double latitude = 40.0828; // Lakewood, NJ
  * double longitude = -74.222; // Lakewood, NJ
  * double elevation = 20; // optional elevation correction in Meters
- * // the String parameter in getTimeZone() has to be a valid time zone listed in
- * // {@link java.util.TimeZone#getAvailableIDs()}
- * TimeZone timeZone = TimeZone.getTimeZone("America/New_York");
- * GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, timeZone);
+ * // the String parameter in getZoneId() has to be a valid ZoneId listed in {@link java.time.ZoneId#getAvailableZoneIds()}
+ * ZoneId zoneId = ZoneId.of("America/New_York");
+ * GeoLocation location = new GeoLocation(locationName, latitude, longitude, elevation, zoneId);
  * ComprehensiveZmanimCalendar czc = new ComprehensiveZmanimCalendar(location);
  * // Optionally set the date or it will default to today's date
- * czc.getCalendar().set(Calendar.MONTH, Calendar.FEBRUARY);
- * czc.getCalendar().set(Calendar.DAY_OF_MONTH, 8);
+ * ZonedDateTime dateTime = ZonedDateTime.of(1969, Month.FEBRUARY.getValue(), 8, 0, 0, 0, 0, location.getZoneId()); + * czc.setZonedDateTime(dateTime); *

* Note: For locations such as Israel where the beginning and end of daylight savings time can fluctuate from * year to year, if your version of Java does not have an up to date time zone database, create a * {@link java.util.SimpleTimeZone} with the known start and end of DST. * To get alos calculated as 14° below the horizon (as calculated in the calendars published in Montreal), - * add {@link AstronomicalCalendar#GEOMETRIC_ZENITH} (90) to the 14° offset to get the desired time: + * add {@link GEOMETRIC_ZENITH} (90) to the 14° offset to get the desired time: *

*

- *  Date alos14 = czc.getSunriseOffsetByDegrees({@link AstronomicalCalendar#GEOMETRIC_ZENITH} + 14);
+ * Instant alos14 = czc.getSunriseOffsetByDegrees({@link GEOMETRIC_ZENITH} + 14); *

* To get mincha gedola calculated based on the Magen Avraham (MGA) using a shaah zmanis based on the day starting * 16.1° below the horizon (and ending 16.1° after sunset) the following calculation can be used: * *

- * Date minchaGedola = czc.getTimeOffset(czc.getAlos16point1Degrees(), czc.getShaahZmanis16Point1Degrees() * 6.5);
+ * Instant minchaGedola = czc.getTimeOffset(czc.getAlos16point1Degrees(), czc.getShaahZmanis16Point1Degrees() * 6.5); *

* or even simpler using the included convenience methods *

- * Date minchaGedola = czc.getMinchaGedola(czc.getAlos16point1Degrees(), czc.getShaahZmanis16Point1Degrees());
+ * Instant minchaGedola = czc.getMinchaGedola(czc.getAlos16point1Degrees(), czc.getShaahZmanis16Point1Degrees()); *

* A little more complex example would be calculating zmanim that rely on a shaah zmanis that is * not present in this library. While a drop more complex, it is still rather easy. An example would be to calculate @@ -80,8 +79,8 @@ * that plag hamincha is 10.75 hours after the start of the day, and the following steps are all that it takes. *
*

- * Date plag = czc.getPlagHamincha(czc.getSunriseOffsetByDegrees({@link AstronomicalCalendar#GEOMETRIC_ZENITH} + 12),
- * 				czc.getSunsetOffsetByDegrees({@link AstronomicalCalendar#GEOMETRIC_ZENITH} + ZENITH_7_POINT_083));
+ * Instant plag = czc.getPlagHamincha(czc.getSunriseOffsetByDegrees({@link GEOMETRIC_ZENITH} + 12), + * czc.getSunsetOffsetByDegrees({@link GEOMETRIC_ZENITH} + ZENITH_7_POINT_083)); *

* Something a drop more challenging, but still simple, would be calculating a zman using the same "complex" * offset day used in the above-mentioned Manchester calendar, but for a shaos zmaniyos based zman not @@ -93,15 +92,15 @@ * *
*

- * long shaahZmanis = czc.getTemporalHour(czc.getSunriseOffsetByDegrees({@link AstronomicalCalendar#GEOMETRIC_ZENITH} + 12),
- * 						czc.getSunsetOffsetByDegrees({@link AstronomicalCalendar#GEOMETRIC_ZENITH} + ZENITH_7_POINT_083));
- * Date sofZmanAchila = getTimeOffset(czc.getSunriseOffsetByDegrees({@link AstronomicalCalendar#GEOMETRIC_ZENITH} + 12),
+ * long shaahZmanis = czc.getTemporalHour(czc.getSunriseOffsetByDegrees({@link GEOMETRIC_ZENITH} + 12),
+ * 						czc.getSunsetOffsetByDegrees({@link GEOMETRIC_ZENITH} + ZENITH_7_POINT_083));
+ * Instant sofZmanAchila = getTimeOffset(czc.getSunriseOffsetByDegrees({@link GEOMETRIC_ZENITH} + 12),
  * 					shaahZmanis * 9);
*

* Calculating this sof zman achila according to the GRA * is simplicity itself. *

- * Date sofZmanAchila = czc.getTimeOffset(czc.getSunrise(), czc.getShaahZmanisGra() * 9);
+ * Instant sofZmanAchila = czc.getTimeOffset(czc.getSunrise(), czc.getShaahZmanisGRA() * 9); * *

See documentation from the {@link ZmanimCalendar} parent class

* @@ -110,53 +109,26 @@ public class ComprehensiveZmanimCalendar extends ZmanimCalendar { /** - * The zenith of 3.7° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating tzais (nightfall) based on the opinion of the Geonim that tzais is the - * time it takes to walk 3/4 of a mil at 18 minutes a mil, or 13.5 minutes after sunset. The sun is 3.7° below - * {@link #GEOMETRIC_ZENITH geometric zenith} at this time in Jerusalem around the equinox / equilux. - * + * The zenith of 3.7° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getTzaisGeonim3Point7Degrees() */ protected static final double ZENITH_3_POINT_7 = GEOMETRIC_ZENITH + 3.7; /** - * The zenith of 3.8° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating tzais (nightfall) based on the opinion of the Geonim that tzais is the - * time it takes to walk 3/4 of a mil at 18 minutes a mil, or 13.5 minutes after sunset. The sun is 3.8° below - * {@link #GEOMETRIC_ZENITH geometric zenith} at this time in Jerusalem around the equinox / equilux. - * + * The zenith of 3.8° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getTzaisGeonim3Point8Degrees() */ protected static final double ZENITH_3_POINT_8 = GEOMETRIC_ZENITH + 3.8; /** - * The zenith of 5.95° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating tzais (nightfall) according to some opinions. This calculation is based on the position of - * the sun 24 minutes after sunset in Jerusalem around the equinox / equilux, - * which calculates to 5.95° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * + * The zenith of 5.95° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getTzaisGeonim5Point95Degrees() */ protected static final double ZENITH_5_POINT_95 = GEOMETRIC_ZENITH + 5.95; /** - * The zenith of 7.083° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This is often referred to as - * 7°5' or 7° and 5 minutes. This calculation is used for calculating alos (dawn) and - * tzais (nightfall) according to some opinions. This calculation is based on observation of 3 medium-sized - * stars by Dr. Baruch Cohen in his calendar published in 1899 in Strasbourg, France. This calculates to - * 7.0833333° below {@link #GEOMETRIC_ZENITH geometric zenith}. The Sh"Ut - * Melamed Leho'il in Orach Chaim 30 agreed to this zman, as did the Sh"Ut Bnei Tziyon and the Tenuvas Sadeh. - * It is very close to the time of the Mekor Chesed of the Sefer chasidim. - * It is close to the position of the sun 30 minutes after sunset in Jerusalem around the equinox / equilux, but not - * Exactly. The actual position of the sun 30 minutes after sunset in Jerusalem at the equilux is 7.205° and - * 7.199° at the equinox. See Hazmanim Bahalacha vol 2, pages 520-521 for details. - * @todo Hyperlink the proper sources. + * The zenith of 7.083° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). This is often referred to as + * 7°5' (7° and 5 minutes). * * @see #getTzaisGeonim7Point083Degrees() * @see #getBainHashmashosRT13Point5MinutesBefore7Point083Degrees() @@ -164,221 +136,122 @@ public class ComprehensiveZmanimCalendar extends ZmanimCalendar { protected static final double ZENITH_7_POINT_083 = GEOMETRIC_ZENITH + 7 + (5.0 / 60); /** - * The zenith of 10.2° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating misheyakir according to some opinions. This calculation is based on the position of the sun - * 45 minutes before {@link #getSunrise() sunrise} in Jerusalem around the equinox / equilux which - * calculates to 10.2° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * + * The zenith of 10.2° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getMisheyakir10Point2Degrees() */ protected static final double ZENITH_10_POINT_2 = GEOMETRIC_ZENITH + 10.2; /** - * The zenith of 11° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating misheyakir according to some opinions. This calculation is based on the position of the sun - * 48 minutes before {@link #getSunrise() sunrise} in Jerusalem around the equinox / equilux, which - * calculates to 11° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * + * The zenith of 11° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getMisheyakir11Degrees() */ protected static final double ZENITH_11_DEGREES = GEOMETRIC_ZENITH + 11; /** - * The zenith of 11.5° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating misheyakir according to some opinions. This calculation is based on the position of the sun - * 52 minutes before {@link #getSunrise() sunrise} in Jerusalem around the equinox / equilux, which - * calculates to 11.5° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * + * The zenith of 11.5° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getMisheyakir11Point5Degrees() */ protected static final double ZENITH_11_POINT_5 = GEOMETRIC_ZENITH + 11.5; /** - * The zenith of 12.85° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This is used for calculating - * misheyakir according to some opinions. This calculation is based on the position of the sun slightly less - * than 57 minutes before {@link #getSunrise() sunrise} in Jerusalem around the equinox / equilux, which - * calculates to 12.85° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * + * The zenith of 12.85° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getMisheyakir12Point85Degrees() */ protected static final double ZENITH_12_POINT_85 = GEOMETRIC_ZENITH + 12.85; /** - * The zenith of 13.24° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating Rabbeinu Tam's bain hashmashos according to some opinions. - * NOTE: See comments on {@link #getBainHashmashosRT13Point24Degrees} for additional details about the degrees. - * + * The zenith of 13.24° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getBainHashmashosRT13Point24Degrees - * */ protected static final double ZENITH_13_POINT_24 = GEOMETRIC_ZENITH + 13.24; /** - * The zenith of 19° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating alos according to some opinions. - * + * The zenith of 19° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getAlos19Degrees() - * @see #ZENITH_19_POINT_8 + * @see ZENITH_19_POINT_8 */ protected static final double ZENITH_19_DEGREES = GEOMETRIC_ZENITH + 19; /** - * The zenith of 19.8° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating alos (dawn) and tzais (nightfall) according to some opinions. This calculation is - * based on the position of the sun 90 minutes after sunset in Jerusalem around the equinox / equilux which - * calculates to 19.8° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * + * The zenith of 19.8° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getTzais19Point8Degrees() * @see #getAlos19Point8Degrees() - * @see #getAlos90() - * @see #getTzais90() - * @see #ZENITH_19_DEGREES + * @see ZENITH_19_DEGREES */ protected static final double ZENITH_19_POINT_8 = GEOMETRIC_ZENITH + 19.8; /** - * The zenith of 26° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating alos (dawn) and tzais (nightfall) according to some opinions. This calculation is - * based on the position of the sun {@link #getAlos120() 120 minutes} after sunset in Jerusalem around the equinox / equilux which - * calculates to 26° below {@link #GEOMETRIC_ZENITH geometric zenith}. Since the level of darkness when the sun is - * 26° and at a point when the level of darkness is long past the 18° point where the darkest point is reached, - * it should only be used lechumra such as delaying the start of nighttime mitzvos or avoiding eating - * this early on a fast day. - * + * The zenith of 26° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getAlos26Degrees() * @see #getTzais26Degrees() - * @see #getAlos120() - * @see #getTzais120() + * @see #getAlos120Minutes() + * @see #getTzais120Minutes() */ protected static final double ZENITH_26_DEGREES = GEOMETRIC_ZENITH + 26.0; /** - * The zenith of 4.37° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating tzais (nightfall) according to some opinions. This calculation is based on the position of - * the sun {@link #getTzaisGeonim4Point37Degrees() 16 7/8 minutes} after sunset (3/4 of a 22.5-minute mil) in Jerusalem around the equinox / equilux, - * which calculates to 4.37° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * - * @see #getTzaisGeonim4Point37Degrees() + * The zenith of 4.42° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). + * @see #getTzaisGeonim4Point42Degrees() */ - protected static final double ZENITH_4_POINT_37 = GEOMETRIC_ZENITH + 4.37; + protected static final double ZENITH_4_POINT_42 = GEOMETRIC_ZENITH + 4.42; /** - * The zenith of 4.61° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating tzais (nightfall) according to some opinions. This calculation is based on the position of - * the sun {@link #getTzaisGeonim4Point37Degrees() 18 minutes} after sunset (3/4 of a 24-minute mil) in - * Jerusalem around the equinox - * / equilux, which calculates to 4.61° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * @todo add documentation links - * - * @see #getTzaisGeonim4Point61Degrees() + * The zenith of 4.66° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). + * @see #getTzaisGeonim4Point66Degrees() */ - protected static final double ZENITH_4_POINT_61 = GEOMETRIC_ZENITH + 4.61; + protected static final double ZENITH_4_POINT_66 = GEOMETRIC_ZENITH + 4.66; /** - * The zenith of 4.8° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). - * @todo Add more documentation. + * The zenith of 4.8° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getTzaisGeonim4Point8Degrees() */ protected static final double ZENITH_4_POINT_8 = GEOMETRIC_ZENITH + 4.8; /** - * The zenith of 5.88° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). - * @todo Add more documentation. - */ - protected static final double ZENITH_5_POINT_88 = GEOMETRIC_ZENITH + 5.88; - - /** - * The zenith of 1.583° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating netz amiti (sunrise) and shkiah amiti (sunset) based on the opinion of the - * Baal Hatanya. - * - * @see #getSunriseBaalHatanya() - * @see #getSunsetBaalHatanya() - */ - protected static final double ZENITH_1_POINT_583 = GEOMETRIC_ZENITH + 1.583; - - /** - * The zenith of 16.9° below geometric zenith (90°). This calculation is used for determining alos - * (dawn) based on the opinion of the Baal Hatanya. It is based on the calculation that the time between dawn - * and netz amiti (sunrise) is 72 minutes, the time that is takes to walk 4 mil at 18 minutes - * a mil (Rambam and others). The sun's position at 72 - * minutes before {@link #getSunriseBaalHatanya netz amiti (sunrise)} in Jerusalem around the equinox / equilux is - * 16.9° below {@link #GEOMETRIC_ZENITH geometric zenith}. + * The zenith of 16.9° below geometric zenith (90°). * * @see #getAlosBaalHatanya() */ protected static final double ZENITH_16_POINT_9 = GEOMETRIC_ZENITH + 16.9; /** - * The zenith of 6° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating tzais / nightfall based on the opinion of the Baal Hatanya. This calculation is based on the - * position of the sun 24 minutes after {@link #getSunset() sunset} in Jerusalem around the equinox / equilux, which - * is 6° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * + * The zenith of 6° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getTzaisBaalHatanya() */ protected static final double ZENITH_6_DEGREES = GEOMETRIC_ZENITH + 6; /** - * The zenith of 6.45° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating tzais (nightfall) according to some opinions. This is based on the calculations of Rabbi Yechiel Michel Tucazinsky of the position of - * the sun no later than {@link #getTzaisGeonim6Point45Degrees() 31 minutes} after sunset in Jerusalem, and at the - * height of the summer solstice, this zman is 28 minutes after shkiah. This computes to 6.45° - * below {@link #GEOMETRIC_ZENITH geometric zenith}. This calculation is found in the Birur Halacha Yoreh Deah 262 it the commonly - * used zman in Israel. It should be noted that this differs from the 6.1°/6.2° calculation for - * Rabbi Tucazinsky's time as calculated by the Hazmanim Bahalacha Vol II chapter 50:7 (page 515). - * + * The zenith of 6.45° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getTzaisGeonim6Point45Degrees() */ protected static final double ZENITH_6_POINT_45 = GEOMETRIC_ZENITH + 6.45; /** - * The zenith of 7.65° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating misheyakir according to some opinions. - * + * The zenith of 7.65° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getMisheyakir7Point65Degrees() */ protected static final double ZENITH_7_POINT_65 = GEOMETRIC_ZENITH + 7.65; /** - * The zenith of 7.67° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating tzais according to some opinions. - * + * The zenith of 7.67° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getTzaisGeonim7Point67Degrees() */ protected static final double ZENITH_7_POINT_67 = GEOMETRIC_ZENITH + 7.67; /** - * The zenith of 9.3° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating tzais (nightfall) according to some opinions. - * + * The zenith of 9.3° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getTzaisGeonim9Point3Degrees() */ protected static final double ZENITH_9_POINT_3 = GEOMETRIC_ZENITH + 9.3; /** - * The zenith of 9.5° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for - * calculating misheyakir according to some opinions. - * + * The zenith of 9.5° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). * @see #getMisheyakir9Point5Degrees() */ protected static final double ZENITH_9_POINT_5 = GEOMETRIC_ZENITH + 9.5; /** - * The zenith of 9.75° below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for + * The zenith of 9.75° below {@link GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for * calculating alos (dawn) and tzais (nightfall) according to some opinions. * * @see #getTzaisGeonim9Point75Degrees() @@ -386,7 +259,7 @@ public class ComprehensiveZmanimCalendar extends ZmanimCalendar { protected static final double ZENITH_9_POINT_75 = GEOMETRIC_ZENITH + 9.75; /** - * The zenith of 2.1° above {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for + * The zenith of 2.1° above {@link GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for * calculating the start of bain hashmashos (twilight) of 13.5 minutes before sunset converted to degrees * according to the Yereim. As is traditional with degrees below the horizon, this is calculated without refraction * and from the center of the sun. It would be 0.833° less without this. @@ -396,7 +269,7 @@ public class ComprehensiveZmanimCalendar extends ZmanimCalendar { protected static final double ZENITH_MINUS_2_POINT_1 = GEOMETRIC_ZENITH - 2.1; /** - * The zenith of 2.8° above {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for + * The zenith of 2.8° above {@link GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for * calculating the start of bain hashmashos (twilight) of 16.875 minutes before sunset converted to degrees * according to the Yereim. As is traditional with degrees below the horizon, this is calculated without refraction * and from the center of the sun. It would be 0.833° less without this. @@ -406,7 +279,7 @@ public class ComprehensiveZmanimCalendar extends ZmanimCalendar { protected static final double ZENITH_MINUS_2_POINT_8 = GEOMETRIC_ZENITH - 2.8; /** - * The zenith of 3.05° above {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for + * The zenith of 3.05° above {@link GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for * calculating the start of bain hashmashos (twilight) of 18 minutes before sunset converted to degrees * according to the Yereim. As is traditional with degrees below the horizon, this is calculated without refraction * and from the center of the sun. It would be 0.833° less without this. @@ -441,7 +314,7 @@ public ComprehensiveZmanimCalendar(GeoLocation location) { * {@link AstronomicalCalculator#getDefault() AstronomicalCalculator} and default the calendar to the current date. * * @see AstronomicalCalendar#AstronomicalCalendar() - * @see #ComprehensiveZmanimCalendar(GeoLocation) + * @see ComprehensiveZmanimCalendar(GeoLocation) */ public ComprehensiveZmanimCalendar() { super(); @@ -538,39 +411,22 @@ public long getShaahZmanis16Point1Degrees() { * where it does not set, a {@link Long#MIN_VALUE} will be returned. See detailed explanation on top of the * {@link AstronomicalCalendar} documentation. * - * @see #getAlos60() - * @see #getTzais60() + * @see #getAlos60Minutes() + * @see #getTzais60Minutes() * @see #getPlagHamincha60Minutes() */ public long getShaahZmanis60Minutes() { - return getTemporalHour(getAlos60(), getTzais60()); - } - - /** - * Method to return a shaah zmanis (solar hour) according to the opinion of the Magen Avraham (MGA). This calculation divides the day - * based on the opinion of the MGA that the day runs from dawn to dusk. Dawn for this calculation is 72 minutes - * before sunrise and dusk is 72 minutes after sunset. This day is split into 12 equal parts with each part - * being a shaah zmanis. Alternate methods of calculating a shaah zmanis are available in the - * subclass {@link ComprehensiveZmanimCalendar}. - * - * @return the long millisecond length of a shaah zmanis. 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 {@link Long#MIN_VALUE} will be returned. See detailed explanation on top of the - * {@link AstronomicalCalendar} documentation. - */ - public long getShaahZmanis72Minutes() { - return getShaahZmanisMGA(); + return getTemporalHour(getAlos60Minutes(), getTzais60Minutes()); } /** * Method to return a shaah zmanis (temporal hour) according to the opinion of the Magen Avraham (MGA) based on alos being - * {@link #getAlos72Zmanis() 72} minutes zmaniyos before {@link #getSunrise() sunrise}. This calculation + * {@link #getAlos72Zmanis() 72} minutes zmaniyos before {@link #getSunset() sunrise}. This calculation * divides the day based on the opinion of the MGA that the day runs from dawn to dusk. Dawn for this calculation * is 72 minutes zmaniyos before sunrise and dusk is 72 minutes zmaniyos after sunset. This day * is split into 12 equal parts with each part being a shaah zmanis. This is identical to 1/10th of the day - * from {@link #getSunrise() sunrise} to {@link #getSunset() sunset}. + * from {@link #getSunset() sunrise} to {@link #getSunset() sunset}. * * @return the long millisecond length of a shaah zmanis. 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 @@ -595,17 +451,17 @@ public long getShaahZmanis72MinutesZmanis() { * {@link AstronomicalCalendar} documentation. */ public long getShaahZmanis90Minutes() { - return getTemporalHour(getAlos90(), getTzais90()); + return getTemporalHour(getAlos90Minutes(), getTzais90Minutes()); } /** * Method to return a shaah zmanis (temporal hour) according to the opinion of the Magen Avraham (MGA) based on alos being - * {@link #getAlos90Zmanis() 90} minutes zmaniyos before {@link #getSunrise() sunrise}. This calculation divides + * "https://en.wikipedia.org/wiki/Avraham_Gombiner">Magen Avraham (MGA) based on alos being {@link + * #getAlos90Zmanis() 90} minutes zmaniyos before {@link #getSunset() sunrise}. This calculation divides * the day based on the opinion of the MGA that the day runs from dawn to dusk. Dawn for this calculation is 90 minutes * zmaniyos before sunrise and dusk is 90 minutes zmaniyos after sunset. This day is split into 12 equal - * parts with each part being a shaah zmanis. This is 1/8th of the day from {@link #getSunrise() sunrise} to - * {@link #getSunset() sunset}. + * parts with each part being a shaah zmanis. This is 1/8th of the day from {@link #getSunset() sunrise} + * to {@link #getSunset() sunset}. * * @return the long millisecond length of a shaah zmanis. 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 @@ -621,11 +477,11 @@ public long getShaahZmanis90MinutesZmanis() { /** * Method to return a shaah zmanis (temporal hour) according to the opinion of the Magen Avraham (MGA) based on alos being {@link - * #getAlos96Zmanis() 96} minutes zmaniyos before {@link #getSunrise() sunrise}. This calculation divides the - * day based on the opinion of the MGA that the day runs from dawn to dusk. Dawn for this calculation is 96 minutes - * zmaniyos before sunrise and dusk is 96 minutes zmaniyos after sunset. This day is split into 12 - * equal parts with each part being a shaah zmanis. This is identical to 1/7.5th of the day from - * {@link #getSunrise() sunrise} to {@link #getSunset() sunset}. + * #getAlos96Zmanis() 96} minutes zmaniyos before {@link #getSunset() sunrise}. This calculation divides + * the day based on the opinion of the MGA that the day runs from dawn to dusk. Dawn for this calculation is 96 minutes + * zmaniyos before sunrise and dusk is 96 minutes zmaniyos after sunset. This day is split into 12 equal + * parts with each part being a shaah zmanis. This is identical to 1/7.5th of the day from {@link + * #getSunset() sunrise} to {@link #getSunset() sunset}. * * @return the long millisecond length of a shaah zmanis. 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 @@ -642,7 +498,7 @@ public long getShaahZmanis96MinutesZmanis() { * Method to return a shaah zmanis (temporal hour) according to the opinion of the * Chacham Yosef Harari-Raful of Yeshivat Ateret Torah calculated with alos being 1/10th * of sunrise to sunset day, or {@link #getAlos72Zmanis() 72} minutes zmaniyos of such a day before - * {@link #getSunrise() sunrise}, and tzais is usually calculated as {@link #getTzaisAteretTorah() 40 + * {@link #getSunset() sunrise}, and tzais is usually calculated as {@link #getTzaisAteretTorah() 40 * minutes} (configurable to any offset via {@link #setAteretTorahSunsetOffset(double)}) after {@link #getSunset() * sunset}. This day is split into 12 equal parts with each part being a shaah zmanis. Note that with this * system, chatzos (midday) will not be the point that the sun is {@link #getSunTransit() halfway across @@ -719,7 +575,7 @@ public long getShaahZmanisAlos16Point1ToTzais3Point7() { * {@link AstronomicalCalendar} documentation. */ public long getShaahZmanis96Minutes() { - return getTemporalHour(getAlos96(), getTzais96()); + return getTemporalHour(getAlos96Minutes(), getTzais96Minutes()); } /** @@ -738,20 +594,19 @@ public long getShaahZmanis96Minutes() { * @see #getShaahZmanis26Degrees() */ public long getShaahZmanis120Minutes() { - return getTemporalHour(getAlos120(), getTzais120()); + return getTemporalHour(getAlos120Minutes(), getTzais120Minutes()); } /** * Method to return a shaah zmanis (temporal hour) according to the opinion of the Magen Avraham (MGA) based on alos being {@link - * #getAlos120Zmanis() 120} minutes zmaniyos before {@link #getSunrise() sunrise}. This calculation divides - * the day based on the opinion of the MGA that the day runs from dawn to dusk. Dawn for this calculation is - * 120 minutes zmaniyos before sunrise and dusk is 120 minutes zmaniyos after sunset. This day is - * split into 12 equal parts with each part being a shaah zmanis. This is identical to 1/6th of the day from - * {@link #getSunrise() sunrise} to {@link #getSunset() sunset}. Since zmanim that use this method are - * extremely late or early and at a point when the sky is a long time past the 18° point where the darkest point - * is reached, zmanim that use this should only be used lechumra such as delaying the start of - * nighttime mitzvos. + * #getAlos120Zmanis() 120} minutes zmaniyos before {@link #getSunset() sunrise}. This calculation divides + * the day based on the opinion of the MGA that the day runs from dawn to dusk. Dawn for this calculation is 120 minutes + * zmaniyos before sunrise and dusk is 120 minutes zmaniyos after sunset. This day is split into 12 equal + * parts with each part being a shaah zmanis. This is identical to 1/6th of the day from {@link + * #getSunset() sunrise} to {@link #getSunset() sunset}. Since zmanim that use this method are + * extremely late or early and at a point when the sky is a long time past the 18° point where the darkest point is reached, + * zmanim that use this should only be used lechumra such as delaying the start of nighttime mitzvos. * * @return the long millisecond length of a shaah zmanis. 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 @@ -776,27 +631,27 @@ public long getShaahZmanis120MinutesZmanis() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. 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 #getShaahZmanis120MinutesZmanis() - * @see #getAlos120() - * @see #getTzais120() + * @see #getAlos120Minutes() + * @see #getTzais120Minutes() * @see #getPlagHamincha26Degrees() * @see #getPlagHamincha120Minutes() */ @Deprecated (forRemoval=false) - public Date getPlagHamincha120MinutesZmanis() { + public Instant getPlagHamincha120MinutesZmanis() { return getPlagHamincha(getAlos120Zmanis(), getTzais120Zmanis(), true); } /** * This method should be used lechumra only and returns the time of plag hamincha according to the * Magen Avraham with the day starting 120 minutes before sunrise and ending 120 minutes after sunset. This is - * calculated as 10.75 hours after {@link #getAlos120() dawn 120 minutes}. The formula used is 10.75 {@link - * #getShaahZmanis120Minutes()} after {@link #getAlos120()}. Since the zman based on an extremely early + * calculated as 10.75 hours after {@link #getAlos120Minutes() dawn 120 minutes}. The formula used is 10.75 {@link + * #getShaahZmanis120Minutes()} after {@link #getAlos120Minutes()}. Since the zman based on an extremely early * alos and a very late tzais, it should only be used lechumra. * * @deprecated This method should be used lechumra only since it returns a very late time (often after @@ -804,7 +659,7 @@ public Date getPlagHamincha120MinutesZmanis() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. 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. @@ -813,44 +668,41 @@ public Date getPlagHamincha120MinutesZmanis() { * @see #getPlagHamincha26Degrees() */ @Deprecated (forRemoval=false) - public Date getPlagHamincha120Minutes() { - return getPlagHamincha(getAlos120(), getTzais120(), true); + public Instant getPlagHamincha120Minutes() { + return getPlagHamincha(getAlos120Minutes(), getTzais120Minutes(), true); } /** - * Method to return alos (dawn) calculated as 60 minutes before {@link #getSunrise() sunrise} or + * Method to return alos (dawn) calculated as 60 minutes before {@link #getSunset() sunrise} or * {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link #isUseElevation()} setting). This is the * time to walk the distance of 4 mil at 15 minutes a mil. This seems to be the opinion of the - * Chavas Yair in the Mekor Chaim, Orach Chaim Ch. 90, - * though the Mekor Chaim in Ch. 58 and in the Chut Hashani Ch. 97 states that a person walks 3 and a 1/3 mil in an hour, or an 18-minute mil. - * Also see the mil at 15 minutes a mil. This seems to be the opinion of the Chavas Yair in the Mekor Chaim, Orach Chaim Ch. 90, though the Mekor Chaim in Ch. 58 and in the Chut Hashani Ch. 97 states that a person walks 3 and a + * 1/3 mil in an hour, or an 18-minute mil. Also see the Divrei Malkiel Vol. 4, Ch. 20, page 34) who - * mentions the 15 minute mil lechumra by baking matzos. Also see the Maharik Ch. 173 where the questioner quoting the - * Ra'avan is of the opinion that the time to walk a - * mil is 15 minutes (5 mil in a little over an hour). There are many who believe that there is a - * ta'us sofer (scribe's error) in the Ra'avan, and it should 4 mil in a little over an hour, or an - * 18-minute mil. Time based offset calculations are based on the opinion of the - * Rishonim who stated that the time of the neshef - * (time between dawn and sunrise) does not vary by the time of year or location but purely depends on the time it takes to - * walk the distance of 4* mil. {@link #getTzaisGeonim9Point75Degrees()} is a related zman that is a - * degree-based calculation based on 60 minutes. - * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * >Divrei Malkiel Vol. 4, Ch. 20, page 34) who mentions the + * 15 minute mil lechumra by baking matzos. Also see the Maharik Ch. 173 where the questioner quoting + * the Ra'avan is of the opinion that the time to walk a mil is + * 15 minutes (5 mil in a little over an hour). There are many who believe that there is a ta'us sofer (scribe's + * error) in the Ra'avan, and it should 4 mil in a little over an hour, or an 18-minute mil. Time based offset calculations are + * based on the opinion of the Rishonim who stated that the time + * of the neshef (time between dawn and sunrise) does not vary by the time of year or location but purely depends on + * the time it takes to walk the distance of 4* mil. {@link #getTzaisGeonim9Point75Degrees()} is a related zman that + * is a degree-based calculation based on 60 minutes. + * + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar}. * documentation. * - * @see #getTzais60() + * @see #getTzais60Minutes() * @see #getPlagHamincha60Minutes() * @see #getShaahZmanis60Minutes() */ - public Date getAlos60() { - return getTimeOffset(getElevationAdjustedSunrise(), -60 * MINUTE_MILLIS); + public Instant getAlos60Minutes() { + return getTimeOffset(getSunriseBasedOnElevationSetting(), -60 * MINUTE_MILLIS); } /** @@ -858,24 +710,24 @@ public Date getAlos60() { * sunrise. This is based on an 18-minute mil so the time for 4 mil is * 72 minutes which is 1/10th of a day (12 * 60 = 720) based on the day being 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 actual calculation is {@link - * #getElevationAdjustedSunrise()} - ({@link #getShaahZmanisGra()} * 1.2). This calculation is used in the calendars + * level sunrise} to {@link #getSeaLevelSunset() sea level sunset} or {@link #getSunset() sunrise} to {@link + * #getSunset() sunset} (depending on the {@link #isUseElevation()} setting). The actual calculation is {@link + * #getSunriseBasedOnElevationSetting()} - ({@link #getShaahZmanisGRA()} * 1.2). This calculation is used in the calendars * published by the Hisachdus Harabanim D'Artzos Habris * Ve'Canada. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. - * @see #getShaahZmanisGra() + * @see #getShaahZmanisGRA() */ - public Date getAlos72Zmanis() { + public Instant getAlos72Zmanis() { return getZmanisBasedOffset(-1.2); } /** - * Method to return alos (dawn) calculated using 96 minutes before {@link #getSunrise() sunrise} or + * Method to return alos (dawn) calculated using 96 minutes before {@link #getSunset() sunrise} or * {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link #isUseElevation()} setting) that is based * on the time to walk the distance of 4 mil at 24 minutes a mil. @@ -884,78 +736,77 @@ public Date getAlos72Zmanis() { * dawn and sunrise) does not vary by the time of year or location but purely depends on the time it takes to walk the * distance of 4 mil. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. */ - public Date getAlos96() { - return getTimeOffset(getElevationAdjustedSunrise(), -96 * MINUTE_MILLIS); + public Instant getAlos96Minutes() { + return getTimeOffset(getSunriseBasedOnElevationSetting(), -96 * MINUTE_MILLIS); } /** * Method to return alos (dawn) calculated using 90 minutes zmaniyos or 1/8th of the day before - * {@link #getSunrise() sunrise} or {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link + * {@link #getSunset() sunrise} or {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link * #isUseElevation()} setting). This is based on a 22.5-minute mil so the time for 4 - * mil is 90 minutes which is 1/8th of a day (12 * 60) / 8 = 90. 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()}. The actual calculation used - * is {@link #getElevationAdjustedSunrise()} - ({@link #getShaahZmanisGra()} * 1.5). + * "https://en.wikipedia.org/wiki/Biblical_and_Talmudic_units_of_measurement">mil so the time for 4 mil is 90 minutes + * which is 1/8th of a day (12 * 60) / 8 = 90. The day is calculated from {@link #getSeaLevelSunrise() sea level sunrise} + * to {@link #getSeaLevelSunset() sea level sunset} or {@link #getSunset() sunrise} to {@link + * #getSunset() sunset} (depending on the {@link #isUseElevation()}. The actual calculation used is + * {@link #getSunriseBasedOnElevationSetting()} - ({@link #getShaahZmanisGRA()} * 1.5). * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. - * @see #getShaahZmanisGra() + * @see #getShaahZmanisGRA() */ - public Date getAlos90Zmanis() { + public Instant getAlos90Zmanis() { return getZmanisBasedOffset(-1.5); } /** * This method returns alos (dawn) calculated using 96 minutes zmaniyos or 1/7.5th of the day before - * {@link #getSunrise() sunrise} or {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link + * {@link #getSunset() sunrise} or {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link * #isUseElevation()} setting). This is based on a 24-minute mil so the time for 4 mil is 96 - * minutes which is 1/7.5th of a day (12 * 60 / 7.5 = 96). 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()}. The actual calculation used is {@link #getElevationAdjustedSunrise()} - * - ({@link #getShaahZmanisGra()} * 1.6). + * "https://en.wikipedia.org/wiki/Biblical_and_Talmudic_units_of_measurement">mil so the time for 4 mil is 96 minutes + * which is 1/7.5th of a day (12 * 60 / 7.5 = 96). The day is calculated from {@link #getSeaLevelSunrise() sea level sunrise} + * to {@link #getSeaLevelSunset() sea level sunset} or {@link #getSunset() sunrise} to {@link + * getSunset() sunset} (depending on the {@link #isUseElevation()}. The actual calculation used is {@link + * getSunriseBasedOnElevationSetting()} - ({@link #getShaahZmanisGRA()} * 1.6). * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. - * @see #getShaahZmanisGra() + * @see #getShaahZmanisGRA() */ - public Date getAlos96Zmanis() { + public Instant getAlos96Zmanis() { return getZmanisBasedOffset(-1.6); } /** - * Method to return alos (dawn) calculated using 90 minutes before {@link #getSunrise() sunrise} or - * {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link #isUseElevation()} setting) based - * on the time to walk the distance of 4 mil at 22.5 minutes a - * mil. Time-based offset calculations for alos are based on the opinion of the Rishonim who stated that the time of the Neshef - * (time between dawn and sunrise) does not vary by the time of year or location but purely depends on the time it - * takes to walk the distance of 4 mil. + * Method to return alos (dawn) calculated using 90 minutes before {@link #getSunset() sunrise} or + * {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link #isUseElevation()} setting) based on the time + * to walk the distance of 4 mil at + * 22.5 minutes a mil. Time-based offset calculations for alos are based on the opinion of the Rishonim who stated that the time of the Neshef (time between + * dawn and sunrise) does not vary by the time of year or location but purely depends on the time it takes to walk the + * distance of 4 mil. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. */ - public Date getAlos90() { - return getTimeOffset(getElevationAdjustedSunrise(), -90 * MINUTE_MILLIS); + public Instant getAlos90Minutes() { + return getTimeOffset(getSunriseBasedOnElevationSetting(), -90 * MINUTE_MILLIS); } /** * This method should be used lechumra only and returns alos (dawn) calculated using 120 minutes - * before {@link #getSunrise() sunrise} or {@link #getSeaLevelSunrise() sea level sunrise} (depending on the {@link - * #isUseElevation()} setting) based on the time to walk the distance of 5 mil (Ula) at 24 minutes a * mil. Time based offset calculations for alos are based on the* opinion of the Rishonim who stated that the time of the neshef (time @@ -969,56 +820,55 @@ public Date getAlos90() { * too early according to most opinions. There is no current plan to remove this method from the API, and this * deprecation is intended to alert developers of the danger of using it. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. * - * @see #getTzais120() + * @see #getTzais120Minutes() * @see #getAlos26Degrees() */ @Deprecated (forRemoval=false) - public Date getAlos120() { - return getTimeOffset(getElevationAdjustedSunrise(), -120 * MINUTE_MILLIS); + public Instant getAlos120Minutes() { + return getTimeOffset(getSunriseBasedOnElevationSetting(), -120 * MINUTE_MILLIS); } /** * This method should be used lechumra only and method returns alos (dawn) calculated using - * 120 minutes zmaniyos or 1/6th of the day before {@link #getSunrise() sunrise} or {@link + * 120 minutes zmaniyos or 1/6th of the day before {@link #getSunset() sunrise} or {@link * #getSeaLevelSunrise() sea level sunrise} (depending on the {@link #isUseElevation()} setting). This is based * on a 24-minute mil so - * the time for 5 mil is 120 minutes which is 1/6th of a day (12 * 60 / 6 = 120). 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()}. The - * actual calculation used is {@link #getSunrise()} - ({@link #getShaahZmanisGra()} * 2). Since this time is - * extremely early, it should only be used lechumra, such - * as not eating after this time on a fast day, and not as the start time for mitzvos that can only be - * performed during the day. + * the time for 5 mil is 120 minutes which is 1/6th of a day (12 * 60 / 6 = 120). The day is calculated from + * {@link #getSeaLevelSunrise() sea level sunrise} to {@link #getSeaLevelSunset() sea level sunset} or {@link + * #getSunset() sunrise} to {@link #getSunset() sunset} (depending on the {@link + * #isUseElevation()}. The actual calculation used is {@link #getSunset()} - ({@link #getShaahZmanisGRA()} + * * 2). Since this time is extremely early, it should only be used lechumra, such as not eating after this time + * on a fast day, and not as the start time for mitzvos that can only be performed during the day. * * @deprecated This method should be used lechumra only (such as stopping to eat at this time on a fast day), * since it returns a very early time, and if used lekula can result in doing mitzvos hayom * too early according to most opinions. There is no current plan to remove this method from the API, and this * deprecation is intended to alert developers of the danger of using it. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. - * @see #getAlos120() + * @see #getAlos120Minutes() * @see #getAlos26Degrees() */ @Deprecated (forRemoval=false) - public Date getAlos120Zmanis() { + public Instant getAlos120Zmanis() { return getZmanisBasedOffset(-2.0); } /** * This method should be used lechumra only and returns alos (dawn) calculated when the sun is {@link - * #ZENITH_26_DEGREES 26°} below the eastern geometric horizon before sunrise. This calculation is based on the same - * calculation of {@link #getAlos120() 120 minutes} but uses a degree-based calculation instead of 120 exact minutes. This - * calculation is based on the position of the sun 120 minutes before sunrise in Jerusalem around the equinox / equilux, which - * calculates to 26° below {@link #GEOMETRIC_ZENITH geometric zenith}. Since this time is extremely early, it should + * calculates to 26° below {@link GEOMETRIC_ZENITH geometric zenith}. Since this time is extremely early, it should * only be used lechumra only, such as not eating after this time on a fast day, and not as the start time for * mitzvos that can only be performed during the day. * @@ -1027,36 +877,35 @@ public Date getAlos120Zmanis() { * too early according to most opinions. There is no current plan to remove this method from the API, and this * deprecation is intended to alert developers of the danger of using it. * - * @return the Date representing alos. If the calculation can't be computed such as northern + * @return the Instant representing alos. If the calculation can't be computed such as northern * and southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun * may not reach low enough below the horizon for this calculation, a null will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #ZENITH_26_DEGREES - * @see #getAlos120() - * @see #getTzais120() + * @see #getAlos120Minutes() + * @see #getTzais120Minutes() * @see #getTzais26Degrees() */ @Deprecated (forRemoval=false) - public Date getAlos26Degrees() { + public Instant getAlos26Degrees() { return getSunriseOffsetByDegrees(ZENITH_26_DEGREES); } /** - * A method to return alos (dawn) calculated when the sun is {@link #ASTRONOMICAL_ZENITH 18°} below the + * A method to return alos (dawn) calculated when the sun is {@link ASTRONOMICAL_ZENITH 18°} below the * eastern geometric horizon before sunrise. * - * @return the Date representing alos. If the calculation can't be computed such as northern + * @return the Instant representing alos. If the calculation can't be computed such as northern * and southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun * may not reach low enough below the horizon for this calculation, a null will be returned. * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #ASTRONOMICAL_ZENITH + * @see ASTRONOMICAL_ZENITH */ - public Date getAlos18Degrees() { + public Instant getAlos18Degrees() { return getSunriseOffsetByDegrees(ASTRONOMICAL_ZENITH); } /** - * A method to return alos (dawn) calculated when the sun is {@link #ZENITH_19_DEGREES 19°} below the + * A method to return alos (dawn) calculated when the sun is {@link ZENITH_19_DEGREES 19°} below the * eastern geometric horizon before sunrise. This is the Rambam's alos according to Rabbi Moshe Kosower's Maaglei Tzedek, page 88, Yom Valayla Shel Torah, Ch. 34, p. 222 and * Rabbi Yaakov Shakow's Luach Ikvei Hayom. * - * @return the Date representing alos. If the calculation can't be computed such as northern + * @return the Instant representing alos. If the calculation can't be computed such as northern * and southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun * may not reach low enough below the horizon for this calculation, a null will be returned. * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #ASTRONOMICAL_ZENITH */ - public Date getAlos19Degrees() { + public Instant getAlos19Degrees() { return getSunriseOffsetByDegrees(ZENITH_19_DEGREES); } /** - * Method to return alos (dawn) calculated when the sun is {@link #ZENITH_19_POINT_8 19.8°} below the + * Method to return alos (dawn) calculated when the sun is {@link ZENITH_19_POINT_8 19.8°} below the * eastern geometric horizon before sunrise. This calculation is based on the same calculation of - * {@link #getAlos90() 90 minutes} but uses a degree-based calculation instead of 90 exact minutes. This calculation - * is based on the position of the sun 90 minutes before sunrise in Jerusalem around the equinox / equilux, which - * calculates to 19.8° below {@link #GEOMETRIC_ZENITH geometric zenith}. + * calculates to 19.8° below {@link GEOMETRIC_ZENITH geometric zenith}. * - * @return the Date representing alos. If the calculation can't be computed such as northern + * @return the Instant representing alos. If the calculation can't be computed such as northern * and southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun * may not reach low enough below the horizon for this calculation, a null will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #ZENITH_19_POINT_8 - * @see #getAlos90() + * @see #getAlos90Minutes() + * @see #getTzais19Point8Degrees() */ - public Date getAlos19Point8Degrees() { + public Instant getAlos19Point8Degrees() { return getSunriseOffsetByDegrees(ZENITH_19_POINT_8); } - - /** - * Method to return alos (dawn) calculated when the sun is {@link #ZENITH_16_POINT_1 16.1°} below the - * eastern geometric horizon before sunrise. This calculation is based on the same calculation of - * {@link #getAlos72() 72 minutes} but uses a degree-based calculation instead of 72 exact minutes. This calculation - * is based on the position of the sun 72 minutes before sunrise in Jerusalem around the equinox / equilux, which - * calculates to 16.1° below {@link #GEOMETRIC_ZENITH geometric zenith}. - * - * @return the Date representing alos. If the calculation can't be computed such as northern - * and southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun - * may not reach low enough below the horizon for this calculation, a null will be returned. See - * detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #ZENITH_16_POINT_1 - * @see #getAlos72() - */ - public Date getAlos16Point1Degrees() { - return getSunriseOffsetByDegrees(ZENITH_16_POINT_1); - } /** - * This method returns misheyakir based on the position of the sun {@link #ZENITH_12_POINT_85 12.85°} - * below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This is based on the position of the sun slightly - * later than 57 minutes before {@link #getSunrise() sunrise} in Jerusalem misheyakir based on the position of the sun {@link ZENITH_12_POINT_85 12.85°} + * below {@link GEOMETRIC_ZENITH geometric zenith} (90°). This is based on the position of the sun slightly + * later than 57 minutes before {@link #getSunset() sunrise} in Jerusalem around the equinox / equilux. This * zman is mentioned for use bish'as hadchak in the Birur Halacha Tinyana and Date of misheyakir. If the calculation can't be computed such as northern and + * @return The Instant of misheyakir. If the calculation can't be computed such as northern and * southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may * not reach low enough below the horizon for this calculation, a null will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #ZENITH_12_POINT_85 + * @see ZENITH_12_POINT_85 */ @Deprecated (forRemoval=false) - public Date getMisheyakir12Point85Degrees() { + public Instant getMisheyakir12Point85Degrees() { return getSunriseOffsetByDegrees(ZENITH_12_POINT_85); } /** - * This method returns misheyakir based on the position of the sun when it is {@link #ZENITH_11_DEGREES - * 11.5°} below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for calculating + * This method returns misheyakir based on the position of the sun when it is {@link ZENITH_11_DEGREES + * 11.5°} below {@link GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for calculating * misheyakir according to some opinions. This calculation is based on the position of the sun 52 minutes - * before {@link #getSunrise() sunrise} in Jerusalem around the equinox / equilux, - * which calculates to 11.5° below {@link #GEOMETRIC_ZENITH geometric zenith}. + * which calculates to 11.5° below {@link GEOMETRIC_ZENITH geometric zenith}. * @todo recalculate. * - * @return the Date of misheyakir. If the calculation can't be computed such as northern and + * @return the Instant of misheyakir. If the calculation can't be computed such as northern and * southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may * not reach low enough below the horizon for this calculation, a null will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #ZENITH_11_POINT_5 + * @see ZENITH_11_POINT_5 */ - public Date getMisheyakir11Point5Degrees() { + public Instant getMisheyakir11Point5Degrees() { return getSunriseOffsetByDegrees(ZENITH_11_POINT_5); } /** - * This method returns misheyakir based on the position of the sun when it is {@link #ZENITH_11_DEGREES - * 11°} below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for calculating + * This method returns misheyakir based on the position of the sun when it is {@link ZENITH_11_DEGREES + * 11°} below {@link GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for calculating * misheyakir according to some opinions. This calculation is based on the position of the sun 48 minutes - * before {@link #getSunrise() sunrise} in Jerusalem around the equinox / equilux, - * which calculates to 11° below {@link #GEOMETRIC_ZENITH geometric zenith}. + * which calculates to 11° below {@link GEOMETRIC_ZENITH geometric zenith}. * * @return If the calculation can't be computed such as northern and southern locations even south of the Arctic * Circle and north of the Antarctic Circle where the sun may not reach low enough below the horizon for * this calculation, a null will be returned. See detailed explanation on top of the * {@link AstronomicalCalendar} documentation. - * @see #ZENITH_11_DEGREES + * @see ZENITH_11_DEGREES */ - public Date getMisheyakir11Degrees() { + public Instant getMisheyakir11Degrees() { return getSunriseOffsetByDegrees(ZENITH_11_DEGREES); } /** - * This method returns misheyakir based on the position of the sun when it is {@link #ZENITH_10_POINT_2 - * 10.2°} below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for calculating + * This method returns misheyakir based on the position of the sun when it is {@link ZENITH_10_POINT_2 + * 10.2°} below {@link GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is used for calculating * misheyakir according to some opinions. This calculation is based on the position of the sun 45 minutes - * before {@link #getSunrise() sunrise} in Jerusalem around the equinox which calculates - * to 10.2° below {@link #GEOMETRIC_ZENITH geometric zenith}. + * to 10.2° below {@link GEOMETRIC_ZENITH geometric zenith}. * - * @return the Date of misheyakir. If the calculation can't be computed such as + * @return the Instant of misheyakir. If the calculation can't be computed such as * northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle where * the sun may not reach low enough below the horizon for this calculation, a null will be returned * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #ZENITH_10_POINT_2 + * @see ZENITH_10_POINT_2 */ - public Date getMisheyakir10Point2Degrees() { + public Instant getMisheyakir10Point2Degrees() { return getSunriseOffsetByDegrees(ZENITH_10_POINT_2); } /** - * This method returns misheyakir based on the position of the sun when it is {@link #ZENITH_7_POINT_65 - * 7.65°} below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). The degrees are based on a 35/36 minute + * This method returns misheyakir based on the position of the sun when it is {@link ZENITH_7_POINT_65 + * 7.65°} below {@link GEOMETRIC_ZENITH geometric zenith} (90°). The degrees are based on a 35/36 minute * zman around the * equinox / equilux, when the neshef (twilight) is the shortest. This time is based on Rabbi Moshe Feinstein who writes in zman depends on the level of light, Rabbi Yaakov Shakow * presented this degree-based calculations to Rabbi Shmuel Kamenetsky who agreed to them. * - * @return the Date of misheyakir. If the calculation can't be computed such as + * @return the Instant of misheyakir. If the calculation can't be computed such as * northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle where * the sun may not reach low enough below the horizon for this calculation, a null will be returned. * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. * - * @see #ZENITH_7_POINT_65 + * @see ZENITH_7_POINT_65 * @see #getMisheyakir9Point5Degrees() */ - public Date getMisheyakir7Point65Degrees() { + public Instant getMisheyakir7Point65Degrees() { return getSunriseOffsetByDegrees(ZENITH_7_POINT_65); } /** - * This method returns misheyakir based on the position of the sun when it is {@link #ZENITH_9_POINT_5 - * 9.5°} below {@link #GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is based on misheyakir based on the position of the sun when it is {@link ZENITH_9_POINT_5 + * 9.5°} below {@link GEOMETRIC_ZENITH geometric zenith} (90°). This calculation is based on Rabbi Dovid Kronglass's Calculation of 45 minutes in Baltimore * as mentioned in Divrei Chachamim No. 24 * brought down by the Birur Halacha, Tinyana, Ch. @@ -1260,113 +1089,89 @@ public Date getMisheyakir7Point65Degrees() { * this zman depends on the level of light, Rabbi Yaakov Shakow presented these degree-based times to Rabbi Shmuel * Kamenetsky who agreed to them. * - * @return the Date of misheyakir. If the calculation can't be computed such as + * @return the Instant of misheyakir. If the calculation can't be computed such as * northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle where * the sun may not reach low enough below the horizon for this calculation, a null will be returned. * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. * - * @see #ZENITH_9_POINT_5 + * @see ZENITH_9_POINT_5 * @see #getMisheyakir7Point65Degrees() */ - public Date getMisheyakir9Point5Degrees() { + public Instant getMisheyakir9Point5Degrees() { return getSunriseOffsetByDegrees(ZENITH_9_POINT_5); } /** * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the * opinion of the Magen Avraham (MGA) based on - * alos being {@link #getAlos19Point8Degrees() 19.8°} before {@link #getSunrise() sunrise}. This + * alos being {@link #getAlos19Point8Degrees() 19.8°} before {@link #getSunset() sunrise}. This * time is 3 {@link #getShaahZmanis19Point8Degrees() shaos zmaniyos} (solar hours) after {@link * #getAlos19Point8Degrees() dawn} based on the opinion of the MGA that the day is calculated from dawn to nightfall * with both being 19.8° below sunrise or sunset. This returns the time of 3 * * {@link #getShaahZmanis19Point8Degrees()} after {@link #getAlos19Point8Degrees() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. * @see #getShaahZmanis19Point8Degrees() * @see #getAlos19Point8Degrees() */ - public Date getSofZmanShmaMGA19Point8Degrees() { + public Instant getSofZmanShmaMGA19Point8Degrees() { return getSofZmanShma(getAlos19Point8Degrees(), getTzais19Point8Degrees(), true); } /** - * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the - * opinion of the Magen Avraham (MGA) based - * on alos being {@link #getAlos16Point1Degrees() 16.1°} before {@link #getSunrise() sunrise}. This time - * is 3 {@link #getShaahZmanis16Point1Degrees() shaos zmaniyos} (solar hours) after - * {@link #getAlos16Point1Degrees() dawn} based on the opinion of the MGA that the day is calculated from - * dawn to nightfall with both being 16.1° below sunrise or sunset. This returns the time of - * 3 * {@link #getShaahZmanis16Point1Degrees()} after {@link #getAlos16Point1Degrees() dawn}. + * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the opinion of + * the Magen Avraham (MGA) based on alos being {@link + * #getAlos16Point1Degrees() 16.1°} before {@link #getSunset() sunrise}. This time is 3 {@link + * #getShaahZmanis16Point1Degrees() shaos zmaniyos} (solar hours) after {@link #getAlos16Point1Degrees() dawn} based on + * the opinion of the MGA that the day is calculated from dawn to nightfall with both being 16.1° below sunrise or sunset. + * This returns the time of 3 * {@link #getShaahZmanis16Point1Degrees()} after {@link #getAlos16Point1Degrees() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. * @see #getShaahZmanis16Point1Degrees() * @see #getAlos16Point1Degrees() */ - public Date getSofZmanShmaMGA16Point1Degrees() { + public Instant getSofZmanShmaMGA16Point1Degrees() { return getSofZmanShma(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true); } /** * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the * opinion of the Magen Avraham (MGA) based - * on alos being {@link #getAlos18Degrees() 18°} before {@link #getSunrise() sunrise}. This time is 3 + * on alos being {@link #getAlos18Degrees() 18°} before {@link #getSunset() sunrise}. This time is 3 * {@link #getShaahZmanis18Degrees() shaos zmaniyos} (solar hours) after {@link #getAlos18Degrees() dawn} * based on the opinion of the MGA that the day is calculated from dawn to nightfall with both being 18° * below sunrise or sunset. This returns the time of 3 * {@link #getShaahZmanis18Degrees()} after * {@link #getAlos18Degrees() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. * @see #getShaahZmanis18Degrees() * @see #getAlos18Degrees() */ - public Date getSofZmanShmaMGA18Degrees() { + public Instant getSofZmanShmaMGA18Degrees() { return getSofZmanShma(getAlos18Degrees(), getTzais18Degrees(), true); } - /** - * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the - * opinion of the Magen Avraham (MGA) based on - * alos being {@link #getAlos72() 72} minutes before {@link #getSunrise() sunrise}. This time is 3 {@link - * #getShaahZmanis72Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos72() dawn} based on the opinion - * of the MGA that the day is calculated from a {@link #getAlos72() dawn} of 72 minutes before sunrise to - * {@link #getTzais72() nightfall} of 72 minutes after sunset. This returns the time of 3 * {@link - * #getShaahZmanis72Minutes()} after {@link #getAlos72() dawn}. This class returns an identical time to {@link - * #getSofZmanShmaMGA()} and is repeated here for clarity. - * - * @return the Date of the latest zman krias shema. 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 #isUseAstronomicalChatzosForOtherZmanim() - * @see #getShaahZmanis72Minutes() - * @see #getAlos72() - * @see #getSofZmanShmaMGA() - */ - public Date getSofZmanShmaMGA72Minutes() { - return getSofZmanShmaMGA(); - } - /** * This method returns the latest zman krias shema (time to recite Shema in the morning) according * to the opinion of the Magen Avraham (MGA) based * on alos being {@link #getAlos72Zmanis() 72} minutes zmaniyos, or 1/10th of the day before - * {@link #getSunrise() sunrise}. This time is 3 {@link #getShaahZmanis90MinutesZmanis() shaos zmaniyos} + * {@link #getSunset() sunrise}. This time is 3 {@link #getShaahZmanis90MinutesZmanis() shaos zmaniyos} * (solar hours) after {@link #getAlos72Zmanis() dawn} based on the opinion of the MGA that the day is calculated * from a {@link #getAlos72Zmanis() dawn} of 72 minutes zmaniyos, or 1/10th of the day before * {@link #getSeaLevelSunrise() sea level sunrise} to {@link #getTzais72Zmanis() nightfall} of 72 minutes * zmaniyos after {@link #getSeaLevelSunset() sea level sunset}. This returns the time of 3 * * {@link #getShaahZmanis72MinutesZmanis()} after {@link #getAlos72Zmanis() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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. @@ -1374,42 +1179,42 @@ public Date getSofZmanShmaMGA72Minutes() { * @see #getAlos72Zmanis() * @see #isUseAstronomicalChatzosForOtherZmanim() */ - public Date getSofZmanShmaMGA72MinutesZmanis() { + public Instant getSofZmanShmaMGA72MinutesZmanis() { return getSofZmanShma(getAlos72Zmanis(), getTzais72Zmanis(), true); } /** * This method returns the latest zman krias shema (time to recite Shema in the morning) according * to the opinion of the Magen Avraham (MGA) based on - * alos being {@link #getAlos90() 90} minutes before {@link #getSunrise() sunrise}. This time is 3 - * {@link #getShaahZmanis90Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos90() dawn} based on - * the opinion of the MGA that the day is calculated from a {@link #getAlos90() dawn} of 90 minutes before sunrise to - * {@link #getTzais90() nightfall} of 90 minutes after sunset. This returns the time of 3 * - * {@link #getShaahZmanis90Minutes()} after {@link #getAlos90() dawn}. + * alos being {@link #getAlos90Minutes() 90} minutes before {@link #getSunset() sunrise}. This time is 3 + * {@link #getShaahZmanis90Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos90Minutes() dawn} based on + * the opinion of the MGA that the day is calculated from a {@link #getAlos90Minutes() dawn} of 90 minutes before sunrise to + * {@link #getTzais90Minutes() nightfall} of 90 minutes after sunset. This returns the time of 3 * + * {@link #getShaahZmanis90Minutes()} after {@link #getAlos90Minutes() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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 #getShaahZmanis90Minutes() - * @see #getAlos90() + * @see #getAlos90Minutes() * @see #isUseAstronomicalChatzosForOtherZmanim() */ - public Date getSofZmanShmaMGA90Minutes() { - return getSofZmanShma(getAlos90(), getTzais90(), true); + public Instant getSofZmanShmaMGA90Minutes() { + return getSofZmanShma(getAlos90Minutes(), getTzais90Minutes(), true); } /** * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the * opinion of the Magen Avraham (MGA) based - * on alos being {@link #getAlos90Zmanis() 90} minutes zmaniyos before {@link #getSunrise() + * on alos being {@link #getAlos90Zmanis() 90} minutes zmaniyos before {@link #getSunset() * sunrise}. This time is 3 {@link #getShaahZmanis90MinutesZmanis() shaos zmaniyos} (solar hours) after * {@link #getAlos90Zmanis() dawn} based on the opinion of the MGA that the day is calculated from a {@link * #getAlos90Zmanis() dawn} of 90 minutes zmaniyos before sunrise to {@link #getTzais90Zmanis() nightfall} * of 90 minutes zmaniyos after sunset. This returns the time of 3 * {@link #getShaahZmanis90MinutesZmanis()} * after {@link #getAlos90Zmanis() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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. @@ -1417,42 +1222,42 @@ public Date getSofZmanShmaMGA90Minutes() { * @see #getAlos90Zmanis() * @see #isUseAstronomicalChatzosForOtherZmanim() */ - public Date getSofZmanShmaMGA90MinutesZmanis() { + public Instant getSofZmanShmaMGA90MinutesZmanis() { return getSofZmanShma(getAlos90Zmanis(), getTzais90Zmanis(), true); } /** - * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the - * opinion of the Magen Avraham (MGA) based - * on alos being {@link #getAlos96() 96} minutes before {@link #getSunrise() sunrise}. This time is 3 - * {@link #getShaahZmanis96Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos96() dawn} based on - * the opinion of the MGA that the day is calculated from a {@link #getAlos96() dawn} of 96 minutes before - * sunrise to {@link #getTzais96() nightfall} of 96 minutes after sunset. This returns the time of 3 * {@link - * #getShaahZmanis96Minutes()} after {@link #getAlos96() dawn}. + * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the opinion of + * the Magen Avraham (MGA) based on alos being {@link + * #getAlos96Minutes() 96} minutes before {@link #getSunset() sunrise}. This time is 3 {@link + * #getShaahZmanis96Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos96Minutes() dawn} based on the opinion + * of the MGA that the day is calculated from a {@link #getAlos96Minutes() dawn} of 96 minutes before sunrise to {@link + * #getTzais96Minutes() nightfall} of 96 minutes after sunset. This returns the time of 3 * {@link #getShaahZmanis96Minutes()} + * after {@link #getAlos96Minutes() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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 #getShaahZmanis96Minutes() - * @see #getAlos96() + * @see #getAlos96Minutes() * @see #isUseAstronomicalChatzosForOtherZmanim() */ - public Date getSofZmanShmaMGA96Minutes() { - return getSofZmanShma(getAlos96(), getTzais96(), true); + public Instant getSofZmanShmaMGA96Minutes() { + return getSofZmanShma(getAlos96Minutes(), getTzais96Minutes(), true); } /** * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the * opinion of the Magen Avraham (MGA) based - * on alos being {@link #getAlos90Zmanis() 96} minutes zmaniyos before {@link #getSunrise() + * on alos being {@link #getAlos90Zmanis() 96} minutes zmaniyos before {@link #getSunset() * sunrise}. This time is 3 {@link #getShaahZmanis96MinutesZmanis() shaos zmaniyos} (solar hours) after * {@link #getAlos96Zmanis() dawn} based on the opinion of the MGA that the day is calculated from a {@link * #getAlos96Zmanis() dawn} of 96 minutes zmaniyos before sunrise to {@link #getTzais90Zmanis() nightfall} * of 96 minutes zmaniyos after sunset. This returns the time of 3 * {@link #getShaahZmanis96MinutesZmanis()} * after {@link #getAlos96Zmanis() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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. @@ -1460,13 +1265,13 @@ public Date getSofZmanShmaMGA96Minutes() { * @see #getAlos96Zmanis() * @see #isUseAstronomicalChatzosForOtherZmanim() */ - public Date getSofZmanShmaMGA96MinutesZmanis() { + public Instant getSofZmanShmaMGA96MinutesZmanis() { return getSofZmanShma(getAlos96Zmanis(), getTzais96Zmanis(), true); } /** * This method returns the latest zman krias shema (time to recite Shema in the morning) calculated - * as 3 hours (regular clock hours and not shaos zmaniyos) before {@link ZmanimCalendar#getChatzos()}. + * as 3 hours (regular clock hours and not shaos zmaniyos) before {@link #getChatzosHayom()}. * Generally known as part of the "Komarno" zmanim after Rav Yitzchak Eizik of * Komarno, a proponent of this calculation, it actually predates him a lot. It is the opinion of the @@ -1481,44 +1286,44 @@ public Date getSofZmanShmaMGA96MinutesZmanis() { * See Yisrael Vehazmanim vol. 1 7:3, page 55 - * 62. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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 ZmanimCalendar#getChatzos() + * @see #getChatzosHayom() * @see #getSofZmanTfila2HoursBeforeChatzos() * @see #isUseAstronomicalChatzos() */ - public Date getSofZmanShma3HoursBeforeChatzos() { - return getTimeOffset(getChatzos(), -180 * MINUTE_MILLIS); + public Instant getSofZmanShma3HoursBeforeChatzos() { + return getTimeOffset(getChatzosHayom(), -180 * MINUTE_MILLIS); } /** * This method returns the latest zman krias shema (time to recite Shema in the morning) according to the * opinion of the Magen Avraham (MGA) based - * on alos being {@link #getAlos120() 120} minutes or 1/6th of the day before {@link #getSunrise() sunrise}. - * This time is 3 {@link #getShaahZmanis120Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos120() - * dawn} based on the opinion of the MGA that the day is calculated from a {@link #getAlos120() dawn} of 120 minutes - * before sunrise to {@link #getTzais120() nightfall} of 120 minutes after sunset. This returns the time of 3 - * {@link #getShaahZmanis120Minutes()} after {@link #getAlos120() dawn}. This is an extremely early zman that + * on alos being {@link #getAlos120Minutes() 120} minutes or 1/6th of the day before {@link #getSunset() + * sunrise}. This time is 3 {@link #getShaahZmanis120Minutes() shaos zmaniyos} (solar hours) after {@link + * #getAlos120Minutes() dawn} based on the opinion of the MGA that the day is calculated from a {@link #getAlos120Minutes() dawn} + * of 120 minutes before sunrise to {@link #getTzais120Minutes() nightfall} of 120 minutes after sunset. This returns the time of + * 3 {@link #getShaahZmanis120Minutes()} after {@link #getAlos120Minutes() dawn}. This is an extremely early zman that * is very much a chumra. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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 #getShaahZmanis120Minutes() - * @see #getAlos120() + * @see #getAlos120Minutes() * @see #isUseAstronomicalChatzosForOtherZmanim() */ - public Date getSofZmanShmaMGA120Minutes() { - return getSofZmanShma(getAlos120(), getTzais120(), true); + public Instant getSofZmanShmaMGA120Minutes() { + return getSofZmanShma(getAlos120Minutes(), getTzais120Minutes(), true); } /** - * This method returns the latest zman krias shema (time to recite Shema in the morning) based - * on the opinion that the day starts at {@link #getAlos16Point1Degrees() alos 16.1°} and ends at - * {@link #getSeaLevelSunset() sea level sunset}. This is the opinion of the zman krias shema (time to recite Shema in the morning) based on the + * opinion that the day starts at {@link #getAlos16Point1Degrees() alos 16.1°} and ends at {@link + * #getSeaLevelSunset() sea level sunset}. This is the opinion of the \u05D7\u05D9\u05D3\u05D5\u05E9\u05D9 * \u05D5\u05DB\u05DC\u05DC\u05D5\u05EA \u05D4\u05E8\u05D6\u05F4\u05D4 and the \u05DE\u05E0\u05D5\u05E8\u05D4 \u05D4\u05D8\u05D4\u05D5\u05E8\u05D4 as @@ -1530,15 +1335,15 @@ public Date getSofZmanShmaMGA120Minutes() { * Note: Based on this calculation chatzos will not be at midday and {@link * #isUseAstronomicalChatzosForOtherZmanim()} will be ignored. * - * @return the Date of the latest zman krias shema based on this day. If the calculation can't + * @return the Instant of the latest zman krias shema based on this day. If the calculation can't * be computed such as northern and southern locations even south of the Arctic Circle and north of the * Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a null * will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. * @see #getAlos16Point1Degrees() * @see #getSeaLevelSunset() */ - public Date getSofZmanShmaAlos16Point1ToSunset() { - return getSofZmanShma(getAlos16Point1Degrees(), getElevationAdjustedSunset(), false); + public Instant getSofZmanShmaAlos16Point1ToSunset() { + return getSofZmanShma(getAlos16Point1Degrees(), getSunsetBasedOnElevationSetting(), false); } /** @@ -1552,7 +1357,7 @@ public Date getSofZmanShmaAlos16Point1ToSunset() { * Note: Based on this calculation chatzos will not be at midday and {@link * #isUseAstronomicalChatzosForOtherZmanim()} will be ignored. * - * @return the Date of the latest zman krias shema based on this calculation. If the + * @return the Instant of the latest zman krias shema based on this calculation. If the * calculation can't be computed such as northern and southern locations even south of the Arctic Circle and * north of the Antarctic Circle where the sun may not reach low enough below the horizon for this * calculation, a null will be returned. See detailed explanation on top of the @@ -1560,20 +1365,20 @@ public Date getSofZmanShmaAlos16Point1ToSunset() { * @see #getAlos16Point1Degrees() * @see #getTzaisGeonim7Point083Degrees() */ - public Date getSofZmanShmaAlos16Point1ToTzaisGeonim7Point083Degrees() { + public Instant getSofZmanShmaAlos16Point1ToTzaisGeonim7Point083Degrees() { return getSofZmanShma(getAlos16Point1Degrees(), getTzaisGeonim7Point083Degrees(), false); } /** * This method returns the latest zman tfila (time to recite the morning prayers) according to the opinion * of the Magen Avraham (MGA) based on - * alos being {@link #getAlos19Point8Degrees() 19.8°} before {@link #getSunrise() sunrise}. This time + * alos being {@link #getAlos19Point8Degrees() 19.8°} before {@link #getSunset() sunrise}. This time * is 4 {@link #getShaahZmanis19Point8Degrees() shaos zmaniyos} (solar hours) after {@link * #getAlos19Point8Degrees() dawn} based on the opinion of the MGA that the day is calculated from dawn to * nightfall with both being 19.8° below sunrise or sunset. This returns the time of 4 * {@link * #getShaahZmanis19Point8Degrees()} after {@link #getAlos19Point8Degrees() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. @@ -1582,20 +1387,20 @@ public Date getSofZmanShmaAlos16Point1ToTzaisGeonim7Point083Degrees() { * @see #getAlos19Point8Degrees() * @see #isUseAstronomicalChatzosForOtherZmanim() */ - public Date getSofZmanTfilaMGA19Point8Degrees() { + public Instant getSofZmanTfilaMGA19Point8Degrees() { return getSofZmanTfila(getAlos19Point8Degrees(), getTzais19Point8Degrees(), true); } /** * This method returns the latest zman tfila (time to recite the morning prayers) according to the opinion * of the Magen Avraham (MGA) based on - * alos being {@link #getAlos16Point1Degrees() 16.1°} before {@link #getSunrise() sunrise}. This time + * alos being {@link #getAlos16Point1Degrees() 16.1°} before {@link #getSunset() sunrise}. This time * is 4 {@link #getShaahZmanis16Point1Degrees() shaos zmaniyos} (solar hours) after {@link * #getAlos16Point1Degrees() dawn} based on the opinion of the MGA that the day is calculated from dawn to * nightfall with both being 16.1° below sunrise or sunset. This returns the time of 4 * {@link * #getShaahZmanis16Point1Degrees()} after {@link #getAlos16Point1Degrees() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. @@ -1603,20 +1408,20 @@ public Date getSofZmanTfilaMGA19Point8Degrees() { * @see #getShaahZmanis16Point1Degrees() * @see #getAlos16Point1Degrees() */ - public Date getSofZmanTfilaMGA16Point1Degrees() { + public Instant getSofZmanTfilaMGA16Point1Degrees() { return getSofZmanTfila(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true); } /** * This method returns the latest zman tfila (time to recite the morning prayers) according to the opinion * of the Magen Avraham (MGA) based on - * alos being {@link #getAlos18Degrees() 18°} before {@link #getSunrise() sunrise}. This time is 4 + * alos being {@link #getAlos18Degrees() 18°} before {@link #getSunset() sunrise}. This time is 4 * {@link #getShaahZmanis18Degrees() shaos zmaniyos} (solar hours) after {@link #getAlos18Degrees() dawn} * based on the opinion of the MGA that the day is calculated from dawn to nightfall with both being 18° * below sunrise or sunset. This returns the time of 4 * {@link #getShaahZmanis18Degrees()} after * {@link #getAlos18Degrees() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. @@ -1624,248 +1429,229 @@ public Date getSofZmanTfilaMGA16Point1Degrees() { * @see #getShaahZmanis18Degrees() * @see #getAlos18Degrees() */ - public Date getSofZmanTfilaMGA18Degrees() { + public Instant getSofZmanTfilaMGA18Degrees() { return getSofZmanTfila(getAlos18Degrees(), getTzais18Degrees(), true); } - /** - * This method returns the latest zman tfila (time to recite the morning prayers) according to the opinion - * of the Magen Avraham (MGA) based on - * alos being {@link #getAlos72() 72} minutes before {@link #getSunrise() sunrise}. This time is 4 - * {@link #getShaahZmanis72Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos72() dawn} based on - * the opinion of the MGA that the day is calculated from a {@link #getAlos72() dawn} of 72 minutes before - * sunrise to {@link #getTzais72() nightfall} of 72 minutes after sunset. This returns the time of 4 * - * {@link #getShaahZmanis72Minutes()} after {@link #getAlos72() dawn}. This class returns an identical time to - * {@link #getSofZmanTfilaMGA()} and is repeated here for clarity. - * - * @return the Date of the latest zman tfila. 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 #getShaahZmanis72Minutes() - * @see #getAlos72() - * @see #getSofZmanShmaMGA() - */ - public Date getSofZmanTfilaMGA72Minutes() { - return getSofZmanTfilaMGA(); - } - /** * This method returns the latest zman tfila (time to the morning prayers) according to the opinion of the * Magen Avraham (MGA) based on alos - * being {@link #getAlos72Zmanis() 72} minutes zmaniyos before {@link #getSunrise() sunrise}. This time is 4 + * being {@link #getAlos72Zmanis() 72} minutes zmaniyos before {@link #getSunset() sunrise}. This time is 4 * {@link #getShaahZmanis72MinutesZmanis() shaos zmaniyos} (solar hours) after {@link #getAlos72Zmanis() dawn} * based on the opinion of the MGA that the day is calculated from a {@link #getAlos72Zmanis() dawn} of 72 * minutes zmaniyos before sunrise to {@link #getTzais72Zmanis() nightfall} of 72 minutes zmaniyos * after sunset. This returns the time of 4 * {@link #getShaahZmanis72MinutesZmanis()} after {@link #getAlos72Zmanis() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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 #getShaahZmanis72MinutesZmanis() * @see #getAlos72Zmanis() */ - public Date getSofZmanTfilaMGA72MinutesZmanis() { + public Instant getSofZmanTfilaMGA72MinutesZmanis() { return getSofZmanTfila(getAlos72Zmanis(), getTzais72Zmanis(), true); } /** * This method returns the latest zman tfila (time to recite the morning prayers) according to the opinion * of the Magen Avraham (MGA) based on - * alos being {@link #getAlos90() 90} minutes before {@link #getSunrise() sunrise}. This time is 4 - * {@link #getShaahZmanis90Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos90() dawn} based on - * the opinion of the MGA that the day is calculated from a {@link #getAlos90() dawn} of 90 minutes before sunrise to - * {@link #getTzais90() nightfall} of 90 minutes after sunset. This returns the time of 4 * - * {@link #getShaahZmanis90Minutes()} after {@link #getAlos90() dawn}. + * alos being {@link #getAlos90Minutes() 90} minutes before {@link #getSunset() sunrise}. This time is 4 + * {@link #getShaahZmanis90Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos90Minutes() dawn} based on + * the opinion of the MGA that the day is calculated from a {@link #getAlos90Minutes() dawn} of 90 minutes before sunrise to + * {@link #getTzais90Minutes() nightfall} of 90 minutes after sunset. This returns the time of 4 * + * {@link #getShaahZmanis90Minutes()} after {@link #getAlos90Minutes() dawn}. * - * @return the Date of the latest zman tfila. If the calculation can't be computed such as in + * @return the Instant of the latest zman tfila. 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 #getShaahZmanis90Minutes() - * @see #getAlos90() + * @see #getAlos90Minutes() */ - public Date getSofZmanTfilaMGA90Minutes() { - return getSofZmanTfila(getAlos90(), getTzais90(), true); + public Instant getSofZmanTfilaMGA90Minutes() { + return getSofZmanTfila(getAlos90Minutes(), getTzais90Minutes(), true); } /** * This method returns the latest zman tfila (time to the morning prayers) according to the opinion of the * Magen Avraham (MGA) based on alos - * being {@link #getAlos90Zmanis() 90} minutes zmaniyos before {@link #getSunrise() sunrise}. This time is + * being {@link #getAlos90Zmanis() 90} minutes zmaniyos before {@link #getSunset() sunrise}. This time is * 4 {@link #getShaahZmanis90MinutesZmanis() shaos zmaniyos} (solar hours) after {@link #getAlos90Zmanis() * dawn} based on the opinion of the MGA that the day is calculated from a {@link #getAlos90Zmanis() dawn} * of 90 minutes zmaniyos before sunrise to {@link #getTzais90Zmanis() nightfall} of 90 minutes * zmaniyos after sunset. This returns the time of 4 * {@link #getShaahZmanis90MinutesZmanis()} after * {@link #getAlos90Zmanis() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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 #getShaahZmanis90MinutesZmanis() * @see #getAlos90Zmanis() */ - public Date getSofZmanTfilaMGA90MinutesZmanis() { + public Instant getSofZmanTfilaMGA90MinutesZmanis() { return getSofZmanTfila(getAlos90Zmanis(), getTzais90Zmanis(), true); } /** * This method returns the latest zman tfila (time to recite the morning prayers) according to the opinion * of the Magen Avraham (MGA) based on - * alos being {@link #getAlos96() 96} minutes before {@link #getSunrise() sunrise}. This time is 4 - * {@link #getShaahZmanis96Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos96() dawn} based on - * the opinion of the MGA that the day is calculated from a {@link #getAlos96() dawn} of 96 minutes before - * sunrise to {@link #getTzais96() nightfall} of 96 minutes after sunset. This returns the time of 4 * - * {@link #getShaahZmanis96Minutes()} after {@link #getAlos96() dawn}. + * alos being {@link #getAlos96Minutes() 96} minutes before {@link #getSunset() sunrise}. This time is 4 + * {@link #getShaahZmanis96Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos96Minutes() dawn} based on + * the opinion of the MGA that the day is calculated from a {@link #getAlos96Minutes() dawn} of 96 minutes before + * sunrise to {@link #getTzais96Minutes() nightfall} of 96 minutes after sunset. This returns the time of 4 * + * {@link #getShaahZmanis96Minutes()} after {@link #getAlos96Minutes() dawn}. * - * @return the Date of the latest zman tfila. If the calculation can't be computed such as in + * @return the Instant of the latest zman tfila. 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 #getShaahZmanis96Minutes() - * @see #getAlos96() + * @see #getAlos96Minutes() */ - public Date getSofZmanTfilaMGA96Minutes() { - return getSofZmanTfila(getAlos96(), getTzais96(), true); + public Instant getSofZmanTfilaMGA96Minutes() { + return getSofZmanTfila(getAlos96Minutes(), getTzais96Minutes(), true); } /** * This method returns the latest zman tfila (time to the morning prayers) according to the opinion of the * Magen Avraham (MGA) based on alos - * being {@link #getAlos96Zmanis() 96} minutes zmaniyos before {@link #getSunrise() sunrise}. This time is + * being {@link #getAlos96Zmanis() 96} minutes zmaniyos before {@link #getSunset() sunrise}. This time is * 4 {@link #getShaahZmanis96MinutesZmanis() shaos zmaniyos} (solar hours) after {@link #getAlos96Zmanis() * dawn} based on the opinion of the MGA that the day is calculated from a {@link #getAlos96Zmanis() dawn} * of 96 minutes zmaniyos before sunrise to {@link #getTzais96Zmanis() nightfall} of 96 minutes * zmaniyos after sunset. This returns the time of 4 * {@link #getShaahZmanis96MinutesZmanis()} after * {@link #getAlos96Zmanis() dawn}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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 #getShaahZmanis90MinutesZmanis() * @see #getAlos90Zmanis() */ - public Date getSofZmanTfilaMGA96MinutesZmanis() { + public Instant getSofZmanTfilaMGA96MinutesZmanis() { return getSofZmanTfila(getAlos96Zmanis(), getTzais96Zmanis(), true); } /** * This method returns the latest zman tfila (time to recite the morning prayers) according to the opinion * of the Magen Avraham (MGA) based on - * alos being {@link #getAlos120() 120} minutes before {@link #getSunrise() sunrise} . This time is 4 - * {@link #getShaahZmanis120Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos120() dawn} - * based on the opinion of the MGA that the day is calculated from a {@link #getAlos120() dawn} of 120 - * minutes before sunrise to {@link #getTzais120() nightfall} of 120 minutes after sunset. This returns the time of - * 4 * {@link #getShaahZmanis120Minutes()} after {@link #getAlos120() dawn}. This is an extremely early zman + * alos being {@link #getAlos120Minutes() 120} minutes before {@link #getSunset() sunrise} . This time is 4 + * {@link #getShaahZmanis120Minutes() shaos zmaniyos} (solar hours) after {@link #getAlos120Minutes() dawn} + * based on the opinion of the MGA that the day is calculated from a {@link #getAlos120Minutes() dawn} of 120 + * minutes before sunrise to {@link #getTzais120Minutes() nightfall} of 120 minutes after sunset. This returns the time of + * 4 * {@link #getShaahZmanis120Minutes()} after {@link #getAlos120Minutes() dawn}. This is an extremely early zman * that is very much a chumra. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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 #getShaahZmanis120Minutes() - * @see #getAlos120() + * @see #getAlos120Minutes() */ - public Date getSofZmanTfilaMGA120Minutes() { - return getSofZmanTfila(getAlos120(), getTzais120(), true); + public Instant getSofZmanTfilaMGA120Minutes() { + return getSofZmanTfila(getAlos120Minutes(), getTzais120Minutes(), true); } /** * This method returns the latest zman tfila (time to recite the morning prayers) calculated as 2 hours - * before {@link ZmanimCalendar#getChatzos()}. This is based on the opinions that calculate + * before {@link #getChatzosHayom()}. This is based on the opinions that calculate * sof zman krias shema as {@link #getSofZmanShma3HoursBeforeChatzos()}. This returns the time of 2 hours - * before {@link ZmanimCalendar#getChatzos()}. + * before {@link #getChatzosHayom()}. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. 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 ZmanimCalendar#getChatzos() + * @see #getChatzosHayom() * @see #getSofZmanShma3HoursBeforeChatzos() */ - public Date getSofZmanTfila2HoursBeforeChatzos() { - return getTimeOffset(getChatzos(), -120 * MINUTE_MILLIS); + public Instant getSofZmanTfila2HoursBeforeChatzos() { + return getTimeOffset(getChatzosHayom(), -120 * MINUTE_MILLIS); } /** - * This method returns mincha gedola calculated as 30 minutes after {@link #getChatzos() chatzos} - * and not 1/2 of a {@link #getShaahZmanisGra() shaah zmanis} after {@link #getChatzos() chatzos} as + * This method returns mincha gedola calculated as 30 minutes after {@link #getChatzosHayom() chatzos} + * and not 1/2 of a {@link #getShaahZmanisGRA() shaah zmanis} after {@link #getChatzosHayom() chatzos} as * calculated by {@link #getMinchaGedola}. Some use this time to delay the start of mincha in the winter when - * 1/2 of a {@link #getShaahZmanisGra() shaah zmanis} is less than 30 minutes. See - * {@link #getMinchaGedolaGreaterThan30()} for a convenience method that returns the later of the 2 calculations. One - * should not use this time to start mincha before the standard {@link #getMinchaGedola() mincha gedola}. + * 1/2 of a {@link #getShaahZmanisGRA() shaah zmanis} is less than 30 minutes. See + * {@link #getMinchaGedolaGreaterThan30(Instant)} for a convenience method that returns the later of the 2 calculations. One + * should not use this time to start mincha before the standard {@link #getMinchaGedolaGRA() mincha gedola}. * See Shulchan Aruch Orach Chayim 234:1 and * the Shaar Hatziyon seif katan ches. Since this calculation is a fixed 30 minutes of regular clock time after * chatzos, even if {@link #isUseAstronomicalChatzosForOtherZmanim()} is false, this mincha * gedola time will be affected by {@link #isUseAstronomicalChatzos()} and not by * {@link #isUseAstronomicalChatzosForOtherZmanim()}. * - * @return the Date of 30 minutes after chatzos. If the calculation can't be computed such as + * @return the Instant of 30 minutes after chatzos. 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() - * @see #getMinchaGedolaGreaterThan30() - * @see #getChatzos() + * @todo Consider adjusting this to calculate the time as half an hour after {@link #getChatzosHayom()} that uses + * {@link #isUseAstronomicalChatzos()} to determine the type of chatzos to utilize. that support it, + * based on {@link #isUseAstronomicalChatzos()}. + * @see #getMinchaGedolaGRA() + * @see #getMinchaGedolaGreaterThan30(Instant) + * @see #getChatzosHayom() * @see #isUseAstronomicalChatzos() * @see #isUseAstronomicalChatzosForOtherZmanim() */ - public Date getMinchaGedola30Minutes() { - return getTimeOffset(getChatzos(), MINUTE_MILLIS * 30); + public Instant getMinchaGedola30Minutes() { + return getTimeOffset(getChatzosHayom(), MINUTE_MILLIS * 30); } /** * This method returns the time of mincha gedola according to the Magen Avraham with the day starting 72 * minutes before sunrise and ending 72 minutes after sunset. This is the earliest time to pray mincha. For - * more information on this see the documentation on {@link #getMinchaGedola() mincha gedola}. This is + * more information on this see the documentation on {@link #getMinchaGedolaGRA() mincha gedola}. This is * calculated as 6.5 {@link #getTemporalHour() solar hours} after alos. The calculation used is 6.5 * - * {@link #getShaahZmanis72Minutes()} after {@link #getAlos72() alos}. If {@link + * {@link #getShaahZmanis72Minutes()} after {@link #getAlos72Minutes() alos}. If {@link * #isUseAstronomicalChatzosForOtherZmanim()} is set to true, the calculation will be based on 0.5 - * {@link #getHalfDayBasedShaahZmanis(Date, Date) half-day based sha'ah zmanis} between {@link #getChatzos()} - * and {@link #getTzais72()} after {@link #getChatzos()}. - * - * @see #getAlos72() - * @see #getMinchaGedola() - * @see #getMinchaKetana() - * @see ZmanimCalendar#getMinchaGedola() - * @see #getChatzos() + * {@link #getHalfDayBasedShaahZmanis(Instant, Instant) half-day based sha'ah zmanis} between + * {@link #getChatzosHayom()} and {@link #getTzais72Minutes()} after {@link #getChatzosHayom()}. + * + * @see #getAlos72Minutes() + * @see #getMinchaGedolaGRA() + * @see #getMinchaKetanaGRA() + * @see #getMinchaGedolaGRA() + * @see #getChatzosHayom() * @see #isUseAstronomicalChatzosForOtherZmanim() - * @return the Date of the time of mincha gedola. If the calculation can't be computed such as + * @return the Instant of the time of mincha gedola. 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 getMinchaGedola72Minutes() { + public Instant getMinchaGedola72Minutes() { if (isUseAstronomicalChatzosForOtherZmanim()) { - return getHalfDayBasedZman(getChatzos(), getTzais72(), 0.5); + return getHalfDayBasedZman(getChatzosHayom(), getTzais72Minutes(), 0.5); } else { - return getMinchaGedola(getAlos72(), getTzais72(), true); + return getMinchaGedola(getAlos72Minutes(), getTzais72Minutes(), true); } } /** * This method returns the time of mincha gedola according to the Magen Avraham with the day starting and * ending 16.1° below the horizon. This is the earliest time to pray mincha. For more information on - * this see the documentation on {@link #getMinchaGedola() mincha gedola}. This is calculated as 6.5 + * this see the documentation on {@link #getMinchaGedolaGRA() mincha gedola}. This is calculated as 6.5 * {@link #getTemporalHour() solar hours} after alos. The calculation used is 6.5 * * {@link #getShaahZmanis16Point1Degrees()} after {@link #getAlos16Point1Degrees() alos}. If {@link * #isUseAstronomicalChatzosForOtherZmanim()} is set to true, the calculation will be based on 0.5 - * {@link #getHalfDayBasedShaahZmanis(Date, Date) half-day based sha'ah zmanis} between {@link #getChatzos()} - * and {@link #getAlos16Point1Degrees()} after {@link #getChatzos()}. + * {@link #getHalfDayBasedShaahZmanis(Instant, Instant) half-day based sha'ah zmanis} between {@link #getChatzosHayom()} + * and {@link #getAlos16Point1Degrees()} after {@link #getChatzosHayom()}. * @see #getShaahZmanis16Point1Degrees() - * @see #getMinchaGedola() - * @see #getMinchaKetana() - * @return the Date of the time of mincha gedola. If the calculation can't be computed such as + * @see #getMinchaGedolaGRA() + * @see #getMinchaKetanaGRA() + * @return the Instant of the time of mincha gedola. If the calculation can't be computed such as * northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle where * the sun may not reach low enough below the horizon for this calculation, a null will be returned. * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. */ - public Date getMinchaGedola16Point1Degrees() { + public Instant getMinchaGedola16Point1Degrees() { if (isUseAstronomicalChatzosForOtherZmanim()) { - return getHalfDayBasedZman(getChatzos(), getTzais16Point1Degrees(), 0.5); + return getHalfDayBasedZman(getChatzosHayom(), getTzais16Point1Degrees(), 0.5); } else { return getMinchaGedola(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true); } @@ -1879,12 +1665,12 @@ public Date getMinchaGedola16Point1Degrees() { * zmanis after chatzos with shaos zmaniyos calculated based on a day starting 72 minutes before sunrise * {@link #getAlos16Point1Degrees() alos 16.1°} and ending 13.5 minutes after sunset {@link * #getTzaisGeonim3Point7Degrees() tzais 3.7°}. Mincha gedola is the earliest time to pray mincha. - * The later of this time or 30 clock minutes after chatzos is returned. See {@link #getMinchaGedolaGreaterThan30()} - * (though that calculation is based on mincha gedola GRA). - * For more information about mincha gedola see the documentation on {@link #getMinchaGedola() mincha gedola}. + * The later of this time or 30 clock minutes after chatzos is returned. See {@link + * #getMinchaGedolaGreaterThan30(Instant)} for a way to claculate the later of 30 minutes or this mincha gedola. + * For more information about mincha gedola see the documentation on {@link #getMinchaGedolaGRA() mincha gedola}. * Since calculation of this zman involves chatzos that is offset from the center of the astronomical day, * {@link #isUseAstronomicalChatzosForOtherZmanim()} is N/A here. - * @return the Date of the mincha gedola. If the calculation can't be computed such as northern and + * @return the Instant of the mincha gedola. If the calculation can't be computed such as northern and * southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may not * reach low enough below the horizon for this calculation, a null will be returned. See detailed * explanation on top of the {@link AstronomicalCalendar} documentation. @@ -1892,61 +1678,87 @@ public Date getMinchaGedola16Point1Degrees() { * @see #getAlos16Point1Degrees() * @see #getTzaisGeonim3Point7Degrees() * @see #getShaahZmanisAlos16Point1ToTzais3Point7() - * @see #getMinchaGedolaGreaterThan30() + * @see #getMinchaGedolaGreaterThan30(Instant) */ - public Date getMinchaGedolaAhavatShalom() { - if (getChatzos() == null || getMinchaGedola30Minutes() == null || getShaahZmanisAlos16Point1ToTzais3Point7() == Long.MIN_VALUE) { + public Instant getMinchaGedolaAhavatShalom() { + if (getChatzosHayom() == null || getMinchaGedola30Minutes() == null || getShaahZmanisAlos16Point1ToTzais3Point7() == Long.MIN_VALUE) { return null; } else { - return getMinchaGedola30Minutes().compareTo(getTimeOffset(getChatzos(), getShaahZmanisAlos16Point1ToTzais3Point7() / 2)) > 0 ? - getMinchaGedola30Minutes() : getTimeOffset(getChatzos(), getShaahZmanisAlos16Point1ToTzais3Point7() / 2); + return getMinchaGedola30Minutes().compareTo(getTimeOffset(getChatzosHayom(), getShaahZmanisAlos16Point1ToTzais3Point7() / 2)) > 0 ? + getMinchaGedola30Minutes() : getTimeOffset(getChatzosHayom(), getShaahZmanisAlos16Point1ToTzais3Point7() / 2); } } /** - * FIXME check for synchronous - * This is a convenience method that returns the later of {@link #getMinchaGedola()} and - * {@link #getMinchaGedola30Minutes()}. In the winter when 1/2 of a {@link #getShaahZmanisGra() shaah zmanis} is - * less than 30 minutes {@link #getMinchaGedola30Minutes()} will be returned, otherwise {@link #getMinchaGedola()} - * will be returned. Since this calculation can be an offset of chatzos (if 30 clock minutes > 1/2 of a shaah - * zmanis), even if {@link #isUseAstronomicalChatzosForOtherZmanim()} is false, this mincha time - * may be affected by {@link #isUseAstronomicalChatzos()}. + * This is a convenience method that returns the later of the minchaGedola passed in and {@link + * #getMinchaGedola30Minutes()}. In the winter when 1/2 of a {@link #getShaahZmanisGRA() shaah zmanis} is less + * than 30 minutes {@link #getMinchaGedola30Minutes()} will be returned, otherwise the minchaGedola passed in will be + * returned. Since this calculation can be an offset of chatzos (if 30 clock minutes > 1/2 of a shaah + * zmanis), even if {@link #isUseAstronomicalChatzosForOtherZmanim()} is false, this mincha + * time may be affected by {@link #isUseAstronomicalChatzos()}. * - * @return the Date of the later of {@link #getMinchaGedola()} and {@link #getMinchaGedola30Minutes()}. + * @param minchaGedola + * the mincha gedola to be compared to {@link #getMinchaGedola30Minutes()}. + * @return the Instant of the later of {@link #getMinchaGedolaGRA()} and {@link #getMinchaGedola30Minutes()}. * 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() + * @see #getMinchaGedolaGRA() * @see #getMinchaGedola30Minutes() * @see #isUseAstronomicalChatzos() * */ - public Date getMinchaGedolaGreaterThan30() { - if (getMinchaGedola30Minutes() == null || getMinchaGedola() == null) { + public Instant getMinchaGedolaGreaterThan30(Instant minchaGedola) { + if (getMinchaGedola30Minutes() == null || minchaGedola == null) { return null; } else { - return getMinchaGedola30Minutes().compareTo(getMinchaGedola()) > 0 ? getMinchaGedola30Minutes() - : getMinchaGedola(); + return getMinchaGedola30Minutes().compareTo(minchaGedola) > 0 ? getMinchaGedola30Minutes() + : minchaGedola; } } + + /** + * This is a convenience method that returns the later of {@link #getMinchaGedolaGRA()} and + * {@link #getMinchaGedola30Minutes()}. In the winter when 1/2 of a {@link #getShaahZmanisGRA() shaah zmanis} is + * less than 30 minutes {@link #getMinchaGedola30Minutes()} will be returned, otherwise {@link #getMinchaGedolaGRA()} + * will be returned. Since this calculation can be an offset of chatzos (if 30 clock minutes > 1/2 of a shaah + * zmanis), even if {@link #isUseAstronomicalChatzosForOtherZmanim()} is false, this mincha time + * may be affected by {@link #isUseAstronomicalChatzos()}. + * + * @return the Date of the later of {@link #getMinchaGedolaGRA()} and {@link #getMinchaGedola30Minutes()}. + * 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. + * @todo Consider adjusting this to calculate the time as 30 minutes after {@link #getChatzosHayom()} that uses {@link + * isUseAstronomicalChatzos()} to determine the type of chatzos to utilize (if the {@link + * com.kosherjava.zmanim.util.AstronomicalCalculator calculator} support astronomical chatzos), + * based on the {@link #isUseAstronomicalChatzos()} setting. + * @see #getMinchaGedolaGRA() + * @see #getMinchaGedola30Minutes() + * @see #getMinchaGedolaGreaterThan30(Instant) + * @see #isUseAstronomicalChatzos() + */ + public Instant getMinchaGedolaGRAGreaterThan30() { + return getMinchaGedolaGreaterThan30(getMinchaGedolaGRA()); + } /** * This method returns the time of mincha ketana according to the Magen Avraham with the day starting and * ending 16.1° below the horizon. This is the preferred earliest time to pray mincha according to the * opinion of the Rambam and others. For more information on - * this see the documentation on {@link #getMinchaGedola() mincha gedola}. This is calculated as 9.5 + * this see the documentation on {@link #getMinchaGedolaGRA() mincha gedola}. This is calculated as 9.5 * {@link #getTemporalHour() solar hours} after alos. The calculation used is 9.5 * * {@link #getShaahZmanis16Point1Degrees()} after {@link #getAlos16Point1Degrees() alos}. * * @see #getShaahZmanis16Point1Degrees() - * @see #getMinchaGedola() - * @see #getMinchaKetana() - * @return the Date of the time of mincha ketana. If the calculation can't be computed such + * @see #getMinchaGedolaGRA() + * @see #getMinchaKetanaGRA() + * @return the Instant of the time of mincha ketana. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. */ - public Date getMinchaKetana16Point1Degrees() { + public Instant getMinchaKetana16Point1Degrees() { return getMinchaKetana(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true); } @@ -1958,9 +1770,9 @@ public Date getMinchaKetana16Point1Degrees() { * calculated based on a day starting at {@link #getAlos16Point1Degrees() alos 16.1°} and ending at * tzais 3.8°. Mincha ketana is the preferred earliest time to pray mincha according to * the opinion of the Rambam and others. For more information - * on this see the documentation on {@link #getMinchaKetana() mincha ketana}. + * on this see the documentation on {@link #getMinchaKetanaGRA() mincha ketana}. * - * @return the Date of the time of mincha ketana. If the calculation can't be computed such as + * @return the Instant of the time of mincha ketana. If the calculation can't be computed such as * northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle where the * sun may not reach low enough below the horizon for this calculation, a null will be returned. * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. @@ -1969,7 +1781,7 @@ public Date getMinchaKetana16Point1Degrees() { * @see #getMinchaGedolaAhavatShalom() * @see #getPlagAhavatShalom() */ - public Date getMinchaKetanaAhavatShalom() { + public Instant getMinchaKetanaAhavatShalom() { return getTimeOffset(getTzaisGeonim3Point8Degrees(), -getShaahZmanisAlos16Point1ToTzais3Point8() * 2.5); } @@ -1977,45 +1789,45 @@ public Date getMinchaKetanaAhavatShalom() { * This method returns the time of mincha ketana according to the Magen Avraham with the day * starting 72 minutes before sunrise and ending 72 minutes after sunset. This is the preferred earliest time to pray * mincha according to the opinion of the Rambam - * and others. For more information on this see the documentation on {@link #getMinchaGedola() mincha gedola}. + * and others. For more information on this see the documentation on {@link #getMinchaGedolaGRA() mincha gedola}. * This is calculated as 9.5 {@link #getShaahZmanis72Minutes()} after alos. The calculation used is 9.5 * - * {@link #getShaahZmanis72Minutes()} after {@link #getAlos72() alos}. + * {@link #getShaahZmanis72Minutes()} after {@link #getAlos72Minutes() alos}. * * @see #getShaahZmanis16Point1Degrees() - * @see #getMinchaGedola() - * @see #getMinchaKetana() - * @return the Date of the time of mincha ketana. If the calculation can't be computed such as + * @see #getMinchaGedolaGRA() + * @see #getMinchaKetanaGRA() + * @return the Instant of the time of mincha ketana. 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 getMinchaKetana72Minutes() { - return getMinchaKetana(getAlos72(), getTzais72(), true); + public Instant getMinchaKetana72Minutes() { + return getMinchaKetana(getAlos72Minutes(), getTzais72Minutes(), true); } /** * This method returns the time of plag hamincha according to the Magen Avraham with the day starting 60 * minutes before sunrise and ending 60 minutes after sunset. This is calculated as 10.75 hours after - * {@link #getAlos60() dawn}. The formula used is 10.75 {@link #getShaahZmanis60Minutes()} after {@link #getAlos60()}. + * {@link #getAlos60Minutes() dawn}. The formula used is 10.75 {@link #getShaahZmanis60Minutes()} after {@link #getAlos60Minutes()}. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. 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 #getShaahZmanis60Minutes() - * @see #getAlos60() - * @see #getTzais60() + * @see #getAlos60Minutes() + * @see #getTzais60Minutes() */ - public Date getPlagHamincha60Minutes() { - return getPlagHamincha(getAlos60(), getTzais60(), true); + public Instant getPlagHamincha60Minutes() { + return getPlagHamincha(getAlos60Minutes(), getTzais60Minutes(), true); } /** * This method should be used lechumra only and returns the time of plag hamincha according to the * Magen Avraham with the day starting 72 minutes before sunrise and ending 72 minutes after sunset. This is calculated - * as 10.75 hours after {@link #getAlos72() dawn}. The formula used is 10.75 {@link #getShaahZmanis72Minutes()} after - * {@link #getAlos72()}. Since plag by this calculation can occur after sunset, it should only be used + * as 10.75 hours after {@link #getAlos72Minutes() dawn}. The formula used is 10.75 {@link #getShaahZmanis72Minutes()} after + * {@link #getAlos72Minutes()}. Since plag by this calculation can occur after sunset, it should only be used * lechumra. * * @deprecated This method should be used lechumra only since it returns a very late time (often after @@ -2023,7 +1835,7 @@ public Date getPlagHamincha60Minutes() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. 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. @@ -2031,15 +1843,15 @@ public Date getPlagHamincha60Minutes() { * @see #getShaahZmanis72Minutes() */ @Deprecated (forRemoval=false) - public Date getPlagHamincha72Minutes() { - return getPlagHamincha(getAlos72(), getTzais72(), true); + public Instant getPlagHamincha72Minutes() { + return getPlagHamincha(getAlos72Minutes(), getTzais72Minutes(), true); } /** * This method should be used lechumra only and returns the time of plag hamincha according to the * Magen Avraham with the day starting 90 minutes before sunrise and ending 90 minutes after sunset. This is calculated - * as 10.75 hours after {@link #getAlos90() dawn}. The formula used is 10.75 {@link #getShaahZmanis90Minutes()} after - * {@link #getAlos90()}. Since plag by this calculation can occur after sunset, it should only be used + * as 10.75 hours after {@link #getAlos90Minutes() dawn}. The formula used is 10.75 {@link #getShaahZmanis90Minutes()} after + * {@link #getAlos90Minutes()}. Since plag by this calculation can occur after sunset, it should only be used * lechumra. * * @deprecated This method should be used lechumra only since it returns a very late time (often after @@ -2047,7 +1859,7 @@ public Date getPlagHamincha72Minutes() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. 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. @@ -2055,15 +1867,15 @@ public Date getPlagHamincha72Minutes() { * @see #getShaahZmanis90Minutes() */ @Deprecated (forRemoval=false) - public Date getPlagHamincha90Minutes() { - return getPlagHamincha(getAlos90(), getTzais90(), true); + public Instant getPlagHamincha90Minutes() { + return getPlagHamincha(getAlos90Minutes(), getTzais90Minutes(), true); } /** * This method should be used lechumra only and returns the time of plag hamincha according to the Magen * Avraham with the day starting 96 minutes before sunrise and ending 96 minutes after sunset. This is calculated as 10.75 - * hours after {@link #getAlos96() dawn}. The formula used is 10.75 {@link #getShaahZmanis96Minutes()} after - * {@link #getAlos96()}. Since plag by this calculation can occur after sunset, it should only be used + * hours after {@link #getAlos96Minutes() dawn}. The formula used is 10.75 {@link #getShaahZmanis96Minutes()} after + * {@link #getAlos96Minutes()}. Since plag by this calculation can occur after sunset, it should only be used * lechumra. * * @deprecated This method should be used lechumra only since it returns a very late time (often after @@ -2071,15 +1883,15 @@ public Date getPlagHamincha90Minutes() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. 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 #getShaahZmanis96Minutes() */ @Deprecated (forRemoval=false) - public Date getPlagHamincha96Minutes() { - return getPlagHamincha(getAlos96(), getTzais96(), true); + public Instant getPlagHamincha96Minutes() { + return getPlagHamincha(getAlos96Minutes(), getTzais96Minutes(), true); } /** @@ -2093,13 +1905,13 @@ public Date getPlagHamincha96Minutes() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. 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. */ @Deprecated (forRemoval=false) - public Date getPlagHamincha96MinutesZmanis() { + public Instant getPlagHamincha96MinutesZmanis() { return getPlagHamincha(getAlos96Zmanis(), getTzais96Zmanis(), true); } @@ -2114,13 +1926,13 @@ public Date getPlagHamincha96MinutesZmanis() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. 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. */ @Deprecated (forRemoval=false) - public Date getPlagHamincha90MinutesZmanis() { + public Instant getPlagHamincha90MinutesZmanis() { return getPlagHamincha(getAlos90Zmanis(), getTzais90Zmanis(), true); } @@ -2135,13 +1947,13 @@ public Date getPlagHamincha90MinutesZmanis() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. 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. */ @Deprecated (forRemoval=false) - public Date getPlagHamincha72MinutesZmanis() { + public Instant getPlagHamincha72MinutesZmanis() { return getPlagHamincha(getAlos72Zmanis(), getTzais72Zmanis(), true); } @@ -2158,7 +1970,7 @@ public Date getPlagHamincha72MinutesZmanis() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. If the calculation can't be computed such as * northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle where * the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. @@ -2166,7 +1978,7 @@ public Date getPlagHamincha72MinutesZmanis() { * @see #getShaahZmanis16Point1Degrees() */ @Deprecated (forRemoval=false) - public Date getPlagHamincha16Point1Degrees() { + public Instant getPlagHamincha16Point1Degrees() { return getPlagHamincha(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true); } @@ -2183,7 +1995,7 @@ public Date getPlagHamincha16Point1Degrees() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. If the calculation can't be computed such as * northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle where * the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. @@ -2191,7 +2003,7 @@ public Date getPlagHamincha16Point1Degrees() { * @see #getShaahZmanis19Point8Degrees() */ @Deprecated (forRemoval=false) - public Date getPlagHamincha19Point8Degrees() { + public Instant getPlagHamincha19Point8Degrees() { return getPlagHamincha(getAlos19Point8Degrees(), getTzais19Point8Degrees(), true); } @@ -2208,7 +2020,7 @@ public Date getPlagHamincha19Point8Degrees() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. If the calculation can't be computed such as * northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle where * the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. @@ -2217,7 +2029,7 @@ public Date getPlagHamincha19Point8Degrees() { * @see #getPlagHamincha120Minutes() */ @Deprecated (forRemoval=false) - public Date getPlagHamincha26Degrees() { + public Instant getPlagHamincha26Degrees() { return getPlagHamincha(getAlos26Degrees(), getTzais26Degrees(), true); } @@ -2234,7 +2046,7 @@ public Date getPlagHamincha26Degrees() { * current plan to remove this method from the API, and this deprecation is intended to alert developers * of the danger of using it. * - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @return the Instant of the time of plag hamincha. If the calculation can't be computed such as * northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle where * the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. @@ -2242,22 +2054,26 @@ public Date getPlagHamincha26Degrees() { * @see #getShaahZmanis18Degrees() */ @Deprecated (forRemoval=false) - public Date getPlagHamincha18Degrees() { + public Instant getPlagHamincha18Degrees() { return getPlagHamincha(getAlos18Degrees(), getTzais18Degrees(), true); } /** - * This method should be used lechumra only and returns the time of plag hamincha based on the opinion - * that the day starts at {@link #getAlos16Point1Degrees() alos 16.1°} and ends at {@link #getSunset() sunset}. - * 10.75 shaos zmaniyos are calculated based on this day and added to {@link #getAlos16Point1Degrees() + * This method should be used lechumra only and returns the time of plag hamincha based on the opinion that + * the day starts at {@link #getAlos16Point1Degrees() alos 16.1°} and ends at {@link #getSunset() + * sunset}. 10.75 shaos zmaniyos are calculated based on this day and added to {@link #getAlos16Point1Degrees() * alos} to reach this time. This time is 10.75 shaos zmaniyos (temporal hours) after {@link * #getAlos16Point1Degrees() dawn} based on the opinion that the day is calculated from a {@link #getAlos16Point1Degrees() * dawn} of 16.1 degrees before sunrise to {@link #getSeaLevelSunset() sea level sunset}. This returns the time of 10.75 * * the calculated shaah zmanis after {@link #getAlos16Point1Degrees() dawn}. Since plag by this * calculation can occur after sunset, it should only be used lechumra. * + * @deprecated This method should be used lechumra only since it returns a very late time (often after + * shkiah), and if used lekula can result in chillul Shabbos etc. There is no + * current plan to remove this method from the API, and this deprecation is intended to alert developers + * of the danger of using it. * - * @return the Date of the plag. If the calculation can't be computed such as northern and southern + * @return the Instant of the plag. If the calculation can't be computed such as northern and southern * locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may not reach * low enough below the horizon for this calculation, a null will be returned. See detailed * explanation on top of the {@link AstronomicalCalendar} documentation. @@ -2266,8 +2082,8 @@ public Date getPlagHamincha18Degrees() { * @see #getSeaLevelSunset() */ @Deprecated (forRemoval=false) - public Date getPlagAlosToSunset() { - return getPlagHamincha(getAlos16Point1Degrees(), getElevationAdjustedSunset(), false); + public Instant getPlagAlosToSunset() { + return getPlagHamincha(getAlos16Point1Degrees(), getSunsetBasedOnElevationSetting(), false); } /** @@ -2280,7 +2096,7 @@ public Date getPlagAlosToSunset() { * {@link #getTzaisGeonim7Point083Degrees() tzais} . This returns the time of 10.75 * the calculated * shaah zmanis after {@link #getAlos16Point1Degrees() dawn}. * - * @return the Date of the plag. If the calculation can't be computed such as northern and + * @return the Instant of the plag. If the calculation can't be computed such as northern and * southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may not * reach low enough below the horizon for this calculation, a null will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. @@ -2288,7 +2104,7 @@ public Date getPlagAlosToSunset() { * @see #getAlos16Point1Degrees() * @see #getTzaisGeonim7Point083Degrees() */ - public Date getPlagAlos16Point1ToTzaisGeonim7Point083Degrees() { + public Instant getPlagAlos16Point1ToTzaisGeonim7Point083Degrees() { return getPlagHamincha(getAlos16Point1Degrees(), getTzaisGeonim7Point083Degrees(), false); } @@ -2300,7 +2116,7 @@ public Date getPlagAlos16Point1ToTzaisGeonim7Point083Degrees() { * zmaniyos calculated based on a day starting at {@link #getAlos16Point1Degrees() alos 16.1°} and * ending at tzais 3.8°. * - * @return the Date of the plag. If the calculation can't be computed such as northern and + * @return the Instant of the plag. If the calculation can't be computed such as northern and * southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may not * reach low enough below the horizon for this calculation, a null will be returned. See detailed * explanation on top of the {@link AstronomicalCalendar} documentation. @@ -2309,18 +2125,18 @@ public Date getPlagAlos16Point1ToTzaisGeonim7Point083Degrees() { * @see #getMinchaGedolaAhavatShalom() * @see #getMinchaKetanaAhavatShalom() */ - public Date getPlagAhavatShalom() { + public Instant getPlagAhavatShalom() { return getTimeOffset(getTzaisGeonim3Point8Degrees(), -getShaahZmanisAlos16Point1ToTzais3Point8() * 1.25); } /** * Method to return the beginning of bain hashmashos of Rabbeinu Tam calculated when the sun is - * {@link #ZENITH_13_POINT_24 13.24°} below the western {@link #GEOMETRIC_ZENITH geometric horizon} (90°) + * {@link ZENITH_13_POINT_24 13.24°} below the western {@link GEOMETRIC_ZENITH geometric horizon} (90°) * after sunset. This calculation is based on the same calculation of {@link #getBainHashmashosRT58Point5Minutes() * bain hashmashos Rabbeinu Tam 58.5 minutes} but uses a degree-based calculation instead of 58.5 exact * minutes. This calculation is based on the position of the sun 58.5 minutes after sunset in Jerusalem around the equinox / equilux, - * which calculates to 13.24° below {@link #GEOMETRIC_ZENITH geometric zenith}. + * which calculates to 13.24° below {@link GEOMETRIC_ZENITH geometric zenith}. * NOTE: As per Yisrael Vehazmanim Vol. III page 1028, No. 50, a dip of slightly less than 13° should be used. * Calculations show that the proper dip to be 13.2456° (truncated to 13.24 that provides about 1.5 second * earlier (lechumra) time) below the horizon at that time. This makes a difference of 1 minute and 10 @@ -2328,16 +2144,15 @@ public Date getPlagAhavatShalom() { * 13.24° versus 13°. For NY during the solstice, the difference is 1 minute 56 seconds. * @todo recalculate the above based on equilux/equinox calculations. * - * @return the Date of the sun being 13.24° below {@link #GEOMETRIC_ZENITH geometric zenith} + * @return the Instant of the sun being 13.24° below {@link GEOMETRIC_ZENITH geometric zenith} * (90°). If the calculation can't be computed such as northern and southern locations even south of the * Arctic Circle and north of the Antarctic Circle where the sun may not reach low enough below the horizon * for this calculation, a null will be returned. See detailed explanation on top of the * {@link AstronomicalCalendar} documentation. * - * @see #ZENITH_13_POINT_24 * @see #getBainHashmashosRT58Point5Minutes() */ - public Date getBainHashmashosRT13Point24Degrees() { + public Instant getBainHashmashosRT13Point24Degrees() { return getSunsetOffsetByDegrees(ZENITH_13_POINT_24); } @@ -2347,14 +2162,14 @@ public Date getBainHashmashosRT13Point24Degrees() { * "https://en.wikipedia.org/wiki/Biblical_and_Talmudic_units_of_measurement">mil before tzais or 3 1/4 * mil after sunset. With a mil calculated as 18 minutes, 3.25 * 18 = 58.5 minutes. * - * @return the Date of 58.5 minutes after sunset. If the calculation can't be computed such as in the + * @return the Instant of 58.5 minutes after sunset. 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 getBainHashmashosRT58Point5Minutes() { - return getTimeOffset(getElevationAdjustedSunset(), 58.5 * MINUTE_MILLIS); + public Instant getBainHashmashosRT58Point5Minutes() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), 58.5 * MINUTE_MILLIS); } /** @@ -2362,14 +2177,14 @@ public Date getBainHashmashosRT58Point5Minutes() { * 18-minute mil) before * shkiah calculated as {@link #getTzaisGeonim7Point083Degrees() 7.083°}. * - * @return the Date of the bain hashmashos of Rabbeinu Tam in this calculation. If the + * @return the Instant of the bain hashmashos of Rabbeinu Tam in this calculation. If the * calculation can't be computed such as northern and southern locations even south of the Arctic Circle and * north of the Antarctic Circle where the sun may not reach low enough below the horizon for this * calculation, a null will be returned. See detailed explanation on top of the * {@link AstronomicalCalendar} documentation. * @see #getTzaisGeonim7Point083Degrees() */ - public Date getBainHashmashosRT13Point5MinutesBefore7Point083Degrees() { + public Instant getBainHashmashosRT13Point5MinutesBefore7Point083Degrees() { return getTimeOffset(getSunsetOffsetByDegrees(ZENITH_7_POINT_083), -13.5 * MINUTE_MILLIS); } @@ -2379,19 +2194,19 @@ public Date getBainHashmashosRT13Point5MinutesBefore7Point083Degrees() { * alos (calculated as 19.8° before sunrise) and sunrise. This is added to sunset to arrive at the time * for bain hashmashos of Rabbeinu Tam. * - * @return the Date of bain hashmashos of Rabbeinu Tam for this calculation. If the + * @return the Instant of bain hashmashos of Rabbeinu Tam for this calculation. If the * calculation can't be computed such as northern and southern locations even south of the Arctic Circle and * north of the Antarctic Circle where the sun may not reach low enough below the horizon for this * calculation, a null will be returned. See detailed explanation on top of the * {@link AstronomicalCalendar} documentation. */ - public Date getBainHashmashosRT2Stars() { - Date alos19Point8 = getAlos19Point8Degrees(); - Date sunrise = getElevationAdjustedSunrise(); + public Instant getBainHashmashosRT2Stars() { + Instant alos19Point8 = getAlos19Point8Degrees(); + Instant sunrise = getSunriseBasedOnElevationSetting(); if (alos19Point8 == null || sunrise == null) { return null; } - return getTimeOffset(getElevationAdjustedSunset(), (sunrise.getTime() - alos19Point8.getTime()) * (5 / 18d)); + return getTimeOffset(getSunsetBasedOnElevationSetting(), (sunrise.toEpochMilli() - alos19Point8.toEpochMilli()) * (5 / 18d)); } /** @@ -2401,14 +2216,14 @@ public Date getBainHashmashosRT2Stars() { * >mil before sunset. According to the Yereim, bain hashmashos starts 3/4 of a mil before sunset and * tzais or nightfall starts at sunset. * - * @return the Date of 18 minutes before sunset. If the calculation can't be computed such as in the + * @return the Instant of 18 minutes before sunset. 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 #getBainHashmashosYereim3Point05Degrees() */ - public Date getBainHashmashosYereim18Minutes() { - return getTimeOffset(getElevationAdjustedSunset(), -18 * MINUTE_MILLIS); + public Instant getBainHashmashosYereim18Minutes() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), -18 * MINUTE_MILLIS); } /** @@ -2423,25 +2238,25 @@ public Date getBainHashmashosYereim18Minutes() { * traditional 0.566° is used. This is more inline with the actual refraction in Eretz Yisrael and is * brought down by Rabbi - * Yedidya Manet in his Zmanei Halacha + * Yedidya Manet in his Zmanei HaHalacha * Lema'aseh (p. 11). That is the first source that I am aware of that calculates degree-based Yereim * zmanim. The 0.5166° refraction is also used by the Luach Itim * Lebinah. Calculating the Yereim's bain hashmashos using 18-minute based degrees is also suggested * in the upcoming 8th edition of the zmanim Kehilchasam. For more details, see the article The Yereim's Bein Hashmashos. + * "https://kosherjava.com/2020/12/07/the-yereims-bein-hashmashos/">The Yereim's Bain Hashmashos. * * @todo recalculate based on equinox/equilux - * @return the Date of the sun's position 3.05° minutes before sunset. If the calculation can't + * @return the Instant of the sun's position 3.05° minutes before sunset. 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 #ZENITH_MINUS_3_POINT_05 + * @see ZENITH_MINUS_3_POINT_05 * @see #getBainHashmashosYereim18Minutes() * @see #getBainHashmashosYereim2Point8Degrees() * @see #getBainHashmashosYereim2Point1Degrees() */ - public Date getBainHashmashosYereim3Point05Degrees() { + public Instant getBainHashmashosYereim3Point05Degrees() { return getSunsetOffsetByDegrees(ZENITH_MINUS_3_POINT_05); } @@ -2453,15 +2268,15 @@ public Date getBainHashmashosYereim3Point05Degrees() { * to the Yereim, bain hashmashos starts 3/4 of a mil before sunset and tzais or nightfall starts * at sunset. * - * @return the Date of 16.875 minutes before sunset. If the calculation can't be computed such as in the + * @return the Instant of 16.875 minutes before sunset. 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 #getBainHashmashosYereim2Point8Degrees() */ - public Date getBainHashmashosYereim16Point875Minutes() { - return getTimeOffset(getElevationAdjustedSunset(), -16.875 * MINUTE_MILLIS); + public Instant getBainHashmashosYereim16Point875Minutes() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), -16.875 * MINUTE_MILLIS); } /** @@ -2475,17 +2290,17 @@ public Date getBainHashmashosYereim16Point875Minutes() { * starts at sunset. Details, including how the degrees were calculated can be seen in the documentation of * {@link #getBainHashmashosYereim3Point05Degrees()}. * - * @return the Date of the sun's position 2.8° minutes before sunset. If the calculation can't + * @return the Instant of the sun's position 2.8° minutes before sunset. 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 #ZENITH_MINUS_2_POINT_8 + * @see ZENITH_MINUS_2_POINT_8 * @see #getBainHashmashosYereim16Point875Minutes() * @see #getBainHashmashosYereim3Point05Degrees() * @see #getBainHashmashosYereim2Point1Degrees() */ - public Date getBainHashmashosYereim2Point8Degrees() { + public Instant getBainHashmashosYereim2Point8Degrees() { return getSunsetOffsetByDegrees(ZENITH_MINUS_2_POINT_8); } @@ -2496,21 +2311,21 @@ public Date getBainHashmashosYereim2Point8Degrees() { * before sunset. According to the Yereim, bain hashmashos starts 3/4 of a mil before sunset and * tzais or nightfall starts at sunset. * - * @return the Date of 13.5 minutes before sunset. If the calculation can't be computed such as in the + * @return the Instant of 13.5 minutes before sunset. 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 #getBainHashmashosYereim2Point1Degrees() */ - public Date getBainHashmashosYereim13Point5Minutes() { - return getTimeOffset(getElevationAdjustedSunset(), -13.5 * MINUTE_MILLIS); + public Instant getBainHashmashosYereim13Point5Minutes() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), -13.5 * MINUTE_MILLIS); } /** * This method returns the beginning of bain hashmashos according to the Yereim (Rabbi Eliezer of Metz) calculated as the sun's - * position 2.1° above the horizon above the horizon around the equinox / equilux in * Yerushalayim, its position 13.5 minutes or 3/4 of an 18-minute mil before sunset. According to the @@ -2518,157 +2333,191 @@ public Date getBainHashmashosYereim13Point5Minutes() { * at sunset. Details, including how the degrees were calculated can be seen in the documentation of * {@link #getBainHashmashosYereim3Point05Degrees()}. * - * @return the Date of the sun's position 2.1° minutes before sunset. If the calculation can't be + * @return the Instant of the sun's position 2.1° minutes before sunset. 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 #ZENITH_MINUS_2_POINT_1 + * @see ZENITH_MINUS_2_POINT_1 * @see #getBainHashmashosYereim13Point5Minutes() * @see #getBainHashmashosYereim2Point8Degrees() * @see #getBainHashmashosYereim3Point05Degrees() */ - public Date getBainHashmashosYereim2Point1Degrees() { + public Instant getBainHashmashosYereim2Point1Degrees() { return getSunsetOffsetByDegrees(ZENITH_MINUS_2_POINT_1); } /** - * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated at the - * sun's position at {@link #ZENITH_3_POINT_7 3.7°} below the western horizon. + * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated at the sun's + * position at {@link ZENITH_3_POINT_7 3.7°} below {@link GEOMETRIC_ZENITH geometric zenith} (90°), calculated + * as the position of the sun 13.5 minutes after sunset, the time it takes to walk 3/4 of a mil at 18 minutes a mil, or 13.5 minutes + * after sunset. The sun is 3.7° below {@link GEOMETRIC_ZENITH geometric zenith} at this time in Jerusalem around the equinox / equilux. This does + * not cover the 26.46 it takes to walk 49 amos (the heref ayin of bain hashmashos of Rav Yosi) at the pace + * of an 18-minute mil. It should be noted that Rabbi Yedidya Manet in his Zmanei HaHalacha Lema'aseh (4th edition part 2, pages and 22 + * and 24) lists 3.65° that appears to be a drop too early. * - * @return the Date representing the time when the sun is 3.7° below sea level. - * @see #ZENITH_3_POINT_7 + * @return the Instant representing the time when the sun is 3.7° below sea level. + * @see ZENITH_3_POINT_7 */ - public Date getTzaisGeonim3Point7Degrees() { + @Deprecated (forRemoval=false) + public Instant getTzaisGeonim3Point7Degrees() { return getSunsetOffsetByDegrees(ZENITH_3_POINT_7); } /** - * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated at the - * sun's position at {@link #ZENITH_3_POINT_8 3.8°} below the western horizon. + * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated at the sun's + * position at {@link ZENITH_3_POINT_7 3.8°} below {@link GEOMETRIC_ZENITH geometric zenith} (90°), calculated + * as the position of the sun 13.5 minutes after sunset, the time it takes to walk 3/4 of a mil at 18 minutes a mil, plus 30 seconds + * for the time it takes to walk 49 amos (the heref ayin of bain hashmashos of Rav Yosi). With this being + * on an 18-minutes mil, 49 amos would take 26.46, rounded to 30 seconds), for a total of 14 minutes after sunset. The sun is + * {@link ZENITH_3_POINT_8 3.8°} below {@link GEOMETRIC_ZENITH geometric zenith} at this time in Jerusalem around the equinox / equilux. * - * @return the Date representing the time when the sun is 3.8° below sea level. - * @see #ZENITH_3_POINT_8 + * @return the Instant representing the time when the sun is 3.8° below sea level. + * @see ZENITH_3_POINT_8 */ - public Date getTzaisGeonim3Point8Degrees() { + @Deprecated (forRemoval=false) + public Instant getTzaisGeonim3Point8Degrees() { return getSunsetOffsetByDegrees(ZENITH_3_POINT_8); } /** * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated at the - * sun's position at {@link #ZENITH_5_POINT_95 5.95°} below the western horizon. - * - * @return the Date representing the time when the sun is 5.95° below sea level. If the calculation + * sun's position at {@link ZENITH_5_POINT_95 5.95°} below below {@link GEOMETRIC_ZENITH geometric zenith} + * (90°), calculated as the position of the sun 24 minutes after sunset in Jerusalem around the equinox / equilux. The + * 24 minutes is based on the Baal Hatanya's calculation of 18 minutes (3/4 of a 24 minute mil) + 4 minutes for + * shkiah amitis + 2 minutes for bain hashmashos of Rav Yosi. See Hazmanim Bahalacha vol II, ch. 50, no. 5, + * p. 512-513, ch. 47, and Yisrael Vehazmanim Vol III, ch. 13, no. 53, p. 1026. Among sources he mentions for this zman is Rabbi Yehuda (Leo) Levi's calculations in Jewish Chrononomy + * and other sources. Calculations show that the time is closer to 5.93° and was seemingly rounded to 5.95°. + * Chabad calendars usually use the 6°-based {@link #getTzaisBaalHatanya()} that is built on this same calculation. + * It should be noted that Rabbi Yedidya Manet in his Zmanei HaHalacha Lema'aseh (4th edition part 2, pages and 22 and 24) lists 5.88° that appears to be a drop + * too early. + * + * @return the Instant representing the time when the sun is 5.95° below sea level. If the calculation * can't be computed such as northern and southern locations even south of the Arctic Circle and north of * the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a * null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. - * @see #ZENITH_5_POINT_95 + * @see #getTzaisBaalHatanya() */ - public Date getTzaisGeonim5Point95Degrees() { + public Instant getTzaisGeonim5Point95Degrees() { return getSunsetOffsetByDegrees(ZENITH_5_POINT_95); } /** * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated as 3/4 * of a mil based on a - * 24-minute mil, or 18 minutes. It is the sun's position at {@link #ZENITH_4_POINT_61 4.61°} below the + * 24-minute mil, or 18 minutes. It is the sun's position at {@link ZENITH_4_POINT_66 4.66°} below the * western horizon. This is a very early zman and should not be relied on without Rabbinical guidance. + * This does not cover the 35.28 seconds it takes to walk 49 amos (the heref ayin of bain hashmashos + * of Rav Yosi) at the pace of a 24-minute mil. See {@link #getTzaisGeonim4Point8Degrees()} for a time that covers the + * heref ayin. * - * @return the Date representing the time when the sun is 4.61° below sea level. If the calculation + * @return the Instant representing the time when the sun is 4.66° below sea level. If the calculation * can't be computed such as northern and southern locations even south of the Arctic Circle and north of * the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a * null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. - * @see #ZENITH_4_POINT_61 + * @see ZENITH_4_POINT_66 + * @see #getTzaisGeonim4Point8Degrees() */ - public Date getTzaisGeonim4Point61Degrees() { - return getSunsetOffsetByDegrees(ZENITH_4_POINT_61); + @Deprecated (forRemoval=false) + public Instant getTzaisGeonim4Point66Degrees() { + return getSunsetOffsetByDegrees(ZENITH_4_POINT_66); } /** * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated as 3/4 * of a mil, based on a - * 22.5-minute mil, or 16 7/8 minutes. It is the sun's position at {@link #ZENITH_4_POINT_37 4.37°} below the western - * horizon. This is a very early zman and should not be relied on without Rabbinical guidance. - * - * @return the Date representing the time when the sun is 4.37° below sea level. If the calculation + * 22.5-minute mil, or 16 7/8 minutes. It is the sun's position at {@link ZENITH_4_POINT_42 4.42°} below the western + * horizon. This is a very early zman and should not be relied on without Rabbinical guidance. This does + * not cover the 33.07 seconds it takes to walk 49 amos (the heref ayin of bain hashmashos of Rav Yosi) + * at the pace of a 22.5 minute-mil. It should be noted that Rabbi Yedidya Manet in his Zmanei HaHalacha Lema'aseh (4th edition part 2, pages and 22 + * and 24) lists 4.37° that appears to be a drop too early. + * + * @return the Instant representing the time when the sun is 4.42° below sea level. If the calculation * can't be computed such as northern and southern locations even south of the Arctic Circle and north of * the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a * null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. - * @see #ZENITH_4_POINT_37 + * @see ZENITH_4_POINT_42 */ - public Date getTzaisGeonim4Point37Degrees() { - return getSunsetOffsetByDegrees(ZENITH_4_POINT_37); - } - - /** - * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated as 3/4 - * of a 24-minute mil, - * based on a mil being 24 minutes, and is calculated as 18 + 2 + 4 for a total of 24 minutes. It is the - * sun's position at {@link #ZENITH_5_POINT_88 5.88°} below the western horizon. This is a very early - * zman and should not be relied on without Rabbinical guidance. - * - * @todo Additional detailed documentation needed. - * @return the Date representing the time when the sun is 5.88° below sea level. If the calculation - * can't be computed such as northern and southern locations even south of the Arctic Circle and north of - * the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a - * null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} - * documentation. - * @see #ZENITH_5_POINT_88 - */ - public Date getTzaisGeonim5Point88Degrees() { - return getSunsetOffsetByDegrees(ZENITH_5_POINT_88); - } - - /** - * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated as 3/4 - * of a mil based on the - * sun's position at {@link #ZENITH_4_POINT_8 4.8°} below the western horizon. This is based on Rabbi Leo Levi's - * calculations. This is a very early zman and should not be relied on without Rabbinical guidance. - * @todo Additional documentation needed. - * - * @return the Date representing the time when the sun is 4.8° below sea level. If the calculation + @Deprecated (forRemoval=false) + public Instant getTzaisGeonim4Point42Degrees() { + return getSunsetOffsetByDegrees(ZENITH_4_POINT_42); + } + + /** + * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated as the + * sun's position below the horizon at a time of 18.6 minutes after sunset. This is calculated as 3/4 of a 24-minute + * mil, plus 0.6 minutes for the + * time to walk 49 amos for bain hashmashos of Rav Yosi (with this zman based on a 24-minute mil, 49 + * amos would take 35.28 seconds to walk), for a total of 18.6 minutes after sunset. This calculates to the sun's position + * at {@link ZENITH_4_POINT_8 4.8°} below the western horizon. This is based on Rav Yechiel Michel Shlezinger's sefer Aizehu Bain Hashmashos, Rabbi Yehuda (Leo) Levi's + * calculations in Zmanei Hayom BaHalacha p. 37. + * At this point, 3 medium sized stars are visible to a non-expert with good vision with effort. An expert knowing where to + * look can see the 3 medium stars as early as 15 minutes after sunset. This is explained in detail in Hazmanim Bahalacha vol + * II, ch. 41, no. 6 (p. 372-373, ch. 47, no. 11-12 (p. 491-493) where it is clear that medium sized stars would be visible as + * early as 14 minutes after sunset (13.5 minutes for 3/4 of an 18 minute Mil, plus 0.5 minutes for bain Hashmashos + * of Rav Yosi) to an expert. See more details on this earier zman at {@link #getTzaisGeonim3Point8Degrees()}. + * This is an early zman for tzaisand should not be relied on without Rabbinical guidance. + * + * @return the Instant representing the time when the sun is 4.8° below sea level. If the calculation * can't be computed such as northern and southern locations even south of the Arctic Circle and north of * the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a * null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. - * @see #ZENITH_4_POINT_8 + * @see ZENITH_4_POINT_8 */ - public Date getTzaisGeonim4Point8Degrees() { + public Instant getTzaisGeonim4Point8Degrees() { return getSunsetOffsetByDegrees(ZENITH_4_POINT_8); } - /** - * This method returns the tzais (nightfall) based on the opinion of the Geonim as calculated by - * Rabbi Yechiel Michel Tucazinsky. It is - * based on of the position of the sun no later than {@link #getTzaisGeonim6Point45Degrees() 31 minutes} after sunset - * in Jerusalem the height of the summer solstice and is 28 minutes after shkiah around the equinox / equilux. This - * computes to 6.45° below the western horizon. - * @todo Additional documentation details needed. - * - * @return the Date representing the time when the sun is 6.45° below sea level. If the + * This method returns the tzais (nightfall) based on the opinion of the Geonim as calculated by Rabbi Yechiel Michel Tucazinsky as the position of + * the sun no later than 31 minutes after sea-level sunset in Jerusalem (the Birur halacha shows that Rav Tucazinsky's + * calculations for sunset, listed as 28 minutes in this case, were about 3 minutes later than reality), and at the height of + * the summer solstice,this zman, calculatons show that 30.75 minutes after shkiah computes to 6.45° below + * {@link GEOMETRIC_ZENITH geometric zenith}. This calculation is found in the Birur Halacha Yoreh Deah 262 and it is the commonly used + * zman in Israel. It is also used in the Luach Itim Lebinah. it + * should be noted that this differs from the 6.1° / 6.2° calculation for Rabbi Tucazinsky's time as calculated by the + * Hazmanim Bahalacha Vol II chapter 50:7 (page 515). Calculations show that 6.45° at the equinox is 26.5 minutes after + * shkiah around the equinox / + * equilux. + * + * @return the Instant representing the time when the sun is 6.45° below sea level. If the * calculation can't be computed such as northern and southern locations even south of the Arctic Circle and * north of the Antarctic Circle where the sun may not reach low enough below the horizon for this * calculation, a null will be returned. See detailed explanation on top of the * {@link AstronomicalCalendar} documentation. - * @see #ZENITH_6_POINT_45 + * @see ZENITH_6_POINT_45 */ - public Date getTzaisGeonim6Point45Degrees() { + public Instant getTzaisGeonim6Point45Degrees() { return getSunsetOffsetByDegrees(ZENITH_6_POINT_45); } /** * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated when the - * sun's position {@link #ZENITH_7_POINT_083 7.083° (or 7° 5\u2032}) below the western horizon. This is often + * sun's position {@link ZENITH_7_POINT_083 7.083° (or 7° 5\u2032}) below the western horizon. This is often * referred to as 7°5' or 7° and 5 minutes. This calculation is based on the observation of 3 medium-sized * stars by Dr. Baruch (Berthold) Cohn in his luach Tabellen enthaltend die Zeitangaben für * den Beginn der Nacht und des Tages für die Breitengrade + 66 bis -38 published in Strasbourg, France in 1899. - * This calendar was very popular in Europe, and many other calendars based their time on it. tzais time on it. Rav Dovid Tzvi Hoffman in his * Sh"Ut Melamed Leho'il in an exchange of letters with Baruch Cohn in Orach Chaim 30 agreed to this zman (page 36), @@ -2679,21 +2528,21 @@ public Date getTzaisGeonim6Point45Degrees() { * Exactly. The actual position of the sun 30 minutes after sunset in Jerusalem at the equilux is 7.205° and 7.199° * at the equinox. See Hazmanim Bahalacha vol 2, pages 520-521 for more details. * - * @return the Date representing the time when the sun is 7.083° below sea level. If the + * @return the Instant representing the time when the sun is 7.083° below sea level. If the * calculation can't be computed such as northern and southern locations even south of the Arctic Circle and * north of the Antarctic Circle where the sun may not reach low enough below the horizon for this * calculation, a null will be returned. See detailed explanation on top of the * {@link AstronomicalCalendar} documentation. - * @see #ZENITH_7_POINT_083 + * @see ZENITH_7_POINT_083 */ - public Date getTzaisGeonim7Point083Degrees() { + public Instant getTzaisGeonim7Point083Degrees() { return getSunsetOffsetByDegrees(ZENITH_7_POINT_083); } /** * This method returns tzais (nightfall) based on the opinion of the Geonim calculated as 45 minutes * after sunset during the summer solstice in New York, when the neshef (twilight) is the longest. The sun's - * position at this time computes to {@link #ZENITH_7_POINT_67 7.75°} below the western horizon. See Igros Moshe Even Haezer 4, Ch. 4 (regarding * tzais for krias Shema). It is also mentioned in Rabbi Heber's Shaarei Zmanim on in @@ -2703,49 +2552,33 @@ public Date getTzaisGeonim7Point083Degrees() { * href="https://www.worldcat.org/oclc/179728985">The radiance of Shabbos as the earliest zman for New York. * This zman is also listed in the Divrei * Shalom Vol. III, chapter 75, and Bais Av"i - * Vol. III, chapter 117. This zman is also listed in the Divrei Shalom etc. chapter 177 (FIXME - could not - * be located). Since this zman depends on the level of light, Rabbi Yaakov Shakow presented this degree-based - * calculation to Rabbi Rabbi Shmuel Kamenetsky who agreed - * to it. + * Vol. III, chapter 117. This zman is also listed in the Divrei Shalom etc. chapter 177. Since this + * zman depends on the level of light, Rabbi Yaakov Shakow presented this degree-based calculation to Rabbi + * Rabbi Shmuel Kamenetsky who agreed to it. * @todo add hyperlinks to source of Divrei Shalom once it is located. - * @return the Date representing the time when the sun is 7.67° below sea level. If the + * @return the Instant representing the time when the sun is 7.67° below sea level. If the * calculation can't be computed such as northern and southern locations even south of the Arctic Circle and * north of the Antarctic Circle where the sun may not reach low enough below the horizon for this * calculation, a null will be returned. See detailed explanation on top of the * {@link AstronomicalCalendar} documentation. - * @see #ZENITH_7_POINT_67 + * @see ZENITH_7_POINT_67 */ - public Date getTzaisGeonim7Point67Degrees() { + public Instant getTzaisGeonim7Point67Degrees() { return getSunsetOffsetByDegrees(ZENITH_7_POINT_67); } - - /** - * This method returns the tzais (nightfall) based on the opinion of the Geonim calculated at the - * sun's position at {@link #ZENITH_8_POINT_5 8.5°} below the western horizon. - * - * @return the Date representing the time when the sun is 8.5° below sea level. If the calculation - * can't be computed such as northern and southern locations even south of the Arctic Circle and north of - * the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a - * null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} - * documentation. - * @see #ZENITH_8_POINT_5 - */ - public Date getTzaisGeonim8Point5Degrees() { - return getSunsetOffsetByDegrees(ZENITH_8_POINT_5); - } /** * This method returns the tzais (nightfall) based on the calculations used in the Luach Itim Lebinah as the stringent time for tzais. It is - * calculated at the sun's position at {@link #ZENITH_9_POINT_3 9.3°} below the western horizon. + * calculated at the sun's position at {@link ZENITH_9_POINT_3 9.3°} below the western horizon. * - * @return the Date representing the time when the sun is 9.3° below sea level. If the calculation + * @return the Instant representing the time when the sun is 9.3° below sea level. If the calculation * can't be computed such as northern and southern locations even south of the Arctic Circle and north of * the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a * null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. */ - public Date getTzaisGeonim9Point3Degrees() { + public Instant getTzaisGeonim9Point3Degrees() { return getSunsetOffsetByDegrees(ZENITH_9_POINT_3); } @@ -2754,21 +2587,21 @@ public Date getTzaisGeonim9Point3Degrees() { * minutes after sunset around the equinox / equilux, the * day that a solar hour is 60 minutes in New York. The sun's position at this time computes to - * {@link #ZENITH_9_POINT_75 9.75°} below the western horizon. This is the opinion of Rabbi Eliyahu Henkin. This also follows the opinion of * Rabbi Shmuel Kamenetsky. Rabbi Yaakov Shakow presented * these degree-based times to Rabbi Shmuel Kamenetsky who agreed to them. * * @todo recalculate based on equinox / equilux. - * @return the Date representing the time when the sun is 9.75° below sea level. If the calculation + * @return the Instant representing the time when the sun is 9.75° below sea level. If the calculation * can't be computed such as northern and southern locations even south of the Arctic Circle and north of * the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a * null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. * - * @see #getTzais60() + * @see #getTzais60Minutes() */ - public Date getTzaisGeonim9Point75Degrees() { + public Instant getTzaisGeonim9Point75Degrees() { return getSunsetOffsetByDegrees(ZENITH_9_POINT_75); } @@ -2778,20 +2611,20 @@ public Date getTzaisGeonim9Point75Degrees() { * "https://he.wikipedia.org/wiki/%D7%9E%D7%9C%D7%9B%D7%99%D7%90%D7%9C_%D7%A6%D7%91%D7%99_%D7%98%D7%A0%D7%A0%D7%91%D7%95%D7%99%D7%9D" * >Divrei Malkiel that the time to walk the distance of a mil is 15 minutes, for a total of 60 minutes - * for 4 mil after {@link #getSunset() sunset} or {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link - * #isUseElevation()} setting). See detailed documentation explaining the 60 minute concept at {@link #getAlos60()}. + * for 4 mil after {@link #getSunset() sunset} or {@link #getSeaLevelSunset() sea level sunset} (depending on the + * {@link #isUseElevation()} setting). See detailed documentation explaining the 60 minute concept at {@link #getAlos60Minutes()}. * - * @return the Date representing 60 minutes after sea level sunset. If the calculation can't be + * @return the Instant representing 60 minutes after sea level sunset. 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 #getAlos60() + * @see #getAlos60Minutes() * @see #getPlagHamincha60Minutes() * @see #getShaahZmanis60Minutes() */ - public Date getTzais60() { - return getTimeOffset(getElevationAdjustedSunset(), 60 * MINUTE_MILLIS); + public Instant getTzais60Minutes() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), 60 * MINUTE_MILLIS); } /** @@ -2803,15 +2636,15 @@ public Date getTzais60() { * for Israel. This API uses 40 minutes year round in any place on the globe by default. This offset can be changed * by calling {@link #setAteretTorahSunsetOffset(double)}. * - * @return the Date representing 40 minutes (configurable via {@link #setAteretTorahSunsetOffset}) + * @return the Instant representing 40 minutes (configurable via {@link #setAteretTorahSunsetOffset}) * after sea level sunset. 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 #getAteretTorahSunsetOffset() * @see #setAteretTorahSunsetOffset(double) */ - public Date getTzaisAteretTorah() { - return getTimeOffset(getElevationAdjustedSunset(), getAteretTorahSunsetOffset() * MINUTE_MILLIS); + public Instant getTzaisAteretTorah() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), getAteretTorahSunsetOffset() * MINUTE_MILLIS); } /** @@ -2851,7 +2684,7 @@ public void setAteretTorahSunsetOffset(double ateretTorahSunsetOffset) { * {@link #getAlos72Zmanis() alos 72 zmaniyos}. Note: Based on this calculation chatzos * will not be at midday. * - * @return the Date of the latest zman krias shema based on this calculation. If the + * @return the Instant of the latest zman krias shema based on this calculation. 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. @@ -2861,7 +2694,7 @@ public void setAteretTorahSunsetOffset(double ateretTorahSunsetOffset) { * @see #setAteretTorahSunsetOffset(double) * @see #getShaahZmanisAteretTorah() */ - public Date getSofZmanShmaAteretTorah() { + public Instant getSofZmanShmaAteretTorah() { return getSofZmanShma(getAlos72Zmanis(), getTzaisAteretTorah(), false); } @@ -2875,7 +2708,7 @@ public Date getSofZmanShmaAteretTorah() { * {@link #getAlos72Zmanis() alos 72 zmaniyos}. * Note: Based on this calculation chatzos will not be at midday. * - * @return the Date of the latest zman krias shema based on this calculation. If the + * @return the Instant of the latest zman krias shema based on this calculation. 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. @@ -2884,7 +2717,7 @@ public Date getSofZmanShmaAteretTorah() { * @see #getShaahZmanisAteretTorah() * @see #setAteretTorahSunsetOffset(double) */ - public Date getSofZmanTfilaAteretTorah() { + public Instant getSofZmanTfilaAteretTorah() { return getSofZmanTfila(getAlos72Zmanis(), getTzaisAteretTorah(), false); } @@ -2894,25 +2727,25 @@ public Date getSofZmanTfilaAteretTorah() { * before sunrise and is usually calculated as ending {@link #getTzaisAteretTorah() 40 minutes after sunset} * (configurable to any offset via {@link #setAteretTorahSunsetOffset(double)}). This is the preferred earliest * time to pray mincha according to the opinion of the Rambam and others. For more information on this see the documentation on {@link #getMinchaGedola() mincha + * >Rambam and others. For more information on this see the documentation on {@link #getMinchaGedolaGRA() mincha * gedola}. This is calculated as 6.5 {@link #getShaahZmanisAteretTorah() solar hours} after alos. The * calculation used is 6.5 * {@link #getShaahZmanisAteretTorah()} after {@link #getAlos72Zmanis() alos}. * * @see #getAlos72Zmanis() * @see #getTzaisAteretTorah() * @see #getShaahZmanisAteretTorah() - * @see #getMinchaGedola() + * @see #getMinchaGedolaGRA() * @see #getMinchaKetanaAteretTorah() - * @see ZmanimCalendar#getMinchaGedola() + * @see #getMinchaGedolaGRA() * @see #getAteretTorahSunsetOffset() * @see #setAteretTorahSunsetOffset(double) * - * @return the Date of the time of mincha gedola. If the calculation can't be computed such as + * @return the Instant of the time of mincha gedola. 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 getMinchaGedolaAteretTorah() { + public Instant getMinchaGedolaAteretTorah() { return getMinchaGedola(getAlos72Zmanis(), getTzaisAteretTorah(), false); } @@ -2923,7 +2756,7 @@ public Date getMinchaGedolaAteretTorah() { * {@link #getTzaisAteretTorah() 40 minutes after sunset} (configurable to any offset via * {@link #setAteretTorahSunsetOffset(double)}). This is the preferred earliest time to pray mincha * according to the opinion of the Rambam and others. - * For more information on this see the documentation on {@link #getMinchaGedola() mincha gedola}. This is + * For more information on this see the documentation on {@link #getMinchaGedolaGRA() mincha gedola}. This is * calculated as 9.5 {@link #getShaahZmanisAteretTorah() solar hours} after {@link #getAlos72Zmanis() alos}. * The calculation used is 9.5 * {@link #getShaahZmanisAteretTorah()} after {@link #getAlos72Zmanis() alos}. * @@ -2932,14 +2765,14 @@ public Date getMinchaGedolaAteretTorah() { * @see #getShaahZmanisAteretTorah() * @see #getAteretTorahSunsetOffset() * @see #setAteretTorahSunsetOffset(double) - * @see #getMinchaGedola() - * @see #getMinchaKetana() - * @return the Date of the time of mincha ketana. If the calculation can't be computed such as + * @see #getMinchaGedolaGRA() + * @see #getMinchaKetanaGRA() + * @return the Instant of the time of mincha ketana. 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 getMinchaKetanaAteretTorah() { + public Instant getMinchaKetanaAteretTorah() { return getMinchaKetana(getAlos72Zmanis(), getTzaisAteretTorah(), false); } @@ -2952,7 +2785,7 @@ public Date getMinchaKetanaAteretTorah() { * {@link #getShaahZmanisAteretTorah() shaos zmaniyos} (temporal hours) after {@link #getAlos72Zmanis() * dawn}. * - * @return the Date of the plag. If the calculation can't be computed such as in the Arctic Circle + * @return the Instant of the plag. 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 #getAlos72Zmanis() @@ -2961,13 +2794,13 @@ public Date getMinchaKetanaAteretTorah() { * @see #setAteretTorahSunsetOffset(double) * @see #getAteretTorahSunsetOffset() */ - public Date getPlagHaminchaAteretTorah() { + public Instant getPlagHaminchaAteretTorah() { return getPlagHamincha(getAlos72Zmanis(), getTzaisAteretTorah(), false); } /** - * Method to return tzais (dusk) calculated as 72 minutes zmaniyos, or 1/10th of the day after - * {@link #getSeaLevelSunset() sea level sunset}. This is the way that the tzais (dusk) calculated as 72 minutes zmaniyos, or 1/10th of the day after {@link + * #getSeaLevelSunset() sea level sunset}. This is the way that the Minchas Cohen in Ma'amar 2:4 calculates Rebbeinu Tam's * time of tzeis. It should be noted that this calculation results in the shortest time from sunset to * tzais being during the winter solstice, the longest at the summer solstice and 72 clock minutes at the @@ -2975,54 +2808,28 @@ public Date getPlagHaminchaAteretTorah() { * twilight. The shortest twilight is during the equinox, the longest is during the summer solstice, and in the * winter with the shortest daylight, the twilight period is longer than during the equinoxes. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. * @see #getAlos72Zmanis() */ - public Date getTzais72Zmanis() { + public Instant getTzais72Zmanis() { return getZmanisBasedOffset(1.2); } - - /** - * A utility method to return alos (dawn) or tzais (dusk) based on a fractional day offset. - * @param hours the number of shaos zmaniyos (temporal hours) before sunrise or after sunset that defines dawn - * or dusk. If a negative number is passed in, it will return the time of alos (dawn) (subtracting the - * time from sunrise) and if a positive number is passed in, it will return the time of tzais (dusk) - * (adding the time to sunset). If 0 is passed in, a null will be returned (since we can't tell if it - * is sunrise or sunset based). - * @return the 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, - * a null will be returned. A null will also be returned if 0 is passed in, since we can't - * tell if it is sunrise or sunset based. See detailed explanation on top of the {@link AstronomicalCalendar} - * documentation. - */ - private Date getZmanisBasedOffset(double hours) { - long shaahZmanis = getShaahZmanisGra(); - if (shaahZmanis == Long.MIN_VALUE || hours == 0) { - return null; - } - - if (hours > 0) { - return getTimeOffset(getElevationAdjustedSunset(), (long) (shaahZmanis * hours)); - } else { - return getTimeOffset(getElevationAdjustedSunrise(), (long) (shaahZmanis * hours)); - } - } /** * Method to return tzais (dusk) calculated using 90 minutes zmaniyos or 1/8th of the day after {@link * #getSeaLevelSunset() sea level sunset}. This time is known in Yiddish as the achtel (an eighth) - * zman. + * zman used in various kehilos. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. * @see #getAlos90Zmanis() */ - public Date getTzais90Zmanis() { + public Instant getTzais90Zmanis() { return getZmanisBasedOffset(1.5); } @@ -3030,13 +2837,13 @@ public Date getTzais90Zmanis() { * Method to return tzais (dusk) calculated using 96 minutes zmaniyos or 1/7.5 of the day after * {@link #getSeaLevelSunset() sea level sunset}. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. * @see #getAlos96Zmanis() */ - public Date getTzais96Zmanis() { + public Instant getTzais96Zmanis() { return getZmanisBasedOffset(1.6); } @@ -3049,24 +2856,24 @@ public Date getTzais96Zmanis() { * opinion of Ula who calculated tzais as 5 mil after elevation adjusted shkiah (sunset). A similar * calculation {@link #getTzais19Point8Degrees()} uses solar position* calculations based on this time. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. * @see #getTzais19Point8Degrees() - * @see #getAlos90() + * @see #getAlos90Minutes() */ - public Date getTzais90() { - return getTimeOffset(getElevationAdjustedSunset(), 90 * MINUTE_MILLIS); + public Instant getTzais90Minutes() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), 90 * MINUTE_MILLIS); } /** * This method should be used lechumra only and returns tzais (nightfall) based on the calculations - * of Rav Chaim Naeh that the time to walk the - * distance of a mil - * according to the Rambam's opinion is 2/5 of an hour (24 minutes) - * for a total of 120 minutes based on the opinion of Ula who calculated tzais as 5 mil after {@link - * #getSunset() sunset} or {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()} setting). + * of Rav Chaim Naeh that the time to walk the distance + * of a mil according to the Rambam's opinion is 2/5 of an hour (24 minutes) for a total of 120 + * minutes based on the opinion of Ula who calculated tzais as 5 mil after {@link #getSunset() + * sunset} or {@link #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()} setting). * A similar calculation {@link #getTzais26Degrees()} uses degree-based calculations based on this 120 minute calculation. * Since the zman is extremely late and at a point that is long past the 18° point where the darkest point is * reached, it should only be used lechumra, such as delaying the start of nighttime mitzvos. @@ -3075,16 +2882,16 @@ public Date getTzais90() { * lekula can result in chillul Shabbos etc. There is no current plan to remove this * method from the API, and this deprecation is intended to alert developers of the danger of using it. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar}. * documentation. * @see #getTzais26Degrees() - * @see #getAlos120() + * @see #getAlos120Minutes() */ @Deprecated (forRemoval=false) - public Date getTzais120() { - return getTimeOffset(getElevationAdjustedSunset(), 120 * MINUTE_MILLIS); + public Instant getTzais120Minutes() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), 120 * MINUTE_MILLIS); } /** @@ -3098,16 +2905,16 @@ public Date getTzais120() { * lekula can result in chillul Shabbos etc. There is no current plan to remove this * method from the API, and this deprecation is intended to alert developers of the danger of using it. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. * @see #getAlos120Zmanis() - * @see #getTzais120() + * @see #getTzais120Minutes() * @see #getTzais26Degrees() */ @Deprecated (forRemoval=false) - public Date getTzais120Zmanis() { + public Instant getTzais120Zmanis() { return getZmanisBasedOffset(2.0); } @@ -3119,19 +2926,19 @@ public Date getTzais120Zmanis() { * Jerusalem. The question of equinox VS equilux is complex, with Rabbi Meir Posen in the Ohr Meir of the opinion that the equilux should be used. See * Yisrael Vehazmanim vol I, 34:1:4. Rabbi Yedidya Manet in his Zmanei Halacha Lema'aseh (4th edition part 2, pages + * "https://www.nli.org.il/en/books/NNL_ALEPH002542826/NLI">Zmanei HaHalacha Lema'aseh (4th edition part 2, pages * and 22 and 24) and Rabbi Yonah Mertzbuch (in a letter published by Rabbi Manet) are of the opinion that the * astronomical equinox should be used. The difference adds up to about 9 seconds, too trivial to make much of a * difference. For information on how this is calculated see the comments on {@link #getAlos16Point1Degrees()}. * - * @return the Date representing the time. If the calculation can't be computed such as northern and + * @return the Instant representing the time. If the calculation can't be computed such as northern and * southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may * not reach low enough below the horizon for this calculation, a null will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #getTzais72() + * @see #getTzais72Minutes() * @see #getAlos16Point1Degrees() for more information on this calculation. */ - public Date getTzais16Point1Degrees() { + public Instant getTzais16Point1Degrees() { return getSunsetOffsetByDegrees(ZENITH_16_POINT_1); } @@ -3146,62 +2953,62 @@ public Date getTzais16Point1Degrees() { * lekula can result in chillul Shabbos etc. There is no current plan to remove this * method from the API, and this deprecation is intended to alert developers of the danger of using it. * - * @return the Date representing the time. If the calculation can't be computed such as northern and + * @return the Instant representing the time. If the calculation can't be computed such as northern and * southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may * not reach low enough below the horizon for this calculation, a null will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #getTzais120() + * @see #getTzais120Minutes() * @see #getAlos26Degrees() */ @Deprecated (forRemoval=false) - public Date getTzais26Degrees() { + public Instant getTzais26Degrees() { return getSunsetOffsetByDegrees(ZENITH_26_DEGREES); } /** * For information on how this is calculated see the comments on {@link #getAlos18Degrees()} * - * @return the Date representing the time. If the calculation can't be computed such as northern and + * @return the Instant representing the time. If the calculation can't be computed such as northern and * southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may * not reach low enough below the horizon for this calculation, a null will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. * @see #getAlos18Degrees() */ - public Date getTzais18Degrees() { + public Instant getTzais18Degrees() { return getSunsetOffsetByDegrees(ASTRONOMICAL_ZENITH); } /** - * For information on how this is calculated see the comments on {@link #getAlos19Point8Degrees()} + * For information on how this is calculated see the comments on {@link #getAlos19Point8Degrees()}. * - * @return the Date representing the time. If the calculation can't be computed such as northern and + * @return the Instant representing the time. If the calculation can't be computed such as northern and * southern locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may * not reach low enough below the horizon for this calculation, a null will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #getTzais90() + * @see #getTzais90Minutes() * @see #getAlos19Point8Degrees() */ - public Date getTzais19Point8Degrees() { + public Instant getTzais19Point8Degrees() { return getSunsetOffsetByDegrees(ZENITH_19_POINT_8); } /** * A method to return tzais (dusk) calculated as 96 minutes after {@link #getSunset() sunset} or {@link * #getSeaLevelSunset() sea level sunset} (depending on the {@link #isUseElevation()} setting). For information on how - * this is calculated see the comments on {@link #getAlos96()}. + * this is calculated see the comments on {@link #getAlos96Minutes()}. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. - * @see #getAlos96() + * @see #getAlos96Minutes() */ - public Date getTzais96() { - return getTimeOffset(getElevationAdjustedSunset(), 96 * MINUTE_MILLIS); + public Instant getTzais96Minutes() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), 96 * MINUTE_MILLIS); } /** - * A method that returns the local time for fixed chatzos. This time is noon and midnight adjusted from + * A method that returns the local time for fixed chatzos. This time is noon and adjusted from * standard time to account for the local latitude. The 360° of the globe divided by 24 calculates to 15° * per hour with 4 minutes per degree, so at a longitude of 0 , 15, 30 etc... Chatzos is at exactly 12:00 * noon. This is the time of chatzos according to the Daylight saving time. * - * @return the Date representing the local chatzos - * @see GeoLocation#getLocalMeanTimeOffset() - * @see AstronomicalCalendar#getLocalMeanTime(double) + * @return the Instant representing the local chatzos + * @see GeoLocation#getLocalMeanTimeOffset(Instant) + * @see #getLocalMeanTime(LocalTime) */ - public Date getFixedLocalChatzos() { - return getLocalMeanTime(12.0); + public Instant getFixedLocalChatzosHayom() { + return getLocalMeanTime(LocalTime.NOON); } /** @@ -3240,18 +3047,16 @@ public Date getFixedLocalChatzos() { * the end of the Jewish day. If Kidush Levana occurs during the day (starting at alos and ending at * tzais), the time returned will be alos. If either the alos or tzais parameter * are null, no daytime adjustment will be made. - * @return the Date representing the moment halfway between molad and molad. If the time occurs between + * @return the Instant representing the moment halfway between molad and molad. If the time occurs between * alos and tzais, alos will be returned. If the zman will not occur on this day, a * null will be returned. * @see #getSofZmanKidushLevanaBetweenMoldos() - * @see #getSofZmanKidushLevana15Days(Date, Date) + * @see #getSofZmanKidushLevana15Days(Instant, Instant) * @see JewishCalendar#getSofZmanKidushLevanaBetweenMoldos() */ - public Date getSofZmanKidushLevanaBetweenMoldos(Date alos, Date tzais) { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - + public Instant getSofZmanKidushLevanaBetweenMoldos(Instant alos, Instant tzais) { + JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate()); + // Do not calculate for impossible dates, but account for extreme cases. In the extreme case of Rapa Iti in French // Polynesia on Dec 2027 when kiddush Levana 3 days can be said on Rosh Chodesh, the sof zman Kiddush Levana // will be on the 12th of the Teves. In the case of Anadyr, Russia on Jan, 2071, sof zman Kiddush Levana between the @@ -3263,7 +3068,7 @@ public Date getSofZmanKidushLevanaBetweenMoldos(Date alos, Date tzais) { } /** - * Returns the Date of the molad based time if it occurs on the current date. Since Kiddush Levana + * Returns the Instant of the molad based time if it occurs on the current date. Since Kiddush Levana * can only be said during the day, there are parameters to limit it to between alos and tzais. If * the time occurs between alos and tzais, tzais will be returned. * @@ -3282,15 +3087,15 @@ public Date getSofZmanKidushLevanaBetweenMoldos(Date alos, Date tzais) { * @return the molad based time. If the zman does not occur during the current date, null will be * returned. */ - private Date getMoladBasedTime(Date moladBasedTime, Date alos, Date tzais, boolean techila) { - Date lastMidnight = getMidnightLastNight(); - Date midnightTonight = getMidnightTonight(); - if(moladBasedTime.before(lastMidnight) || moladBasedTime.after(midnightTonight)){ // Invalid time, bailout + private Instant getMoladBasedTime(Instant moladBasedTime, Instant alos, Instant tzais, boolean techila) { + Instant lastMidnight = getMidnightLastNight().toInstant(); + Instant midnightTonight = getMidnightTonight().toInstant(); + if(moladBasedTime.isBefore(lastMidnight) || moladBasedTime.isAfter(midnightTonight)){ // Invalid time, bailout return null; } else if (alos == null || tzais == null){ // Not enough info to adjust return moladBasedTime; } else { // It's the daytime, get the next/prev night - if (moladBasedTime.after(alos) && moladBasedTime.before(tzais)) { + if (moladBasedTime.isAfter(alos) && moladBasedTime.isBefore(tzais)) { if (techila) { return tzais; } else { @@ -3308,16 +3113,16 @@ private Date getMoladBasedTime(Date moladBasedTime, Date alos, Date tzais, boole * halfway between molad and molad. This adds half the 29 days, 12 hours and 793 chalakim time between * molad and molad (14 days, 18 hours, 22 minutes and 666 milliseconds) to the month's molad. * The sof zman Kiddush Levana will be returned even if it occurs during the day. To limit the time to between - * tzais and alos, see {@link #getSofZmanKidushLevanaBetweenMoldos(Date, Date)}. + * tzais and alos, see {@link #getSofZmanKidushLevanaBetweenMoldos(Instant, Instant)}. * - * @return the Date representing the moment halfway between molad and molad. If the time occurs between + * @return the Instant representing the moment halfway between molad and molad. If the time occurs between * alos and tzais, alos will be returned. If the zman will not occur on this * day, a null will be returned. - * @see #getSofZmanKidushLevanaBetweenMoldos(Date, Date) + * @see #getSofZmanKidushLevanaBetweenMoldos(Instant, Instant) * @see #getSofZmanKidushLevana15Days() * @see JewishCalendar#getSofZmanKidushLevanaBetweenMoldos() */ - public Date getSofZmanKidushLevanaBetweenMoldos() { + public Instant getSofZmanKidushLevanaBetweenMoldos() { return getSofZmanKidushLevanaBetweenMoldos(null, null); } @@ -3326,7 +3131,7 @@ public Date getSofZmanKidushLevanaBetweenMoldos() { * opinion brought down in the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the * Rema who brings down the opinion of the Maharil's of calculating - * {@link #getSofZmanKidushLevanaBetweenMoldos(Date, Date) half way between molad and molad} is of + * {@link #getSofZmanKidushLevanaBetweenMoldos(Instant, Instant) half way between molad and molad} is of * the opinion that the Mechaber agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, * see Rabbi Dovid Heber's very detailed write-up in Siman Daled (chapter 4) of Shaarei Zmanim. If the time of sof zman Kiddush Levana occurs during @@ -3342,17 +3147,16 @@ public Date getSofZmanKidushLevanaBetweenMoldos() { * tzais), the time returned will be alos. If either the alos or tzais parameters * are null, no daytime adjustment will be made. * - * @return the Date representing the moment 15 days after the molad. If the time occurs between alos and + * @return the Instant representing the moment 15 days after the molad. If the time occurs between alos and * tzais, alos will be returned. If the zman will not occur on this day, a * null will be returned. * - * @see #getSofZmanKidushLevanaBetweenMoldos(Date, Date) + * @see #getSofZmanKidushLevanaBetweenMoldos(Instant, Instant) * @see JewishCalendar#getSofZmanKidushLevana15Days() */ - public Date getSofZmanKidushLevana15Days(Date alos, Date tzais) { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); + public Instant getSofZmanKidushLevana15Days(Instant alos, Instant tzais) { + JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate()); + // Do not calculate for impossible dates, but account for extreme cases. In the extreme case of Rapa Iti in // French Polynesia on Dec 2027 when kiddush Levana 3 days can be said on Rosh Chodesh, the sof zman Kiddush // Levana will be on the 12th of the Teves. in the case of Anadyr, Russia on Jan, 2071, sof zman kiddush levana will @@ -3368,22 +3172,22 @@ public Date getSofZmanKidushLevana15Days(Date alos, Date tzais) { * the Shulchan Aruch (Orach Chaim 426). It should be noted that some opinions hold that the * Rema who brings down the opinion of the Maharil's of calculating - * {@link #getSofZmanKidushLevanaBetweenMoldos(Date, Date) half way between molad and molad} is of + * {@link #getSofZmanKidushLevanaBetweenMoldos(Instant, Instant) half way between molad and molad} is of * the opinion that the Mechaber agrees to his opinion. Also see the Aruch Hashulchan. For additional details on the subject, * See Rabbi Dovid Heber's very detailed write-up in Siman Daled (chapter 4) of Shaarei * Zmanim. The sof zman Kiddush Levana will be returned even if it occurs during the day. To limit the time to - * between tzais and alos, see {@link #getSofZmanKidushLevana15Days(Date, Date)}. + * between tzais and alos, see {@link #getSofZmanKidushLevana15Days(Instant, Instant)}. * - * @return the Date representing the moment 15 days after the molad. If the time occurs between + * @return the Instant representing the moment 15 days after the molad. If the time occurs between * alos and tzais, alos will be returned. If the zman will not occur on this day, a * null will be returned. * - * @see #getSofZmanKidushLevana15Days(Date, Date) + * @see #getSofZmanKidushLevana15Days(Instant, Instant) * @see #getSofZmanKidushLevanaBetweenMoldos() * @see JewishCalendar#getSofZmanKidushLevana15Days() * */ - public Date getSofZmanKidushLevana15Days() { + public Instant getSofZmanKidushLevana15Days() { return getSofZmanKidushLevana15Days(null, null); } @@ -3391,15 +3195,15 @@ public Date getSofZmanKidushLevana15Days() { * Returns the earliest time of Kiddush Levana according to Rabbeinu Yonah's opinion that it can be said 3 days after the * molad. The time will be returned even if it occurs during the day when Kiddush Levana can't be said. - * Use {@link #getTchilasZmanKidushLevana3Days(Date, Date)} if you want to limit the time to night hours. + * Use {@link #getTchilasZmanKidushLevana3Days(Instant, Instant)} if you want to limit the time to night hours. * - * @return the Date representing the moment 3 days after the molad. If the zman will not occur on this day, a + * @return the Instant representing the moment 3 days after the molad. If the zman will not occur on this day, a * null will be returned. - * @see #getTchilasZmanKidushLevana3Days(Date, Date) + * @see #getTchilasZmanKidushLevana3Days(Instant, Instant) * @see #getTchilasZmanKidushLevana7Days() * @see JewishCalendar#getTchilasZmanKidushLevana3Days() */ - public Date getTchilasZmanKidushLevana3Days() { + public Instant getTchilasZmanKidushLevana3Days() { return getTchilasZmanKidushLevana3Days(null, null); } @@ -3407,29 +3211,27 @@ public Date getTchilasZmanKidushLevana3Days() { * Returns the earliest time of Kiddush Levana according to Rabbeinu Yonah's opinion that it can be said 3 days after the molad. * If the time of tchilas zman Kiddush Levana occurs during the day (between alos and tzais passed to - * this method) it will return the following tzais. If null is passed for either alos or tzais, the actual - * tchilas zman Kiddush Levana will be returned, regardless of if it is during the day or not. + * this method) it will return the following tzais. If null is passed for either alos or tzais, the + * actual tchilas zman Kiddush Levana will be returned, regardless of if it is during the day or not. * * @param alos - * the beginning of the Jewish day. If Kidush Levana occurs during the day (starting at alos and ending - * at tzais), the time returned will be tzais. If either the alos or tzais parameters + * the beginning of the Jewish day. If Kidush Levana occurs during the day (starting at alos and ending at + * tzais), the time returned will be tzais. If either the alos or tzais parameters * are null, no daytime adjustment will be made. * @param tzais * the end of the Jewish day. If Kidush Levana occurs during the day (starting at alos and ending at * tzais), the time returned will be tzais. If either the alos or tzais parameters * are null, no daytime adjustment will be made. * - * @return the Date representing the moment 3 days after the molad. If the time occurs between alos and + * @return the Instant representing the moment 3 days after the molad. If the time occurs between alos and * tzais, tzais will be returned. If the zman will not occur on this day, a * null will be returned. * @see #getTchilasZmanKidushLevana3Days() - * @see #getTchilasZmanKidushLevana7Days(Date, Date) + * @see #getTchilasZmanKidushLevana7Days(Instant, Instant) * @see JewishCalendar#getTchilasZmanKidushLevana3Days() */ - public Date getTchilasZmanKidushLevana3Days(Date alos, Date tzais) { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); + public Instant getTchilasZmanKidushLevana3Days(Instant alos, Instant tzais) { + JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate()); // Do not calculate for impossible dates, but account for extreme cases. Tchilas zman kiddush Levana 3 days for // the extreme case of Rapa Iti in French Polynesia on Dec 2027 when kiddush Levana 3 days can be said on the evening @@ -3440,12 +3242,12 @@ public Date getTchilasZmanKidushLevana3Days(Date alos, Date tzais) { return null; } - Date zman = getMoladBasedTime(jewishCalendar.getTchilasZmanKidushLevana3Days(), alos, tzais, true); + Instant zman = getMoladBasedTime(jewishCalendar.getTchilasZmanKidushLevana3Days(), alos, tzais, true); - //Get the following month's zman kiddush Levana for the extreme case of Rapa Iti in French Polynesia on Dec 2027 when - // kiddush Levana can be said on Rosh Chodesh (the evening of the 30th). See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (page 32) + // Get the following month's zman kiddush Levana for the extreme case of Rapa Iti in French Polynesia on Dec 2027 when kiddush + // Levana can be said on Rosh Chodesh (the evening of the 30th). See Rabbi Dovid Heber's Shaarei Zmanim chapter 4 (page 32) if (zman == null && jewishCalendar.getJewishDayOfMonth() == 30) { - jewishCalendar.forward(Calendar.MONTH, 1); + jewishCalendar.plusMonths(1); zman = getMoladBasedTime(jewishCalendar.getTchilasZmanKidushLevana3Days(), null, null, true); } @@ -3453,21 +3255,19 @@ public Date getTchilasZmanKidushLevana3Days(Date alos, Date tzais) { } /** - * Returns the point in time of Molad as a Date Object. For the traditional day of week, hour, - * minute and chalakim, {@link JewishCalendar#getMoladAsDate()} and the not yet completed + * Returns the point in time of Molad as a Instant Object. For the traditional day of week, hour, + * minute and chalakim, {@link JewishCalendar#getMoladAsInstant()} and the not yet completed * {@link com.kosherjava.zmanim.hebrewcalendar.HebrewDateFormatter} that will have formatting for this. * - * @return the Date representing the moment of the molad. If the molad does not occur on this day, a + * @return the Instant representing the moment of the molad. If the molad does not occur on this day, a * null will be returned. * * @see #getTchilasZmanKidushLevana3Days() - * @see #getTchilasZmanKidushLevana7Days(Date, Date) - * @see JewishCalendar#getMoladAsDate() + * @see #getTchilasZmanKidushLevana7Days(Instant, Instant) + * @see JewishCalendar#getMoladAsInstant() */ - public Date getZmanMolad() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); + public Instant getZmanMolad() { + JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate()); // Optimize to not calculate for impossible dates, but account for extreme cases. The molad in the extreme case of Rapa // Iti in French Polynesia on Dec 2027 occurs on the night of the 27th of Kislev. In the case of Anadyr, Russia on @@ -3475,50 +3275,20 @@ public Date getZmanMolad() { if (jewishCalendar.getJewishDayOfMonth() > 2 && jewishCalendar.getJewishDayOfMonth() < 27) { return null; } - Date molad = getMoladBasedTime(jewishCalendar.getMoladAsDate(), null, null, true); + Instant molad = getMoladBasedTime(jewishCalendar.getMoladAsInstant(), null, null, true); // deal with molad that happens on the end of the previous month if (molad == null && jewishCalendar.getJewishDayOfMonth() > 26) { - jewishCalendar.forward(Calendar.MONTH, 1); - molad = getMoladBasedTime(jewishCalendar.getMoladAsDate(), null, null, true); + jewishCalendar.plusMonths(1); + molad = getMoladBasedTime(jewishCalendar.getMoladAsInstant(), null, null, true); } return molad; } - - /** - * Used by Molad based zmanim to determine if zmanim occur during the current day. - * @see #getMoladBasedTime(Date, Date, Date, boolean) - * @return previous midnight - */ - private Date getMidnightLastNight() { - Calendar midnight = (Calendar)getCalendar().clone(); - // reset hour, minutes, seconds and millis - midnight.set(Calendar.HOUR_OF_DAY, 0); - midnight.set(Calendar.MINUTE, 0); - midnight.set(Calendar.SECOND, 0); - midnight.set(Calendar.MILLISECOND, 0); - return midnight.getTime(); - } - - /** - * Used by Molad based zmanim to determine if zmanim occur during the current day. - * @see #getMoladBasedTime(Date, Date, Date, boolean) - * @return following midnight - */ - private Date getMidnightTonight() { - Calendar midnight = (Calendar)getCalendar().clone(); - midnight.add(Calendar.DAY_OF_YEAR, 1);//roll to tonight - midnight.set(Calendar.HOUR_OF_DAY, 0); - midnight.set(Calendar.MINUTE, 0); - midnight.set(Calendar.SECOND, 0); - midnight.set(Calendar.MILLISECOND, 0); - return midnight.getTime(); - } /** * Returns the earliest time of Kiddush Levana according to the opinions that it should not be said until 7 * days after the molad. If the time of tchilas zman Kiddush Levana occurs during the day (between - * {@link ZmanimCalendar#getAlos72() alos} and {@link ZmanimCalendar#getTzais72() tzais}) it + * {@link #getAlos72Minutes() alos} and {@link #getTzais72Minutes() tzais}) it * return the next tzais. * * @param alos @@ -3530,17 +3300,15 @@ private Date getMidnightTonight() { * ending at tzais), the time returned will be tzais. If either the alos or * tzais parameters are null, no daytime adjustment will be made. * - * @return the Date representing the moment 7 days after the molad. If the time occurs between alos and + * @return the Instant representing the moment 7 days after the molad. If the time occurs between alos and * tzais, tzais will be returned. If the zman will not occur on this day, a * null will be returned. - * @see #getTchilasZmanKidushLevana3Days(Date, Date) + * @see #getTchilasZmanKidushLevana3Days(Instant, Instant) * @see #getTchilasZmanKidushLevana7Days() * @see JewishCalendar#getTchilasZmanKidushLevana7Days() */ - public Date getTchilasZmanKidushLevana7Days(Date alos, Date tzais) { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); + public Instant getTchilasZmanKidushLevana7Days(Instant alos, Instant tzais) { + JewishCalendar jewishCalendar = new JewishCalendar(getLocalDate()); // Optimize to not calculate for impossible dates, but account for extreme cases. Tchilas zman kiddush Levana 7 days for // the extreme case of Rapa Iti in French Polynesia on Jan 2028 (when kiddush Levana 3 days can be said on the evening @@ -3557,15 +3325,15 @@ public Date getTchilasZmanKidushLevana7Days(Date alos, Date tzais) { /** * Returns the earliest time of Kiddush Levana according to the opinions that it should not be said until 7 * days after the molad. The time will be returned even if it occurs during the day when Kiddush Levana - * can't be recited. Use {@link #getTchilasZmanKidushLevana7Days(Date, Date)} if you want to limit the time to night hours. + * can't be recited. Use {@link #getTchilasZmanKidushLevana7Days(Instant, Instant)} if you want to limit the time to night hours. * - * @return the Date representing the moment 7 days after the molad regardless of it is day or night. If the zman + * @return the Instant representing the moment 7 days after the molad regardless of it is day or night. If the zman * will not occur on this day, a null will be returned. - * @see #getTchilasZmanKidushLevana7Days(Date, Date) + * @see #getTchilasZmanKidushLevana7Days(Instant, Instant) * @see JewishCalendar#getTchilasZmanKidushLevana7Days() * @see #getTchilasZmanKidushLevana3Days() */ - public Date getTchilasZmanKidushLevana7Days() { + public Instant getTchilasZmanKidushLevana7Days() { return getTchilasZmanKidushLevana7Days(null, null); } @@ -3575,201 +3343,156 @@ public Date getTchilasZmanKidushLevana7Days() { * #getSofZmanTfilaGRA() Sof zman tfilah GRA} and is provided as a convenience method for those who are * unaware how this zman is calculated. This time is 4 hours into the day based on the opinion of the * GRA that the day is calculated from sunrise to sunset. - * This returns the time 4 * {@link #getShaahZmanisGra()} after {@link #getSeaLevelSunrise() sea level sunrise}. If it + * This returns the time 4 * {@link #getShaahZmanisGRA()} after {@link #getSeaLevelSunrise() sea level sunrise}. If it * is not erev Pesach, a null will be returned. - * - * @see ZmanimCalendar#getShaahZmanisGra() - * @see ZmanimCalendar#getSofZmanTfilaGRA() - * @return the Date one is allowed eating chametz on Erev Pesach. If it is not erev + * @return the Instant one is allowed eating chametz on Erev Pesach. If it is not erev * Pesach or 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 #getShaahZmanisGRA() + * @see #getSofZmanTfilaGRA() + * @see #getSofZmanAchilasChametz(Instant, Instant, boolean) */ - public Date getSofZmanAchilasChametzGRA() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getSofZmanTfilaGRA(); - } else { - return null; - } + public Instant getSofZmanAchilasChametzGRA() { + return getSofZmanAchilasChametz(getSunriseBasedOnElevationSetting(), getSunsetBasedOnElevationSetting(), true); } /** * This method returns the latest time one is allowed eating chametz on Erev Pesach according to the * opinion of the Magen Avraham (MGA) based on alos - * being {@link #getAlos72() 72} minutes before {@link #getSunrise() sunrise}. This time is identical to the - * {@link #getSofZmanTfilaMGA72Minutes() Sof zman tfilah MGA 72 minutes}. This time is 4 {@link #getShaahZmanisMGA() - * shaos zmaniyos} (temporal hours) after {@link #getAlos72() dawn} based on the opinion of the MGA that the day is - * calculated from a {@link #getAlos72() dawn} of 72 minutes before sunrise to {@link #getTzais72() nightfall} of 72 minutes - * after sunset. This returns the time of 4 * {@link #getShaahZmanisMGA()} after {@link #getAlos72() dawn}. If it is not - * erev Pesach, a null will be returned. - * - * @return the Date of the latest time of eating chametz. If it is not erev Pesach or the + * being {@link #getAlos72Minutes() 72} minutes before {@link #getSunset() sunrise}. This time is identical to the + * {@link #getSofZmanTfilaMGA72Minutes() Sof zman tfilah MGA 72 minutes}. This time is 4 {@link + * #getShaahZmanis72Minutes() shaos zmaniyos} (temporal hours) after {@link #getAlos72Minutes() dawn} based on the + * opinion of the MGA that the day is calculated from a {@link #getAlos72Minutes() dawn} of 72 minutes before sunrise to {@link + * #getTzais72Minutes() nightfall} of 72 minutes after sunset. This returns the time of 4 * {@link #getShaahZmanis72Minutes()} + * after {@link #getAlos72Minutes() dawn}. If it is not erev Pesach, a null will be returned. + * + * @return the Instant of the latest time of eating chametz. If it is not erev Pesach or 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 #getShaahZmanisMGA() - * @see #getAlos72() + * @see #getShaahZmanis72Minutes() + * @see #getAlos72Minutes() * @see #getSofZmanTfilaMGA72Minutes() + * @see #getSofZmanAchilasChametz(Instant, Instant, boolean) */ - public Date getSofZmanAchilasChametzMGA72Minutes() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getSofZmanTfilaMGA72Minutes(); - } else { - return null; - } + public Instant getSofZmanAchilasChametzMGA72Minutes() { + return getSofZmanAchilasChametz(getAlos72Minutes(), getTzais72Minutes(), true); } /** - * This method returns the latest time one is allowed eating chametz on Erev Pesach according to the - * opinion of the Magen Avraham (MGA) based on alos - * being {@link #getAlos72Zmanis() 72 zmaniyos} minutes before {@link #getSunrise() sunrise}. This time is identical to the - * {@link #getSofZmanTfilaMGA72MinutesZmanis() Sof zman tfilah MGA 72 minutes zmanis}. This time is 4 {@link #getShaahZmanis72MinutesZmanis() - * shaos zmaniyos} (temporal hours) after {@link #getAlos72() dawn} based on the opinion of the MGA that the day is - * calculated from a {@link #getAlos72Zmanis() dawn} of 72 minutes zmanis before sunrise to {@link #getTzais72Zmanis() nightfall} of 72 minutes zmanis - * after sunset. This returns the time of 4 * {@link #getShaahZmanis72MinutesZmanis()} after {@link #getAlos72Zmanis() dawn}. If it is not - * erev Pesach, a null will be returned. + * This method returns the latest time one is allowed eating chametz on Erev Pesach according to the opinion + * of the Magen Avraham (MGA) based on alos being {@link + * #getAlos72Zmanis() 72 zmaniyos} minutes before {@link #getSunset() sunrise}. This time is identical to the + * {@link #getSofZmanTfilaMGA72MinutesZmanis() Sof zman tfilah MGA 72 minutes zmanis}. This time is 4 {@link + * #getShaahZmanis72MinutesZmanis() shaos zmaniyos} (temporal hours) after {@link #getAlos72Minutes() dawn} based on the + * opinion of the MGA that the day is calculated from a {@link #getAlos72Zmanis() dawn} of 72 minutes zmanis before sunrise to + * {@link #getTzais72Zmanis() nightfall} of 72 minutes zmanis after sunset. This returns the time of 4 * {@link + * #getShaahZmanis72MinutesZmanis()} after {@link #getAlos72Zmanis() dawn}. If it is not erev Pesach, a null will be + * returned. * - * @return the Date of the latest time of eating chametz. If it is not erev Pesach or the + * @return the Instant of the latest time of eating chametz. If it is not erev Pesach or 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 #getShaahZmanis72MinutesZmanis() * @see #getAlos72Zmanis() * @see #getSofZmanTfilaMGA72MinutesZmanis() + * @see #getSofZmanAchilasChametz(Instant, Instant, boolean) */ - public Date getSofZmanAchilasChametzMGA72MinutesZmanis() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getSofZmanTfilaMGA72MinutesZmanis(); - } else { - return null; - } + public Instant getSofZmanAchilasChametzMGA72MinutesZmanis() { + return getSofZmanAchilasChametz(getAlos72Zmanis(), getTzais72Zmanis(), true); } /** * This method returns the latest time one is allowed eating chametz on Erev Pesach according to the * opinion of the Magen Avraham (MGA) based on alos - * being {@link #getAlos16Point1Degrees() 16.1°} before {@link #getSunrise() sunrise}. This time is 4 {@link - * #getShaahZmanis16Point1Degrees() shaos zmaniyos} (solar hours) after {@link #getAlos16Point1Degrees() dawn} - * based on the opinion of the MGA that the day is calculated from dawn to nightfall with both being 16.1° - * below sunrise or sunset. This returns the time of 4 {@link #getShaahZmanis16Point1Degrees()} after - * {@link #getAlos16Point1Degrees() dawn}. If it is not erev Pesach, a null will be returned. - * - * @return the Date of the latest time of eating chametz. If it is not erev Pesach or the - * calculation can't be computed such as northern and southern locations even south of the Arctic Circle and north - * of the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a + * being {@link #getAlos16Point1Degrees() 16.1°} before {@link #getSunset() sunrise}. This time is 4 {@link + * #getShaahZmanis16Point1Degrees() shaos zmaniyos} (solar hours) after {@link #getAlos16Point1Degrees() dawn} based + * on the opinion of the MGA that the day is calculated from dawn to nightfall with both being 16.1° below sunrise or + * sunset. This returns the time of 4 {@link #getShaahZmanis16Point1Degrees()} after {@link #getAlos16Point1Degrees() dawn}. + * If it is not erev Pesach, a null will be returned. + * + * @return the Instant of the latest time of eating chametz. If it is not erev Pesach or the + * calculation can't be computed such as northern and southern locations even south of the Arctic Circle and north of + * the Antarctic Circle where the sun may not reach low enough below the horizon for this calculation, a * null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. * @see #getShaahZmanis16Point1Degrees() * @see #getAlos16Point1Degrees() * @see #getSofZmanTfilaMGA16Point1Degrees() + * @see #getSofZmanAchilasChametz(Instant, Instant, boolean) */ - public Date getSofZmanAchilasChametzMGA16Point1Degrees() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getSofZmanTfilaMGA16Point1Degrees(); - } else { - return null; - } + public Instant getSofZmanAchilasChametzMGA16Point1Degrees() { + return getSofZmanAchilasChametz(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true); } /** - * FIXME adjust for synchronous * This method returns the latest time for burning chametz on Erev Pesach according to the opinion * of the GRA. This time is 5 hours into the day based on the * opinion of the GRA that the day is calculated from - * sunrise to sunset. This returns the time 5 * {@link #getShaahZmanisGra()} after {@link #getSeaLevelSunrise() sea + * sunrise to sunset. This returns the time 5 * {@link #getShaahZmanisGRA()} after {@link #getSeaLevelSunrise() sea * level sunrise}. If it is not erev Pesach, a null will be returned. - * @see ZmanimCalendar#getShaahZmanisGra() - * @return the Date of the latest time for burning chametz on Erev Pesach. If it is not + * @return the Instant of the latest time for burning chametz on Erev Pesach. If it is not * erev Pesach or 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 #getShaahZmanisGRA() + * @see #getSofZmanBiurChametz(Instant, Instant, boolean) */ - public Date getSofZmanBiurChametzGRA() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getTimeOffset(getElevationAdjustedSunrise(), getShaahZmanisGra() * 5); - } else { - return null; - } + public Instant getSofZmanBiurChametzGRA() { + return getSofZmanBiurChametz(getSunriseBasedOnElevationSetting(), getSunsetBasedOnElevationSetting(), true); } /** - * FIXME adjust for synchronous - * This method returns the latest time for burning chametz on Erev Pesach according to the opinion of - * the Magen Avraham (MGA) based on alos - * being {@link #getAlos72() 72} minutes before {@link #getSunrise() sunrise}. This time is 5 {@link - * #getShaahZmanisMGA() shaos zmaniyos} (temporal hours) after {@link #getAlos72() dawn} based on the opinion of - * the MGA that the day is calculated from a {@link #getAlos72() dawn} of 72 minutes before sunrise to {@link - * #getTzais72() nightfall} of 72 minutes after sunset. This returns the time of 5 * {@link #getShaahZmanisMGA()} after - * {@link #getAlos72() dawn}. If it is not erev Pesach, a null will be returned. - * @return the Date of the latest time for burning chametz on Erev Pesach. If it is not + * This method returns the latest time for burning chametz on Erev Pesach according to the opinion of the + * Magen Avraham (MGA) based on alos being {@link + * #getAlos72Minutes() 72} minutes before {@link #getSunset() sunrise}. This time is 5 {@link + * #getShaahZmanis72Minutes() shaos zmaniyos} (temporal hours) after {@link #getAlos72Minutes() dawn} based on the + * opinion of the MGA that the day is calculated from a {@link #getAlos72Minutes() dawn} of 72 minutes before sunrise to {@link + * #getTzais72Minutes() nightfall} of 72 minutes after sunset. This returns the time of 5 * {@link #getShaahZmanis72Minutes()} + * after {@link #getAlos72Minutes() dawn}. If it is not erev Pesach, a null will be returned. + * @return the Instant of the latest time for burning chametz on Erev Pesach. If it is not * erev Pesach or 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 #getShaahZmanisMGA() - * @see #getAlos72() - */ - public Date getSofZmanBiurChametzMGA72Minutes() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getTimeOffset(getAlos72(), getShaahZmanisMGA() * 5); - } else { - return null; - } + * @see #getShaahZmanis72Minutes() + * @see #getAlos72Minutes() + * @see #getSofZmanBiurChametz(Instant, Instant, boolean) + */ + public Instant getSofZmanBiurChametzMGA72Minutes() { + return getSofZmanBiurChametz(getAlos72Minutes(), getTzais72Minutes(), true); } /** - * FIXME adjust for synchronous - * This method returns the latest time for burning chametz on Erev Pesach according to the opinion of - * the Magen Avraham (MGA) based on alos - * being {@link #getAlos72Zmanis() 72} minutes zmanis before {@link #getSunrise() sunrise}. This time is 5 {@link - * #getShaahZmanis72MinutesZmanis() shaos zmaniyos} (temporal hours) after {@link #getAlos72Zmanis() dawn} based on the opinion of - * the MGA that the day is calculated from a {@link #getAlos72Zmanis() dawn} of 72 minutes zmanis before sunrise to {@link - * #getTzais72Zmanis() nightfall} of 72 minutes zmanis after sunset. This returns the time of 5 * {@link #getShaahZmanis72MinutesZmanis()} after - * {@link #getAlos72Zmanis() dawn}. If it is not erev Pesach, a null will be returned. - * @return the Date of the latest time for burning chametz on Erev Pesach. If it is not + * This method returns the latest time for burning chametz on Erev Pesach according to the opinion of the + * Magen Avraham (MGA) based on alos being {@link + * #getAlos72Zmanis() 72} minutes zmanis before {@link #getSunset() sunrise}. This time is 5 {@link + * #getShaahZmanis72MinutesZmanis() shaos zmaniyos} (temporal hours) after {@link #getAlos72Zmanis() dawn} based on the + * opinion of the MGA that the day is calculated from a {@link #getAlos72Zmanis() dawn} of 72 minutes zmanis before sunrise to + * {@link #getTzais72Zmanis() nightfall} of 72 minutes zmanis after sunset. This returns the time of 5 * {@link + * #getShaahZmanis72MinutesZmanis()} after {@link #getAlos72Zmanis() dawn}. If it is not erev Pesach, a null will be + * returned. + * @return the Instant of the latest time for burning chametz on Erev Pesach. If it is not * erev Pesach or 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 #getShaahZmanis72MinutesZmanis() * @see #getAlos72Zmanis() + * @see #getSofZmanBiurChametz(Instant, Instant, boolean) */ - public Date getSofZmanBiurChametzMGA72MinutesZmanis() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getTimeOffset(getAlos72Zmanis(), getShaahZmanis72MinutesZmanis() * 5); - } else { - return null; - } + public Instant getSofZmanBiurChametzMGA72MinutesZmanis() { + return getSofZmanBiurChametz(getAlos72Zmanis(), getTzais72Zmanis(), true); } /** - * FIXME adjust for synchronous * This method returns the latest time for burning chametz on Erev Pesach according to the opinion * of the Magen Avraham (MGA) based on alos - * being {@link #getAlos16Point1Degrees() 16.1°} before {@link #getSunrise() sunrise}. This time is 5 + * being {@link #getAlos16Point1Degrees() 16.1°} before {@link #getSunset() sunrise}. This time is 5 * {@link #getShaahZmanis16Point1Degrees() shaos zmaniyos} (solar hours) after {@link #getAlos16Point1Degrees() * dawn} based on the opinion of the MGA that the day is calculated from dawn to nightfall with both being 16.1° * below sunrise or sunset. This returns the time of 5 {@link #getShaahZmanis16Point1Degrees()} after * {@link #getAlos16Point1Degrees() dawn}. If it is not erev Pesach, a null will be returned. - * @return the Date of the latest time for burning chametz on Erev Pesach. If it is not + * @return the Instant of the latest time for burning chametz on Erev Pesach. If it is not * erev Pesach or the calculation can't be computed such as northern and southern locations even south * of the Arctic Circle and north of the Antarctic Circle where the sun may not reach low enough below the * horizon for this calculation, a null will be returned. See detailed explanation on top of the @@ -3777,95 +3500,20 @@ public Date getSofZmanBiurChametzMGA72MinutesZmanis() { * * @see #getShaahZmanis16Point1Degrees() * @see #getAlos16Point1Degrees() + * @see #getSofZmanBiurChametz(Instant, Instant, boolean) */ - public Date getSofZmanBiurChametzMGA16Point1Degrees() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getTimeOffset(getAlos16Point1Degrees(), getShaahZmanis16Point1Degrees() * 5); - } else { - return null; - } + public Instant getSofZmanBiurChametzMGA16Point1Degrees() { + return getSofZmanBiurChametz(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true); } /** * A method that returns the Baal Hatanya's - * netz amiti (sunrise) without {@link AstronomicalCalculator#getElevationAdjustment(double) - * elevation adjustment}. This forms the base for the Baal Hatanya's dawn-based calculations that are - * calculated as a dip below the horizon before sunrise. - * - * According to the Baal Hatanya, netz amiti, or true (halachic) sunrise, is when the top of the sun's - * disk is visible at an elevation similar to the mountains of Eretz Yisrael. The time is calculated as the point at which - * the center of the sun's disk is 1.583° below the horizon. This degree-based calculation can be found in Rabbi Shalom - * DovBer Levine's commentary on The Baal - * Hatanya's Seder Hachnasas Shabbos. From an elevation of 546 meters, the top of Har Hacarmel, the sun disappears when it is 1° 35' or 1.583° - * below the sea level horizon. This in turn is based on the Gemara Shabbos 35a. There are other opinions brought down by - * Rabbi Levine, including Rabbi Yosef Yitzchok Feigelstock who calculates it as the degrees below the horizon 4 minutes after - * sunset in Yerushalayim (on the equinox). That is brought down as 1.583°. This is identical to the 1° 35' zman - * and is probably a typo and should be 1.683°. These calculations are used by most Chabad calendars that use the Baal Hatanya's zmanim. See - * About Our - * Zmanim Calculations @ Chabad.org. - * - * Note: netz amiti is used only for calculating certain zmanim, and is intentionally unpublished. For - * practical purposes, daytime mitzvos like shofar and lulav should not be done until after the - * published time for netz / sunrise. - * - * @return the Date representing the exact sea level netz amiti (sunrise) 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, a null will be returned. See detailed explanation on top of the page. - * - * @see #getSunrise() - * @see #getSeaLevelSunrise() - * @see #getSunsetBaalHatanya() - * @see #ZENITH_1_POINT_583 - */ - private Date getSunriseBaalHatanya() { - return getSunriseOffsetByDegrees(ZENITH_1_POINT_583); - } - - /** - * A method that returns the Baal Hatanya's - * shkiah amiti (sunset) without {@link AstronomicalCalculator#getElevationAdjustment(double) - * elevation adjustment}. This forms the base for the Baal Hatanya's dusk-based calculations that are calculated - * as a dip below the horizon after sunset. - * - * According to the Baal Hatanya, shkiah amiti, true (halachic) sunset, is when the top of the - * sun's disk disappears from view at an elevation similar to the mountains of Eretz Yisrael. - * This time is calculated as the point at which the center of the sun's disk is 1.583 degrees below the horizon. - * - * Note: shkiah amiti is used only for calculating certain zmanim, and is intentionally unpublished. For - * practical purposes, all daytime mitzvos should be completed before the published time for shkiah / sunset. - * - * For further explanation of the calculations used for the Baal Hatanya's zmanim in this library, see - * About Our - * Zmanim Calculations @ Chabad.org. - * - * @return the Date representing the exact sea level shkiah amiti (sunset) 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, a null will be returned. See detailed explanation on top of - * the {@link AstronomicalCalendar} documentation. - * - * @see #getSunset() - * @see #getSeaLevelSunset() - * @see #getSunriseBaalHatanya() - * @see #ZENITH_1_POINT_583 - */ - private Date getSunsetBaalHatanya() { - return getSunsetOffsetByDegrees(ZENITH_1_POINT_583); - } - - /** - * A method that returns the Baal Hatanya's - * a shaah zmanis ({@link #getTemporalHour(Date, Date) temporal hour}). This forms the base for the + * a shaah zmanis ({@link #getTemporalHour(Instant, Instant) temporal hour}). This forms the base for the * Baal Hatanya's day based calculations that are calculated as a 1.583° dip below the horizon after sunset. * According to the Baal Hatanya, shkiah amiti, true (halachic) sunset, is when the top of the * sun's disk disappears from view at an elevation similar to the mountains of Eretz Yisrael. * This time is calculated as the point at which the center of the sun's disk is 1.583 degrees below the horizon. - * A method that returns a shaah zmanis ({@link #getTemporalHour(Date, Date) temporal hour}) calculated + * A method that returns a shaah zmanis ({@link #getTemporalHour(Instant, Instant) temporal hour}) calculated * based on the Baal Hatanya's netz * amiti and shkiah amiti using a dip of 1.583° below the sea level horizon. This calculation divides * the day based on the opinion of the Baal Hatanya that the day runs from {@link #getSunriseBaalHatanya() netz amiti} @@ -3879,10 +3527,10 @@ private Date getSunsetBaalHatanya() { * year where the sun does not rise, and one where it does not set, {@link Long#MIN_VALUE} will be returned. See * detailed explanation on top of the {@link AstronomicalCalendar} documentation. * - * @see #getTemporalHour(Date, Date) + * @see #getTemporalHour(Instant, Instant) * @see #getSunriseBaalHatanya() * @see #getSunsetBaalHatanya() - * @see #ZENITH_1_POINT_583 + * @see ZENITH_1_POINT_583 */ public long getShaahZmanisBaalHatanya() { return getTemporalHour(getSunriseBaalHatanya(), getSunsetBaalHatanya()); @@ -3890,16 +3538,20 @@ public long getShaahZmanisBaalHatanya() { /** * Returns the Baal Hatanya's alos - * (dawn) calculated as the time when the sun is 16.9° below the eastern {@link #GEOMETRIC_ZENITH geometric horizon} - * before {@link #getSunrise() sunrise}. For more information the source of 16.9° see {@link #ZENITH_16_POINT_9}. + * (dawn) calculated as the time when the sun is 16.9° below the eastern {@link GEOMETRIC_ZENITH geometric horizon} + * before {@link #getSunset() sunrise}. It is based on the calculation that the time between dawn and + * netz amiti (sunrise) is 72 minutes, the time that is takes to walk 4 mil at 18 minutes + * a mil (Rambam and others). The sun's position at 72 + * minutes before {@link #getSunriseBaalHatanya netz amiti (sunrise)} in Jerusalem around the equinox / equilux is + * 16.9° below {@link GEOMETRIC_ZENITH geometric zenith}. * - * @see #ZENITH_16_POINT_9 - * @return The Date of dawn. If the calculation can't be computed such as northern and southern + * @return The Instant of dawn. If the calculation can't be computed such as northern and southern * locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may not reach * low enough below the horizon for this calculation, a null will be returned. See detailed * explanation on top of the {@link AstronomicalCalendar} documentation. */ - public Date getAlosBaalHatanya() { + public Instant getAlosBaalHatanya() { return getSunriseOffsetByDegrees(ZENITH_16_POINT_9); } @@ -3910,14 +3562,14 @@ public Date getAlosBaalHatanya() { * sunrise to sunset. This returns the time 3 * {@link #getShaahZmanisBaalHatanya()} after {@link #getSunriseBaalHatanya() * netz amiti (sunrise)}. * - * @see ZmanimCalendar#getSofZmanShma(Date, Date) + * @see #getSofZmanShma(Instant, Instant) * @see #getShaahZmanisBaalHatanya() - * @return the Date of the latest zman shema according to the Baal Hatanya. If the calculation + * @return the Instant of the latest zman shema according to the Baal Hatanya. 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 getSofZmanShmaBaalHatanya() { + public Instant getSofZmanShmaBaalHatanya() { return getSofZmanShma(getSunriseBaalHatanya(), getSunsetBaalHatanya(), true); } @@ -3927,14 +3579,14 @@ public Date getSofZmanShmaBaalHatanya() { * calculated from sunrise to sunset. This returns the time 4 * {@link #getShaahZmanisBaalHatanya()} after * {@link #getSunriseBaalHatanya() netz amiti (sunrise)}. * - * @see ZmanimCalendar#getSofZmanTfila(Date, Date) + * @see #getSofZmanTfila(Instant, Instant) * @see #getShaahZmanisBaalHatanya() - * @return the Date of the latest zman tfilah. If the calculation can't be computed such as in + * @return the Instant of the latest zman tfilah. 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 getSofZmanTfilaBaalHatanya() { + public Instant getSofZmanTfilaBaalHatanya() { return getSofZmanTfila(getSunriseBaalHatanya(), getSunsetBaalHatanya(), true); } @@ -3945,22 +3597,16 @@ public Date getSofZmanTfilaBaalHatanya() { * is calculated from sunrise to sunset. This returns the time 4 {@link #getShaahZmanisBaalHatanya()} after * {@link #getSunriseBaalHatanya() netz amiti (sunrise)}. If it is not erev Pesach, a null will be * returned. - * @see #getShaahZmanisBaalHatanya() - * @see #getSofZmanTfilaBaalHatanya() - * @return the Date one is allowed eating chametz on Erev Pesach. If it is not erev + * @return the Instant one is allowed eating chametz on Erev Pesach. If it is not erev * Pesach or 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 #getShaahZmanisBaalHatanya() + * @see #getSofZmanTfilaBaalHatanya() + * @see #getSofZmanAchilasChametz(Instant, Instant, boolean) */ - public Date getSofZmanAchilasChametzBaalHatanya() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getSofZmanTfilaBaalHatanya(); - } else { - return null; - } + public Instant getSofZmanAchilasChametzBaalHatanya() { + return getSofZmanAchilasChametz(getSunriseBaalHatanya(), getSunsetBaalHatanya(), true); } /** @@ -3968,21 +3614,15 @@ public Date getSofZmanAchilasChametzBaalHatanya() { * the Baal Hatanya. This time is 5 hours into the day based on the opinion of the Baal Hatanya that the day is calculated * from sunrise to sunset. This returns the time 5 * {@link #getShaahZmanisBaalHatanya()} after * {@link #getSunriseBaalHatanya() netz amiti (sunrise)}. If it is not erev Pesach, a null will be returned. - * @see #getShaahZmanisBaalHatanya() - * @return the Date of the latest time for burning chametz on Erev Pesach. If it is not + * @return the Instant of the latest time for burning chametz on Erev Pesach. If it is not * erev Pesach or 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 #getShaahZmanisBaalHatanya() + * @see #getSofZmanBiurChametz(Instant, Instant, boolean) */ - public Date getSofZmanBiurChametzBaalHatanya() { - JewishCalendar jewishCalendar = new JewishCalendar(); - jewishCalendar.setGregorianDate(getCalendar().get(Calendar.YEAR), getCalendar().get(Calendar.MONTH), - getCalendar().get(Calendar.DAY_OF_MONTH)); - if (jewishCalendar.getJewishMonth() == JewishCalendar.NISSAN && jewishCalendar.getJewishDayOfMonth() == 14) { - return getTimeOffset(getSunriseBaalHatanya(), getShaahZmanisBaalHatanya() * 5); - } else { - return null; - } + public Instant getSofZmanBiurChametzBaalHatanya() { + return getSofZmanBiurChametz(getSunriseBaalHatanya(), getSunsetBaalHatanya(), true); } /** @@ -3997,43 +3637,20 @@ public Date getSofZmanBiurChametzBaalHatanya() { * on the opinion of the Baal Hatanya that the day is calculated from sunrise to sunset. This returns the time 6.5 * * {@link #getShaahZmanisBaalHatanya()} after {@link #getSunriseBaalHatanya() netz amiti ("real" sunrise)}. * @todo Consider adjusting this to calculate the time as 30 clock or zmaniyos minutes after either {@link - * #getSunTransit() astronomical chatzos} or {@link #getChatzosAsHalfDay() chatzos as half a day} - * for {@link AstronomicalCalculator calculators} that support it, based on {@link #isUseAstronomicalChatzos()}. - * @see #getMinchaGedola(Date, Date) + * getSunTransit() astronomical chatzos} or {@link #getChatzosHayomAsHalfDay() chatzos as half a + * day} for {@link AstronomicalCalculator calculators} that support it, based on {@link #isUseAstronomicalChatzos()}. + * @see #getMinchaGedola(Instant, Instant) * @see #getShaahZmanisBaalHatanya() * @see #getMinchaKetanaBaalHatanya() - * @return the Date of the time of mincha gedola according to the Baal Hatanya. If the calculation + * @return the Instant of the time of mincha gedola according to the Baal Hatanya. 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 getMinchaGedolaBaalHatanya() { + public Instant getMinchaGedolaBaalHatanya() { return getMinchaGedola(getSunriseBaalHatanya(), getSunsetBaalHatanya(), true); } - /** - * FIXME synchronous - * This is a convenience method that returns the later of {@link #getMinchaGedolaBaalHatanya()} and - * {@link #getMinchaGedola30Minutes()}. In the winter when 1/2 of a {@link #getShaahZmanisBaalHatanya() - * shaah zmanis} is less than 30 minutes {@link #getMinchaGedola30Minutes()} will be returned, otherwise - * {@link #getMinchaGedolaBaalHatanya()} will be returned. - * @todo Consider adjusting this to calculate the time as 30 clock or zmaniyos minutes after either {@link - * #getSunTransit() astronomical chatzos} or {@link #getChatzosAsHalfDay() chatzos as half a day} - * for {@link AstronomicalCalculator calculators} that support it, based on {@link #isUseAstronomicalChatzos()}. - * @return the Date of the later of {@link #getMinchaGedolaBaalHatanya()} and {@link #getMinchaGedola30Minutes()}. - * 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 getMinchaGedolaBaalHatanyaGreaterThan30() { - if (getMinchaGedola30Minutes() == null || getMinchaGedolaBaalHatanya() == null) { - return null; - } else { - return getMinchaGedola30Minutes().compareTo(getMinchaGedolaBaalHatanya()) > 0 ? getMinchaGedola30Minutes() - : getMinchaGedolaBaalHatanya(); - } - } - /** * This method returns the time of mincha ketana. This is the preferred earliest time to pray * mincha in the opinion of the Rambam and others. @@ -4043,46 +3660,58 @@ public Date getMinchaGedolaBaalHatanyaGreaterThan30() { * day is calculated from sunrise to sunset. This returns the time 9.5 * {@link #getShaahZmanisBaalHatanya()} after {@link * #getSunriseBaalHatanya() netz amiti (sunrise)}. * - * @see #getMinchaKetana(Date, Date) + * @see #getMinchaKetana(Instant, Instant) * @see #getShaahZmanisBaalHatanya() * @see #getMinchaGedolaBaalHatanya() - * @return the Date of the time of mincha ketana. If the calculation can't be computed such as + * @return the Instant of the time of mincha ketana. 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 getMinchaKetanaBaalHatanya() { + public Instant getMinchaKetanaBaalHatanya() { return getMinchaKetana(getSunriseBaalHatanya(), getSunsetBaalHatanya(), true); } /** - * This method returns the time of plag hamincha. This is calculated as 10.75 hours after sunrise. This - * calculation is based on the opinion of the Baal Hatanya that the day is calculated - * from sunrise to sunset. This returns the time 10.75 * {@link #getShaahZmanisBaalHatanya()} after - * {@link #getSunriseBaalHatanya() netz amiti (sunrise)}. + * This method returns the time of plag hamincha. This is calculated as 10.75 hours after sunrise. This calculation + * is based on the opinion of the Baal Hatanya that the day is calculated from sunrise to sunset. This returns the time + * 10.75 * {@link #getShaahZmanisBaalHatanya()} after {@link #getSunriseBaalHatanya() netz amiti (sunrise)}. See + * About Our + * Zmanim Calculations @ Chabad.org for more details on this calculation. * - * @see #getPlagHamincha(Date, Date) - * @return the Date of the time of plag hamincha. If the calculation can't be computed such as + * @see #getPlagHamincha(Instant, Instant) + * @return the Instant of the time of plag hamincha. 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 getPlagHaminchaBaalHatanya() { + public Instant getPlagHaminchaBaalHatanya() { return getPlagHamincha(getSunriseBaalHatanya(), getSunsetBaalHatanya(), true); } /** - * A method that returns tzais (nightfall) when the sun is 6° below the western geometric horizon - * (90°) after {@link #getSunset() sunset}. For information on the source of this calculation see - * {@link #ZENITH_6_DEGREES}. - * - * @return The Date of nightfall. If the calculation can't be computed such as northern and southern + * A method that returns tzais (nightfall) when the sun is 6° below the western geometric horizon (90°) + * after {@link #getSunset() sunset}. This tzais / nightfall based on the opinion of the Baal Hatanya. This calculation is based on the position of the + * sun about 24 minutes after {@link #getSeaLevelSunset() sunset} in Jerusalem around the equinox / equilux, which + * is 6° below {@link GEOMETRIC_ZENITH geometric zenith}. See About Our Zmanim + * Calculations @ Chabad.org that is based on {@link #getSunsetBaalHatanya() shkiah amitis as + * 1.583° below the horizon} calculated around the equinox / equilux that computes 3.516 minutes after sunset. To this, 18 minutes of 3/4 of a 24-minute mil and + * two minutes for bain hashmashos of Rav Yosi is added. This calculation computes the the sun being 5.83° below + * the horizon (very close to the slightly later {@link #getTzaisGeonim5Point95Degrees()} that was calculated based on 4 fixed + * minutes) and it is rounded up to 6°. + * + * @return The Instant of nightfall. If the calculation can't be computed such as northern and southern * locations even south of the Arctic Circle and north of the Antarctic Circle where the sun may not reach * low enough below the horizon for this calculation, a null will be returned. See detailed * explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #ZENITH_6_DEGREES + * @see #getTzaisGeonim5Point95Degrees() + * @see #getSunsetBaalHatanya() */ - public Date getTzaisBaalHatanya() { + public Instant getTzaisBaalHatanya() { return getSunsetOffsetByDegrees(ZENITH_6_DEGREES); } @@ -4091,39 +3720,39 @@ public Date getTzaisBaalHatanya() { * calculation of sof zman krias shema (latest time to recite Shema in the morning) according to the * opinion of the Magen Avraham (MGA) that the * day is calculated from dawn to nightfall, but calculated using the first half of the day only. The half a day starts - * at alos defined as {@link #getAlos18Degrees() 18°} and ends at {@link #getFixedLocalChatzos() fixed local + * at alos defined as {@link #getAlos18Degrees() 18°} and ends at {@link #getFixedLocalChatzosHayom() fixed local * chatzos}. Sof Zman Shema is 3 shaos zmaniyos (solar hours) after alos or half of this half-day. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. * @see #getAlos18Degrees() - * @see #getFixedLocalChatzos() - * @see ZmanimCalendar#getHalfDayBasedZman(Date, Date, double) + * @see #getFixedLocalChatzosHayom() + * @see #getHalfDayBasedZman(Instant, Instant, double) */ - public Date getSofZmanShmaMGA18DegreesToFixedLocalChatzos() { - return getHalfDayBasedZman(getAlos18Degrees(), getFixedLocalChatzos(), 3); + public Instant getSofZmanShmaMGA18DegreesToFixedLocalChatzos() { + return getHalfDayBasedZman(getAlos18Degrees(), getFixedLocalChatzosHayom(), 3); } /** * This method returns Rav Moshe Feinstein's opinion of the * calculation of sof zman krias shema (latest time to recite Shema in the morning) according to the - * opinion of the Magen Avraham (MGA) that the - * day is calculated from dawn to nightfall, but calculated using the first half of the day only. The half a day starts - * at alos defined as {@link #getAlos16Point1Degrees() 16.1°} and ends at {@link #getFixedLocalChatzos() fixed local - * chatzos}. Sof Zman Shema is 3 shaos zmaniyos (solar hours) after this alos or half of this half-day. + * opinion of the Magen Avraham (MGA) that the day is calculated + * from dawn to nightfall, but calculated using the first half of the day only. The half a day starts at alos defined + * as {@link #getAlos16Point1Degrees() 16.1°} and ends at {@link #getFixedLocalChatzosHayom() fixed local chatzos}. Sof Zman + * Shema is 3 shaos zmaniyos (solar hours) after this alos or half of this half-day. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be returned. * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. * @see #getAlos16Point1Degrees() - * @see #getFixedLocalChatzos() - * @see #getHalfDayBasedZman(Date, Date, double) + * @see #getFixedLocalChatzosHayom() + * @see #getHalfDayBasedZman(Instant, Instant, double) */ - public Date getSofZmanShmaMGA16Point1DegreesToFixedLocalChatzos() { - return getHalfDayBasedZman(getAlos16Point1Degrees(), getFixedLocalChatzos(), 3); + public Instant getSofZmanShmaMGA16Point1DegreesToFixedLocalChatzos() { + return getHalfDayBasedZman(getAlos16Point1Degrees(), getFixedLocalChatzosHayom(), 3); } /** @@ -4131,20 +3760,20 @@ public Date getSofZmanShmaMGA16Point1DegreesToFixedLocalChatzos() { * calculation of sof zman krias shema (latest time to recite Shema in the morning) according to the * opinion of the Magen Avraham (MGA) that the * day is calculated from dawn to nightfall, but calculated using the first half of the day only. The half a day starts - * at alos defined as {@link #getAlos90() 90 minutes before sunrise} and ends at {@link #getFixedLocalChatzos() + * at alos defined as {@link #getAlos90Minutes() 90 minutes before sunrise} and ends at {@link #getFixedLocalChatzosHayom() * fixed local chatzos}. Sof Zman Shema is 3 shaos zmaniyos (solar hours) after this alos or * half of this half-day. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #getAlos90() - * @see #getFixedLocalChatzos() - * @see #getHalfDayBasedZman(Date, Date, double) + * @see #getAlos90Minutes() + * @see #getFixedLocalChatzosHayom() + * @see #getHalfDayBasedZman(Instant, Instant, double) */ - public Date getSofZmanShmaMGA90MinutesToFixedLocalChatzos() { - return getHalfDayBasedZman(getAlos90(), getFixedLocalChatzos(), 3); + public Instant getSofZmanShmaMGA90MinutesToFixedLocalChatzos() { + return getHalfDayBasedZman(getAlos90Minutes(), getFixedLocalChatzosHayom(), 3); } /** @@ -4152,40 +3781,40 @@ public Date getSofZmanShmaMGA90MinutesToFixedLocalChatzos() { * calculation of sof zman krias shema (latest time to recite Shema in the morning) according to the * opinion of the Magen Avraham (MGA) that the * day is calculated from dawn to nightfall, but calculated using the first half of the day only. The half a day starts - * at alos defined as {@link #getAlos72() 72 minutes before sunrise} and ends at {@link #getFixedLocalChatzos() + * at alos defined as {@link #getAlos72Minutes() 72 minutes before sunrise} and ends at {@link #getFixedLocalChatzosHayom() * fixed local chatzos}. Sof Zman Shema is 3 shaos zmaniyos (solar hours) after this alos or * half of this half-day. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #getAlos72() - * @see #getFixedLocalChatzos() - * @see #getHalfDayBasedZman(Date, Date, double) + * @see #getAlos72Minutes() + * @see #getFixedLocalChatzosHayom() + * @see #getHalfDayBasedZman(Instant, Instant, double) */ - public Date getSofZmanShmaMGA72MinutesToFixedLocalChatzos() { - return getHalfDayBasedZman(getAlos72(), getFixedLocalChatzos(), 3); + public Instant getSofZmanShmaMGA72MinutesToFixedLocalChatzos() { + return getHalfDayBasedZman(getAlos72Minutes(), getFixedLocalChatzosHayom(), 3); } /** * This method returns Rav Moshe Feinstein's opinion of the - * calculation of sof zman krias shema (latest time to recite Shema in the morning) according to the - * opinion of the GRA that the day is calculated from - * sunrise to sunset, but calculated using the first half of the day only. The half a day starts at {@link #getSunrise() - * sunrise} and ends at {@link #getFixedLocalChatzos() fixed local chatzos}. Sof zman Shema is 3 shaos - * zmaniyos (solar hours) after sunrise or half of this half-day. + * calculation of sof zman krias shema (latest time to recite Shema in the morning) according to the opinion + * of the GRA that the day is calculated from sunrise to sunset, but + * calculated using the first half of the day only. The half a day starts at {@link #getSunset() sunrise} and + * ends at {@link #getFixedLocalChatzosHayom() fixed local chatzos}. Sof zman Shema is 3 shaos zmaniyos (solar + * hours) after sunrise or half of this half-day. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #getSunrise() - * @see #getFixedLocalChatzos() - * @see #getHalfDayBasedZman(Date, Date, double) + * @see #getSunset() + * @see #getFixedLocalChatzosHayom() + * @see #getHalfDayBasedZman(Instant, Instant, double) */ - public Date getSofZmanShmaGRASunriseToFixedLocalChatzos() { - return getHalfDayBasedZman(getElevationAdjustedSunrise(), getFixedLocalChatzos(), 3); + public Instant getSofZmanShmaGRASunriseToFixedLocalChatzos() { + return getHalfDayBasedZman(getSunriseBasedOnElevationSetting(), getFixedLocalChatzosHayom(), 3); } /** @@ -4193,38 +3822,38 @@ public Date getSofZmanShmaGRASunriseToFixedLocalChatzos() { * calculation of sof zman tfila (zman tfilah (the latest time to recite the morning prayers)) * according to the opinion of the GRA that the day is * calculated from sunrise to sunset, but calculated using the first half of the day only. The half a day starts at - * {@link #getSunrise() sunrise} and ends at {@link #getFixedLocalChatzos() fixed local chatzos}. Sof zman tefila - * is 4 shaos zmaniyos (solar hours) after sunrise or 2/3 of this half-day. + * {@link #getSunset() sunrise} and ends at {@link #getFixedLocalChatzosHayom() fixed local chatzos}. Sof zman + * tefila is 4 shaos zmaniyos (solar hours) after sunrise or 2/3 of this half-day. * - * @return the Date of the latest zman krias shema. If the calculation can't be computed such + * @return the Instant of the latest zman krias shema. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. - * @see #getSunrise() - * @see #getFixedLocalChatzos() - * @see #getHalfDayBasedZman(Date, Date, double) + * @see #getSunset() + * @see #getFixedLocalChatzosHayom() + * @see #getHalfDayBasedZman(Instant, Instant, double) */ - public Date getSofZmanTfilaGRASunriseToFixedLocalChatzos() { - return getHalfDayBasedZman(getElevationAdjustedSunrise(), getFixedLocalChatzos(), 4); + public Instant getSofZmanTfilaGRASunriseToFixedLocalChatzos() { + return getHalfDayBasedZman(getSunriseBasedOnElevationSetting(), getFixedLocalChatzosHayom(), 4); } /** * This method returns Rav Moshe Feinstein's opinion of * the calculation of mincha gedola, the earliest time one can pray mincha according to theGRA calculated as 30 minutes after {@link #getFixedLocalChatzos() fixed + * "https://en.wikipedia.org/wiki/Vilna_Gaon">GRA calculated as 30 minutes after {@link #getFixedLocalChatzosHayom() fixed * local chatzos}. * - * @return the Date of the time of mincha gedola. If the calculation can't be computed such as + * @return the Instant of the time of mincha gedola. 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() - * @see #getFixedLocalChatzos() + * @see #getMinchaGedolaGRA() + * @see #getFixedLocalChatzosHayom() * @see #getMinchaKetanaGRAFixedLocalChatzosToSunset */ - public Date getMinchaGedolaGRAFixedLocalChatzos30Minutes() { - return getTimeOffset(getFixedLocalChatzos(), MINUTE_MILLIS * 30); + public Instant getMinchaGedolaGRAFixedLocalChatzos30Minutes() { + return getTimeOffset(getFixedLocalChatzosHayom(), MINUTE_MILLIS * 30); } /** @@ -4232,41 +3861,41 @@ public Date getMinchaGedolaGRAFixedLocalChatzos30Minutes() { * of the calculation of mincha ketana (the preferred time to recite the mincha prayers according to * the opinion of the Rambam and others) calculated according * to the GRA that is 3.5 shaos zmaniyos (solar - * hours) after {@link #getFixedLocalChatzos() fixed local chatzos}. + * hours) after {@link #getFixedLocalChatzosHayom() fixed local chatzos}. * - * @return the Date of the time of mincha gedola. If the calculation can't be computed such as + * @return the Instant of the time of mincha gedola. 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() - * @see #getFixedLocalChatzos() + * @see #getMinchaGedolaGRA() + * @see #getFixedLocalChatzosHayom() * @see #getMinchaGedolaGRAFixedLocalChatzos30Minutes - * @see ZmanimCalendar#getHalfDayBasedZman(Date, Date, double) + * @see #getHalfDayBasedZman(Instant, Instant, double) */ - public Date getMinchaKetanaGRAFixedLocalChatzosToSunset() { - return getHalfDayBasedZman(getFixedLocalChatzos(), getElevationAdjustedSunset(), 3.5); + public Instant getMinchaKetanaGRAFixedLocalChatzosToSunset() { + return getHalfDayBasedZman(getFixedLocalChatzosHayom(), getSunsetBasedOnElevationSetting(), 3.5); } /** * This method returns Rav Moshe Feinstein's opinion * of the calculation of plag hamincha. This method returns plag hamincha calculated according to the * GRA that the day ends at sunset and is 4.75 shaos - * zmaniyos (solar hours) after {@link #getFixedLocalChatzos() fixed local chatzos}. + * zmaniyos (solar hours) after {@link #getFixedLocalChatzosHayom() fixed local chatzos}. * - * @return the Date of the time of mincha gedola. If the calculation can't be computed such as + * @return the Instant of the time of mincha gedola. 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() - * @see #getFixedLocalChatzos() + * @see #getPlagHaminchaGRA() + * @see #getFixedLocalChatzosHayom() * @see #getMinchaKetanaGRAFixedLocalChatzosToSunset * @see #getMinchaGedolaGRAFixedLocalChatzos30Minutes - * @see ZmanimCalendar#getHalfDayBasedZman(Date, Date, double) + * @see #getHalfDayBasedZman(Instant, Instant, double) */ - public Date getPlagHaminchaGRAFixedLocalChatzosToSunset() { - return getHalfDayBasedZman(getFixedLocalChatzos(), getElevationAdjustedSunset(), 4.75); + public Instant getPlagHaminchaGRAFixedLocalChatzosToSunset() { + return getHalfDayBasedZman(getFixedLocalChatzosHayom(), getSunsetBasedOnElevationSetting(), 4.75); } /** @@ -4275,76 +3904,143 @@ public Date getPlagHaminchaGRAFixedLocalChatzosToSunset() { * tzais (nightfall) based on the opinion of Rabbi Moshe Feinstein for the New York area. This time should * not be used for latitudes other than ones similar to the latitude of the NY area. * - * @return the Date representing the time. If the calculation can't be computed such as in the Arctic + * @return the Instant 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, * a null will be returned. See detailed explanation on top of the {@link AstronomicalCalendar} * documentation. */ - public Date getTzais50() { - return getTimeOffset(getElevationAdjustedSunset(), 50 * MINUTE_MILLIS); + public Instant getTzais50Minutes() { + return getTimeOffset(getSunsetBasedOnElevationSetting(), 50 * MINUTE_MILLIS); } /** * A method for calculating samuch lemincha ketana, / near mincha ketana time that is half an hour before - * {@link #getMinchaKetana()} or is 9 * shaos zmaniyos (solar hours) after the start of + * {@link #getMinchaKetanaGRA()} or is 9 * shaos zmaniyos (solar hours) after the start of * the day, calculated according to the GRA using a day starting at * sunrise and ending at sunset. This is the time that eating or other activity can't begin prior to praying mincha. - * The calculation used is 9 * {@link #getShaahZmanisGra()} after {@link #getSunrise() sunrise} or {@link - * #getElevationAdjustedSunrise() elevation adjusted sunrise} (depending on the {@link #isUseElevation()} setting). See the + * The calculation used is 9 * {@link #getShaahZmanisGRA()} after {@link #getSunset() sunrise} or {@link + * #getSunriseBasedOnElevationSetting() elevation adjusted sunrise} (depending on the {@link #isUseElevation()} setting). See the * Mechaber and Mishna Berurah 232 and 249:2. * - * @see #getShaahZmanisGra() - * @see #getSamuchLeMinchaKetana(Date, Date, boolean) + * @see #getShaahZmanisGRA() + * @see #getSamuchLeMinchaKetana(Instant, Instant, boolean) * @see #isUseAstronomicalChatzosForOtherZmanim() - * @return the Date of the time of samuch lemincha ketana. If the calculation can't be computed such + * @return the Instant of the time of samuch lemincha ketana. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be * returned. See detailed explanation on top of the {@link AstronomicalCalendar} documentation. */ - public Date getSamuchLeMinchaKetanaGRA() { - return getSamuchLeMinchaKetana(getElevationAdjustedSunrise(), getElevationAdjustedSunset(), true); + public Instant getSamuchLeMinchaKetanaGRA() { + return getSamuchLeMinchaKetana(getSunriseBasedOnElevationSetting(), getSunsetBasedOnElevationSetting(), true); } /** * * A method for calculating samuch lemincha ketana, / near mincha ketana time that is half an hour before - * {@link #getMinchaKetana()} or is 9 * shaos zmaniyos (solar hours) after the start of the day, calculated based + * {@link #getMinchaKetanaGRA()} or is 9 * shaos zmaniyos (solar hours) after the start of the day, calculated based * on a day from and ending a day starting at {@link #getMinchaGedola16Point1Degrees() alos 16.1°} and ending - * at {@link #getTzais72() tzais 16.1°}. This is the time that eating or other activity can't begin prior to praying - * mincha. The calculation used is 9 * {@link #getShaahZmanis16Point1Degrees()} after {@link #getAlos16Point1Degrees() - * alos 16.1°}. See the Mechaber and Mishna - * Berurah 232 and 249:2. + * at {@link #getTzais72Minutes() tzais 16.1°}. This is the time that eating or other activity can't begin prior to + * praying mincha. The calculation used is 9 * {@link #getShaahZmanis16Point1Degrees()} after {@link + * #getAlos16Point1Degrees() alos 16.1°}. See the Mechaber and Mishna Berurah 232 and 249:2. * - * @see #getSamuchLeMinchaKetana(Date, Date, boolean) + * @see #getSamuchLeMinchaKetana(Instant, Instant, boolean) * @see #getShaahZmanis16Point1Degrees() - * @return the Date of the time of samuch lemincha ketana. If the calculation can't be computed such + * @return the Instant of the time of samuch lemincha ketana. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be returned. * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. */ - public Date getSamuchLeMinchaKetana16Point1Degrees() { + public Instant getSamuchLeMinchaKetana16Point1Degrees() { return getSamuchLeMinchaKetana(getAlos16Point1Degrees(), getTzais16Point1Degrees(), true); } /** * * A method for calculating samuch lemincha ketana, / near mincha ketana time that is half an hour before - * {@link #getMinchaKetana()} or is 9 * shaos zmaniyos (solar hours) after the start of the day, calculated based - * on a day from and ending a day starting at {@link #getAlos72() alos 72 minutes} and ending at {@link #getTzais72() - * tzais 72 minutes}. This is the time that eating or other activity can't begin prior to praying mincha. - * The calculation used is 9 * {@link #getShaahZmanis72Minutes()} after {@link #getAlos72() alos 72 minutes}. See the Mechaber and Mishna Berurah 232 and 249:2. - * - * @see #getSamuchLeMinchaKetana(Date, Date, boolean) + * {@link #getMinchaKetanaGRA()} or is 9 * shaos zmaniyos (solar hours) after the start of the day, calculated based + * on a day from and ending a day starting at {@link #getAlos72Minutes() alos 72 minutes} and ending at {@link + * #getTzais72Minutes() tzais 72 minutes}. This is the time that eating or other activity can't begin prior to praying + * mincha. The calculation used is 9 * {@link #getShaahZmanis72Minutes()} after {@link #getAlos72Minutes() alos + * 72 minutes}. See the Mechaber and Mishna Berurah + * 232 and 249:2. + * + * @see #getSamuchLeMinchaKetana(Instant, Instant, boolean) * @see #getShaahZmanis72Minutes() - * @return the Date of the time of samuch lemincha ketana. If the calculation can't be computed such + * @return the Instant of the time of samuch lemincha ketana. If the calculation can't be computed such * as northern and southern locations even south of the Arctic Circle and north of the Antarctic Circle * where the sun may not reach low enough below the horizon for this calculation, a null will be returned. * See detailed explanation on top of the {@link AstronomicalCalendar} documentation. */ - public Date getSamuchLeMinchaKetana72Minutes() { - return getSamuchLeMinchaKetana(getAlos72(), getTzais72(), true); + public Instant getSamuchLeMinchaKetana72Minutes() { + return getSamuchLeMinchaKetana(getAlos72Minutes(), getTzais72Minutes(), true); + } + + /** + * A method that returns sunset if it occurs, or the time that the sun is at its westernmost position (azimuth of 270°), if + * sunset will not occur on that day, such as in the Arctic or Antarctic circles. There are some opinions that in Polar regions + * where there are days of no sunrise or sunset, that the definition of a day during this period is a 24-hour day, and the + * day-night boundary is when the sun is at its westernmost position. sunrise in this opinion is when the sun is at its + * easternmost position. + * FIXME link opinions of the Ben Ish chai etc. + * @return sunset if it occurs, or the time that the sun will reach its westernmost position (azimuth 270°), if sunset will + * not occur that day. If there is no sunset this day, and the azimuth 270 will not occur, a null will be returned. + * @see #getSunriseOrEasternmostSolarAzimuth() + * @see #getTimeAtAzimuth(double) + * @see com.kosherjava.zmanim.util.AstronomicalCalculator#getTimeAtAzimuth(LocalDate, GeoLocation, double) + */ + public Instant getSunsetOrWesternmostSolarAzimuth() { + Instant sunset = getSunsetBasedOnElevationSetting(); + if(sunset != null) { + return sunset; + } + return getTimeAtAzimuth(270); + } + + /** + * A method that returns sunrise if it occurs, or the time that the sun is at its easternmost position (azimuth of 900°), if + * sunset will not occur on that day, such as in the Arctic or Antarctic circles. There are some opinions that in Polar regions + * where there are days of no sunrise or sunset, that the definition of a day during this period is a 24-hour day, and the + * day-night boundary is when the sun is at its easternmost position. Sunset in this opinion is when the sun is at its + * westernmost position. + * FIXME link opinions of the Ben Ish chai etc. + * @return sunrise if it occurs, or the time that the sun will reach its easternmost position (azimuth 90°), if sunrise will + * not occur that day. If there is no sunrise this day, and the azimuth 90 will not occur, a null will be returned. + * @see #getSunsetOrWesternmostSolarAzimuth() + * @see #getTimeAtAzimuth(double) + * @see com.kosherjava.zmanim.util.AstronomicalCalculator#getTimeAtAzimuth(LocalDate, GeoLocation, double) + */ + public Instant getSunriseOrEasternmostSolarAzimuth() { + Instant sunrise = getSunriseBasedOnElevationSetting(); + if(sunrise != null) { + return sunrise; + } + return getTimeAtAzimuth(90); + } + + /** + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (object == null || getClass() != object.getClass()) { + return false; + } + if (!super.equals(object)) { + return false; + } + ComprehensiveZmanimCalendar that = (ComprehensiveZmanimCalendar) object; + return ateretTorahSunsetOffset == that.ateretTorahSunsetOffset; + } + + /** + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + return 37 * super.hashCode() + Double.hashCode(ateretTorahSunsetOffset); } } diff --git a/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java b/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java index be75d52e..3a0c4b58 100644 --- a/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java +++ b/src/main/java/com/kosherjava/zmanim/ZmanimCalendar.java @@ -15,40 +15,39 @@ */ package com.kosherjava.zmanim; -import java.util.Calendar; -import java.util.Date; +import java.time.Instant; +import java.time.LocalDate; +import java.util.Objects; import com.kosherjava.zmanim.hebrewcalendar.JewishCalendar; import com.kosherjava.zmanim.util.AstronomicalCalculator; import com.kosherjava.zmanim.util.GeoLocation; /** - * The ZmanimCalendar is a specialized calendar that can calculate sunrise, sunset and Jewish zmanim - * (religious times) for prayers and other Jewish religious duties. This class contains the main functionality of the - * Zmanim library. For a much more extensive list of zmanim, use the {@link ComprehensiveZmanimCalendar} that - * extends this class. See documentation for the {@link ComprehensiveZmanimCalendar} and {@link AstronomicalCalendar} for - * simple examples on using the API. + * The ZmanimCalendar is a specialized calendar that can calculate sunrise, sunset and Jewish zmanim (religious times) + * for prayers and other Jewish religious duties. This class contains the main functionality of the Zmanim library. For + * a much more extensive list of zmanim, use the {@link ComprehensiveZmanimCalendar} that extends this class. See + * documentation for the {@link ComprehensiveZmanimCalendar} and {@link AstronomicalCalendar} for simple examples on using the API. * Elevation based zmanim (even sunrise and sunset) should not be used lekula without the guidance - * of a posek. According to Rabbi Dovid Yehudah Bursztyn in his - * Zmanim Kehilchasam, 7th edition chapter 2, section 7 (pages 181-182) - * and section 9 (pages 186-187), no zmanim besides sunrise and sunset should use elevation. However, Rabbi Yechiel - * Avrahom Zilber in the Birur Halacha Vol. 6 Ch. 58 Pages - * 34 and - * 42 is of the opinion that elevation should be - * accounted for in zmanim calculations. Related to this, Rabbi Yaakov Karp in Shimush Zekeinim, Ch. 1, page 17 states that obstructing horizons should - * be factored into zmanim calculations. The setting defaults to false (elevation will not be used for - * zmanim calculations besides sunrise and sunset), unless the setting is changed to true in {@link - * #setUseElevation(boolean)}. This will impact sunrise and sunset-based zmanim such as {@link #getSunrise()}, - * {@link #getSunset()}, {@link #getSofZmanShmaGRA()}, alos-based zmanim such as {@link #getSofZmanShmaMGA()} - * that are based on a fixed offset of sunrise or sunset and zmanim based on a percentage of the day such as - * {@link ComprehensiveZmanimCalendar#getSofZmanShmaMGA90MinutesZmanis()} that are based on sunrise and sunset. Even when set to - * true it will not impact zmanim that are a degree-based offset of sunrise and sunset, such as {@link - * ComprehensiveZmanimCalendar#getSofZmanShmaMGA16Point1Degrees()} or {@link ComprehensiveZmanimCalendar#getSofZmanShmaBaalHatanya()} since - * these zmanim are not linked to sunrise or sunset times (the calculations are based on the astronomical definition of - * sunrise and sunset calculated in a vacuum with the solar radius above the horizon), and are therefore not impacted by the use - * of elevation. - * For additional information on the halachic impact of elevation on zmanim see: + * of a posek. According to Rabbi Dovid Yehudah Bursztyn in his Zmanim Kehilchasam, 7th edition chapter 2, section 7 (pages 181-182) and section 9 (pages 186-187), no zmanim + * besides sunrise and sunset should use elevation. However, Rabbi Yechiel Avrahom Zilber in the Birur Halacha Vol. 6 Ch. 58 Pages 34 and 42 is of the opinion that elevation should be accounted for + * in zmanim calculations. Related to this, Rabbi Yaakov Karp in Shimush Zekeinim, Ch. 1, page 17 states that obstructing horizons should be factored into zmanim calculations. The + * setting defaults to false (elevation will not be used for zmanim calculations besides sunrise and sunset), unless the + * setting is changed to true in {@link setUseElevation(boolean)}. This will impact sunrise and sunset-based zmanim such as + * {@link getSunrise()}, {@link getSunset()}, {@link getSofZmanShmaGRA()}, alos-based + * zmanim such as {@link getSofZmanShmaMGA72Minutes()} that are based on a fixed offset of sunrise or sunset and + * zmanim based on a percentage of the day such as {@link ComprehensiveZmanimCalendar#getSofZmanShmaMGA90MinutesZmanis()} + * that are based on sunrise and sunset. Even when set to true it will not impact zmanim that are a degree-based offset of + * sunrise and sunset, such as {@link ComprehensiveZmanimCalendar#getSofZmanShmaMGA16Point1Degrees()} or {@link + * ComprehensiveZmanimCalendar#getSofZmanShmaBaalHatanya()} since these zmanim are not linked to sunrise or sunset times + * (the calculations are based on the astronomical definition of sunrise and sunset calculated in a vacuum with the solar radius + * above the horizon), and are therefore not impacted by the use of elevation. For additional information on the halachic + * impact of elevation on zmanim see: *