com.luckycatlabs.sunrisesunset
Class SunriseSunsetCalculator
- java.lang.Object
-
- com.luckycatlabs.sunrisesunset.SunriseSunsetCalculator
-
public class SunriseSunsetCalculator extends java.lang.ObjectPublic interface for getting the various types of sunrise/sunset.
-
-
Constructor Summary
Constructors Constructor and Description SunriseSunsetCalculator(Location location, java.lang.String timeZoneIdentifier)Constructs a newSunriseSunsetCalculatorwith the givenLocationSunriseSunsetCalculator(Location location, java.util.TimeZone timeZone)Constructs a newSunriseSunsetCalculatorwith the givenLocation
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.util.CalendargetAstronomicalSunriseCalendarForDate(java.util.Calendar date)Returns the astronomical (108deg) sunrise for the given date.java.lang.StringgetAstronomicalSunriseForDate(java.util.Calendar date)Returns the astronomical (108deg) sunrise for the given date.java.util.CalendargetAstronomicalSunsetCalendarForDate(java.util.Calendar date)Returns the astronomical (108deg) sunset for the given date.java.lang.StringgetAstronomicalSunsetForDate(java.util.Calendar date)Returns the astronomical (108deg) sunset for the given date.java.util.CalendargetCivilSunriseCalendarForDate(java.util.Calendar date)Returns the civil sunrise (twilight, 96deg) for the given date.java.lang.StringgetCivilSunriseForDate(java.util.Calendar date)Returns the civil sunrise (twilight, 96deg) for the given date.java.util.CalendargetCivilSunsetCalendarForDate(java.util.Calendar date)Returns the civil sunset (twilight, 96deg) for the given date.java.lang.StringgetCivilSunsetForDate(java.util.Calendar date)Returns the civil sunset (twilight, 96deg) for the given date.LocationgetLocation()Returns the location where the sunrise/sunset is calculated for.java.util.CalendargetNauticalSunriseCalendarForDate(java.util.Calendar date)Returns the nautical (102deg) sunrise for the given date.java.lang.StringgetNauticalSunriseForDate(java.util.Calendar date)Returns the nautical (102deg) sunrise for the given date.java.util.CalendargetNauticalSunsetCalendarForDate(java.util.Calendar date)Returns the nautical (102deg) sunset for the given date.java.lang.StringgetNauticalSunsetForDate(java.util.Calendar date)Returns the nautical (102deg) sunset for the given date.java.util.CalendargetOfficialSunriseCalendarForDate(java.util.Calendar date)Returns the official sunrise (90deg 50', 90.8333deg) for the given date.java.lang.StringgetOfficialSunriseForDate(java.util.Calendar date)Returns the official sunrise (90deg 50', 90.8333deg) for the given date.java.util.CalendargetOfficialSunsetCalendarForDate(java.util.Calendar date)Returns the official sunrise (90deg 50', 90.8333deg) for the given date.java.lang.StringgetOfficialSunsetForDate(java.util.Calendar date)Returns the official sunrise (90deg 50', 90.8333deg) for the given date.static java.util.CalendargetSunrise(double latitude, double longitude, java.util.TimeZone timeZone, java.util.Calendar date, double degrees)Computes the sunrise for an arbitrary declination.static java.util.CalendargetSunset(double latitude, double longitude, java.util.TimeZone timeZone, java.util.Calendar date, double degrees)Computes the sunset for an arbitrary declination.
-
-
-
Constructor Detail
-
SunriseSunsetCalculator
public SunriseSunsetCalculator(Location location, java.lang.String timeZoneIdentifier)
Constructs a newSunriseSunsetCalculatorwith the givenLocation- Parameters:
location-Locationobject containing the Latitude/Longitude of the location to compute the sunrise/sunset for.timeZoneIdentifier- String identifier for the timezone to compute the sunrise/sunset times in. In the form "America/New_York". Please see the zi directory under the JDK installation for supported time zones.
-
SunriseSunsetCalculator
public SunriseSunsetCalculator(Location location, java.util.TimeZone timeZone)
Constructs a newSunriseSunsetCalculatorwith the givenLocation- Parameters:
location-Locationobject containing the Latitude/Longitude of the location to compute the sunrise/sunset for.timeZone- timezone to compute the sunrise/sunset times in.
-
-
Method Detail
-
getAstronomicalSunriseForDate
public java.lang.String getAstronomicalSunriseForDate(java.util.Calendar date)
Returns the astronomical (108deg) sunrise for the given date.- Parameters:
date-Calendarobject containing the date to compute the astronomical sunrise for.- Returns:
- the astronomical sunrise time in HH:MM (24-hour clock) form.
-
getAstronomicalSunriseCalendarForDate
public java.util.Calendar getAstronomicalSunriseCalendarForDate(java.util.Calendar date)
Returns the astronomical (108deg) sunrise for the given date.- Parameters:
date-Calendarobject containing the date to compute the astronomical sunrise for.- Returns:
- the astronomical sunrise time as a Calendar
-
getAstronomicalSunsetForDate
public java.lang.String getAstronomicalSunsetForDate(java.util.Calendar date)
Returns the astronomical (108deg) sunset for the given date.- Parameters:
date-Calendarobject containing the date to compute the astronomical sunset for.- Returns:
- the astronomical sunset time in HH:MM (24-hour clock) form.
-
getAstronomicalSunsetCalendarForDate
public java.util.Calendar getAstronomicalSunsetCalendarForDate(java.util.Calendar date)
Returns the astronomical (108deg) sunset for the given date.- Parameters:
date-Calendarobject containing the date to compute the astronomical sunset for.- Returns:
- the astronomical sunset time as a Calendar
-
getNauticalSunriseForDate
public java.lang.String getNauticalSunriseForDate(java.util.Calendar date)
Returns the nautical (102deg) sunrise for the given date.- Parameters:
date-Calendarobject containing the date to compute the nautical sunrise for.- Returns:
- the nautical sunrise time in HH:MM (24-hour clock) form.
-
getNauticalSunriseCalendarForDate
public java.util.Calendar getNauticalSunriseCalendarForDate(java.util.Calendar date)
Returns the nautical (102deg) sunrise for the given date.- Parameters:
date-Calendarobject containing the date to compute the nautical sunrise for.- Returns:
- the nautical sunrise time as a Calendar
-
getNauticalSunsetForDate
public java.lang.String getNauticalSunsetForDate(java.util.Calendar date)
Returns the nautical (102deg) sunset for the given date.- Parameters:
date-Calendarobject containing the date to compute the nautical sunset for.- Returns:
- the nautical sunset time in HH:MM (24-hour clock) form.
-
getNauticalSunsetCalendarForDate
public java.util.Calendar getNauticalSunsetCalendarForDate(java.util.Calendar date)
Returns the nautical (102deg) sunset for the given date.- Parameters:
date-Calendarobject containing the date to compute the nautical sunset for.- Returns:
- the nautical sunset time as a Calendar
-
getCivilSunriseForDate
public java.lang.String getCivilSunriseForDate(java.util.Calendar date)
Returns the civil sunrise (twilight, 96deg) for the given date.- Parameters:
date-Calendarobject containing the date to compute the civil sunrise for.- Returns:
- the civil sunrise time in HH:MM (24-hour clock) form.
-
getCivilSunriseCalendarForDate
public java.util.Calendar getCivilSunriseCalendarForDate(java.util.Calendar date)
Returns the civil sunrise (twilight, 96deg) for the given date.- Parameters:
date-Calendarobject containing the date to compute the civil sunrise for.- Returns:
- the civil sunrise time as a Calendar
-
getCivilSunsetForDate
public java.lang.String getCivilSunsetForDate(java.util.Calendar date)
Returns the civil sunset (twilight, 96deg) for the given date.- Parameters:
date-Calendarobject containing the date to compute the civil sunset for.- Returns:
- the civil sunset time in HH:MM (24-hour clock) form.
-
getCivilSunsetCalendarForDate
public java.util.Calendar getCivilSunsetCalendarForDate(java.util.Calendar date)
Returns the civil sunset (twilight, 96deg) for the given date.- Parameters:
date-Calendarobject containing the date to compute the civil sunset for.- Returns:
- the civil sunset time as a Calendar
-
getOfficialSunriseForDate
public java.lang.String getOfficialSunriseForDate(java.util.Calendar date)
Returns the official sunrise (90deg 50', 90.8333deg) for the given date.- Parameters:
date-Calendarobject containing the date to compute the official sunrise for.- Returns:
- the official sunrise time in HH:MM (24-hour clock) form.
-
getOfficialSunriseCalendarForDate
public java.util.Calendar getOfficialSunriseCalendarForDate(java.util.Calendar date)
Returns the official sunrise (90deg 50', 90.8333deg) for the given date.- Parameters:
date-Calendarobject containing the date to compute the official sunrise for.- Returns:
- the official sunrise time as a Calendar
-
getOfficialSunsetForDate
public java.lang.String getOfficialSunsetForDate(java.util.Calendar date)
Returns the official sunrise (90deg 50', 90.8333deg) for the given date.- Parameters:
date-Calendarobject containing the date to compute the official sunset for.- Returns:
- the official sunset time in HH:MM (24-hour clock) form.
-
getOfficialSunsetCalendarForDate
public java.util.Calendar getOfficialSunsetCalendarForDate(java.util.Calendar date)
Returns the official sunrise (90deg 50', 90.8333deg) for the given date.- Parameters:
date-Calendarobject containing the date to compute the official sunset for.- Returns:
- the official sunset time as a Calendar
-
getSunrise
public static java.util.Calendar getSunrise(double latitude, double longitude, java.util.TimeZone timeZone, java.util.Calendar date, double degrees)Computes the sunrise for an arbitrary declination.- Parameters:
latitude-longitude- Coordinates for the location to compute the sunrise/sunset for.timeZone- timezone to compute the sunrise/sunset times in.date-Calendarobject containing the date to compute the official sunset for.degrees- Angle under the horizon for which to compute sunrise. For example, "civil sunrise" corresponds to 6 degrees.- Returns:
- the requested sunset time as a
Calendarobject.
-
getSunset
public static java.util.Calendar getSunset(double latitude, double longitude, java.util.TimeZone timeZone, java.util.Calendar date, double degrees)Computes the sunset for an arbitrary declination.- Parameters:
latitude-longitude- Coordinates for the location to compute the sunrise/sunset for.timeZone- timezone to compute the sunrise/sunset times in.date-Calendarobject containing the date to compute the official sunset for.degrees- Angle under the horizon for which to compute sunrise. For example, "civil sunset" corresponds to 6 degrees.- Returns:
- the requested sunset time as a
Calendarobject.
-
getLocation
public Location getLocation()
Returns the location where the sunrise/sunset is calculated for.- Returns:
Locationobject representing the location of the computed sunrise/sunset.
-
-
DMelt 3.0 © DataMelt by jWork.ORG