Skip to content

Commit 4e538ed

Browse files
authored
JavaDoc additions for AstronomicalCalendar.java
1 parent c5e0eef commit 4e538ed

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

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

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Zmanim Java API
3-
* Copyright (C) 2004-2023 Eliyahu Hershfeld
3+
* Copyright (C) 2004-2024 Eliyahu Hershfeld
44
*
55
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
66
* Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option)
@@ -63,7 +63,7 @@
6363
* Date sunrise = ac.getSunrise();
6464
* </pre>
6565
*
66-
* @author &copy; Eliyahu Hershfeld 2004 - 2023
66+
* @author &copy; Eliyahu Hershfeld 2004 - 2024
6767
*/
6868
public class AstronomicalCalendar implements Cloneable {
6969

@@ -514,6 +514,29 @@ public Date getSunTransit() {
514514
return getDateFromTime(noon, SolarEvent.NOON);
515515
}
516516

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&deg; 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+
*/
517540
public Date getSunLowerTransit() {
518541
Calendar cal = getAdjustedCalendar();
519542
GeoLocation lowerGeoLocation = (GeoLocation) getGeoLocation().clone();
@@ -570,16 +593,20 @@ public Date getSunTransit(Date startOfDay, Date endOfDay) {
570593
return getTimeOffset(startOfDay, temporalHour * 6);
571594
}
572595

596+
/**
597+
* An enum to indicate what type of solar event is being calculated.
598+
*/
573599
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
575602
}
576603
/**
577604
* A method that returns a <code>Date</code> from the time passed in as a parameter.
578605
*
579606
* @param time
580607
* The time to be set as the time for the <code>Date</code>. The time expected is in the format: 18.75
581608
* 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}
583610
* @return The Date object representation of the time double
584611
*/
585612
protected Date getDateFromTime(double time, SolarEvent solarEvent) {

0 commit comments

Comments
 (0)