|
1 | 1 | /*
|
2 | 2 | * Zmanim Java API
|
3 |
| - * Copyright (C) 2004-2023 Eliyahu Hershfeld |
| 3 | + * Copyright (C) 2004-2024 Eliyahu Hershfeld |
4 | 4 | *
|
5 | 5 | * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
|
6 | 6 | * Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
|
|
63 | 63 | * Date sunrise = ac.getSunrise();
|
64 | 64 | * </pre>
|
65 | 65 | *
|
66 |
| - * @author © Eliyahu Hershfeld 2004 - 2023 |
| 66 | + * @author © Eliyahu Hershfeld 2004 - 2024 |
67 | 67 | */
|
68 | 68 | public class AstronomicalCalendar implements Cloneable {
|
69 | 69 |
|
@@ -514,6 +514,29 @@ public Date getSunTransit() {
|
514 | 514 | return getDateFromTime(noon, SolarEvent.NOON);
|
515 | 515 | }
|
516 | 516 |
|
| 517 | + /** |
| 518 | + * A method that returns solar midnight. It occurs when the Sun is <a href= |
| 519 | + * "https://en.wikipedia.org/wiki/Transit_%28astronomy%29">transiting</a> the lower <a |
| 520 | + * href="https://en.wikipedia.org/wiki/Meridian_%28astronomy%29">celestial meridian</a>, or when the sun is at it's |
| 521 | + * <a href="https://en.wikipedia.org/wiki/Nadir">nadir</a>. The calculations used by this class depend on the {@link |
| 522 | + * AstronomicalCalculator} used. If this calendar instance is {@link #setAstronomicalCalculator(AstronomicalCalculator) |
| 523 | + * set} to use the {@link com.kosherjava.zmanim.util.NOAACalculator} (the default) it will calculate astronomical |
| 524 | + * midnight. If the calendar instance is to use the {@link com.kosherjava.zmanim.util.SunTimesCalculator}, that does not |
| 525 | + * have code to calculate astronomical noon, midnight is calculated as halfway between sea level sunrise and sea level |
| 526 | + * sunset on the other side of the world (180° awa)y, which can be slightly off the real transit time due to changes |
| 527 | + * in declination (the lengthening or shortening day). See <a href= |
| 528 | + * "https://kosherjava.com/2020/07/02/definition-of-chatzos/">The Definition of Chatzos</a> for details on the proper |
| 529 | + * definition of solar noon / midday. |
| 530 | + * |
| 531 | + * @return the <code>Date</code> representing Sun's lower transit. If the calculation can't be computed such as when using |
| 532 | + * the {@link com.kosherjava.zmanim.util.SunTimesCalculator USNO calculator} that does not support getting solar |
| 533 | + * midnight for the Arctic Circle (where there is at least one day a year where the sun does not rise, and one |
| 534 | + * where it does not set), a <code>null</code> will be returned. See detailed explanation on top of the page. |
| 535 | + * |
| 536 | + * @see #getSunTransit() |
| 537 | + * @see com.kosherjava.zmanim.util.NOAACalculator#getUTCNoon(Calendar, GeoLocation) |
| 538 | + * @see com.kosherjava.zmanim.util.SunTimesCalculator#getUTCNoon(Calendar, GeoLocation) |
| 539 | + */ |
517 | 540 | public Date getSunLowerTransit() {
|
518 | 541 | Calendar cal = getAdjustedCalendar();
|
519 | 542 | GeoLocation lowerGeoLocation = (GeoLocation) getGeoLocation().clone();
|
@@ -570,16 +593,20 @@ public Date getSunTransit(Date startOfDay, Date endOfDay) {
|
570 | 593 | return getTimeOffset(startOfDay, temporalHour * 6);
|
571 | 594 | }
|
572 | 595 |
|
| 596 | + /** |
| 597 | + * An enum to indicate what type of solar event is being calculated. |
| 598 | + */ |
573 | 599 | protected enum SolarEvent {
|
574 |
| - SUNRISE, SUNSET, NOON, MIDNIGHT |
| 600 | + /**SUNRISE A solar event related to sunrise*/SUNRISE, /**SUNSET A solar event related to sunset*/SUNSET, |
| 601 | + /**NOON A solar event related to noon*/NOON, /**MIDNIGHT A solar event related to midnight*/MIDNIGHT |
575 | 602 | }
|
576 | 603 | /**
|
577 | 604 | * A method that returns a <code>Date</code> from the time passed in as a parameter.
|
578 | 605 | *
|
579 | 606 | * @param time
|
580 | 607 | * The time to be set as the time for the <code>Date</code>. The time expected is in the format: 18.75
|
581 | 608 | * for 6:45:00 PM.time is sunrise and false if it is sunset
|
582 |
| - * @param isSunrise true if this time is for sunrise |
| 609 | + * @param solarEvent the type of {@link SolarEvent} |
583 | 610 | * @return The Date object representation of the time double
|
584 | 611 | */
|
585 | 612 | protected Date getDateFromTime(double time, SolarEvent solarEvent) {
|
|
0 commit comments