Skip to content

Commit 4bef262

Browse files
authored
Start using java.time classes
Breaking changes
1 parent c656735 commit 4bef262

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

src/main/java/com/kosherjava/zmanim/util/AstronomicalCalculator.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Zmanim Java API
3-
* Copyright (C) 2004-2025 Eliyahu Hershfeld
3+
* Copyright (C) 2004-2026 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)
@@ -15,15 +15,15 @@
1515
*/
1616
package com.kosherjava.zmanim.util;
1717

18-
import java.util.Calendar;
18+
import java.time.ZonedDateTime;
1919

2020
/**
2121
* An abstract class that all sun time calculating classes extend. This allows the algorithm used to be changed at
2222
* runtime, easily allowing comparison the results of using different algorithms.
2323
* @todo Consider methods that would allow atmospheric modeling. This can currently be adjusted by {@link
2424
* #setRefraction(double) setting the refraction}.
2525
*
26-
* @author © Eliyahu Hershfeld 2004 - 2025
26+
* @author © Eliyahu Hershfeld 2004 - 2026
2727
*/
2828
public abstract class AstronomicalCalculator implements Cloneable {
2929
/**
@@ -104,7 +104,7 @@ public static AstronomicalCalculator getDefault() {
104104
* A method that calculates UTC sunrise as well as any time based on an angle above or below sunrise. This abstract
105105
* method is implemented by the classes that extend this class.
106106
*
107-
* @param calendar
107+
* @param zonedDateTime
108108
* Used to calculate day of year.
109109
* @param geoLocation
110110
* The location information used for astronomical calculating sun times.
@@ -121,14 +121,14 @@ public static AstronomicalCalculator getDefault() {
121121
* {@link java.lang.Double#NaN} will be returned.
122122
* @see #getElevationAdjustment(double)
123123
*/
124-
public abstract double getUTCSunrise(Calendar calendar, GeoLocation geoLocation, double zenith,
124+
public abstract double getUTCSunrise(ZonedDateTime zonedDateTime, GeoLocation geoLocation, double zenith,
125125
boolean adjustForElevation);
126126

127127
/**
128128
* A method that calculates UTC sunset as well as any time based on an angle above or below sunset. This abstract
129129
* method is implemented by the classes that extend this class.
130130
*
131-
* @param calendar
131+
* @param zonedDateTime
132132
* Used to calculate day of year.
133133
* @param geoLocation
134134
* The location information used for astronomical calculating sun times.
@@ -145,7 +145,7 @@ public abstract double getUTCSunrise(Calendar calendar, GeoLocation geoLocation,
145145
* {@link java.lang.Double#NaN} will be returned.
146146
* @see #getElevationAdjustment(double)
147147
*/
148-
public abstract double getUTCSunset(Calendar calendar, GeoLocation geoLocation, double zenith,
148+
public abstract double getUTCSunset(ZonedDateTime zonedDateTime, GeoLocation geoLocation, double zenith,
149149
boolean adjustForElevation);
150150

151151

@@ -155,14 +155,14 @@ public abstract double getUTCSunset(Calendar calendar, GeoLocation geoLocation,
155155
* true solar noon, while the {@link com.kosherjava.zmanim.util.SunTimesCalculator} approximates it, calculating
156156
* the time as halfway between sunrise and sunset.
157157
*
158-
* @param calendar
158+
* @param zonedDateTime
159159
* Used to calculate day of year.
160160
* @param geoLocation
161161
* The location information used for astronomical calculating sun times.
162162
*
163163
* @return the time in minutes from zero UTC
164164
*/
165-
public abstract double getUTCNoon(Calendar calendar, GeoLocation geoLocation);
165+
public abstract double getUTCNoon(ZonedDateTime zonedDateTime, GeoLocation geoLocation);
166166

167167

168168
/**
@@ -171,44 +171,44 @@ public abstract double getUTCSunset(Calendar calendar, GeoLocation geoLocation,
171171
* true solar midnight, while the {@link com.kosherjava.zmanim.util.SunTimesCalculator} approximates it, calculating
172172
* the time as 12 hours after halfway between sunrise and sunset.
173173
*
174-
* @param calendar
174+
* @param zonedDateTime
175175
* Used to calculate day of year.
176176
* @param geoLocation
177177
* The location information used for astronomical calculating sun times.
178178
*
179179
* @return the time in minutes from zero UTC
180180
*/
181-
public abstract double getUTCMidnight(Calendar calendar, GeoLocation geoLocation);
181+
public abstract double getUTCMidnight(ZonedDateTime zonedDateTime, GeoLocation geoLocation);
182182

183183
/**
184184
* Return the <a href="https://en.wikipedia.org/wiki/Celestial_coordinate_system">Solar Elevation</a> for the
185185
* horizontal coordinate system at the given location at the given time. Can be negative if the sun is below the
186186
* horizon. Not corrected for altitude.
187187
*
188-
* @param calendar
188+
* @param zonedDateTime
189189
* time of calculation
190190
* @param geoLocation
191191
* The location information
192192
* @return solar elevation in degrees. The horizon (calculated in a vacuum using the solar radius as the point)
193193
* is 090&deg;, civil twilight is -690&deg; etc. This means that sunrise and sunset that do use
194194
* refraction and are calculated from the upper limb of the sun will return about 0.83390&deg;.
195195
*/
196-
public abstract double getSolarElevation(Calendar calendar, GeoLocation geoLocation);
196+
public abstract double getSolarElevation(ZonedDateTime zonedDateTime, GeoLocation geoLocation);
197197

198198
/**
199199
* Return the <a href="https://en.wikipedia.org/wiki/Celestial_coordinate_system">Solar Azimuth</a> for the
200200
* horizontal coordinate system at the given location at the given time. Not corrected for altitude. True south is 180
201201
* degrees.
202202
*
203-
* @param calendar
203+
* @param zonedDateTime
204204
* time of calculation
205205
* @param geoLocation
206206
* The location information
207207
* @return the solar azimuth in degrees. Astronomical midday would be 180 in the norther hemosphere and 0 in the
208208
* southern hemosphere. Depending on the location and time of year, sunrise will have an azimuth of about
209209
* 90&deg; and sunset about 270&deg;.
210210
*/
211-
public abstract double getSolarAzimuth(Calendar calendar, GeoLocation geoLocation);
211+
public abstract double getSolarAzimuth(ZonedDateTime zonedDateTime, GeoLocation geoLocation);
212212

213213
/**
214214
* Method to return the adjustment to the zenith required to account for the elevation. Since a person at a higher
@@ -258,7 +258,7 @@ public abstract double getUTCSunset(Calendar calendar, GeoLocation geoLocation,
258258
* below the zenith}. This is traditionally calculated with none of the above mentioned adjustments. The same goes
259259
* for various <em>tzais</em> and <em>alos</em> times such as the
260260
* {@link com.kosherjava.zmanim.ZmanimCalendar#ZENITH_16_POINT_1 16.1&deg;} dip used in
261-
* {@link com.kosherjava.zmanim.ComplexZmanimCalendar#getAlos16Point1Degrees()}.
261+
* {@link com.kosherjava.zmanim.ComprehensiveZmanimCalendar#getAlos16Point1Degrees()}.
262262
*
263263
* @param zenith
264264
* the azimuth below the vertical zenith of 90&deg;. For sunset typically the {@link #adjustZenith

0 commit comments

Comments
 (0)