public final class LunarTime extends Object implements GeoLocation, Serializable
Contains various routines to determine times of some moon events like moonrise or moonset.
Moonrise and moonset are not tightly coupled to the day cycle which follows the sun. Therefore it is sometimes possible to have only one or none of both events happening at a given calendar date. Furthermore, the moon can also first sets and then rises on the same day. Example of usage:
Timezone tz = Timezone.of("Europe/Berlin");
LunarTime munich = LunarTime.ofLocation(tz.getID(), 48.1, 11.6);
LunarTime.Moonlight moonlight = munich.on(PlainDate.of(2000, 3, 25));
assertThat(
moonlight.moonrise().isPresent(),
is(false));
assertThat(
moonlight.moonset().get(),
is(PlainTimestamp.of(2000, 3, 25, 8, 58, 33).in(tz)));
| Modifier and Type | Class and Description |
|---|---|
static class |
LunarTime.Builder
Helper class to construct a new instance of
LunarTime. |
static class |
LunarTime.Moonlight
Collects all moon presence data for a given calendar date and zone of observer.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
getAltitude()
Obtains the geographical altitude of this instance relative to sea level.
|
double |
getLatitude()
Obtains the geographical latitude of this instance.
|
double |
getLongitude()
Obtains the geographical longitude of this instance.
|
TZID |
getObserverZoneID()
Obtains the observer timezone which is associated with any calendar date input.
|
int |
hashCode() |
static LunarTime.Builder |
ofLocation(TZID observerZoneID)
Obtains a builder for creating a new instance of local lunar time.
|
static LunarTime |
ofLocation(TZID observerZoneID,
double latitude,
double longitude)
Obtains the lunar time for given geographical location.
|
static LunarTime |
ofLocation(TZID observerZoneID,
double latitude,
double longitude,
int altitude)
Obtains the lunar time for given geographical location.
|
LunarTime.Moonlight |
on(CalendarDate date)
Determines moonrise and moonset on given calendar date.
|
String |
toString() |
of, ofpublic static LunarTime.Builder ofLocation(TZID observerZoneID)
Obtains a builder for creating a new instance of local lunar time.
This method is the recommended approach if any given geographical position is described in degrees including arc minutes and arc seconds in order to avoid manual conversions to decimal degrees.
observerZoneID - timezone identifier associated with geographical positionpublic static LunarTime ofLocation(TZID observerZoneID, double latitude, double longitude)
Obtains the lunar time for given geographical location.
This method handles the geographical location in decimal degrees only. If these data are given
in degrees, arc minutes and arc seconds then users should apply the builder
approach instead.
observerZoneID - timezone identifier associated with geographical positionlatitude - geographical latitude in decimal degrees (-90.0 <= x <= +90.0)longitude - geographical longitude in decimal degrees (-180.0 <= x < 180.0)IllegalArgumentException - if the coordinates are out of range or the timezone cannot be loadedpublic static LunarTime ofLocation(TZID observerZoneID, double latitude, double longitude, int altitude)
Obtains the lunar time for given geographical location.
This method handles the geographical location in decimal degrees only. If these data are given
in degrees, arc minutes and arc seconds then users should apply the builder
approach instead.
observerZoneID - timezone identifier associated with geographical positionlatitude - geographical latitude in decimal degrees (-90.0 <= x <= +90.0)longitude - geographical longitude in decimal degrees (-180.0 <= x < 180.0)altitude - geographical altitude relative to sea level in meters (0 <= x < 11,0000)IllegalArgumentException - if the coordinates are out of range or the timezone cannot be loadedpublic double getLatitude()
GeoLocationObtains the geographical latitude of this instance.
getLatitude in interface GeoLocation-90.0 <= x <= +90.0)public double getLongitude()
GeoLocationObtains the geographical longitude of this instance.
getLongitude in interface GeoLocation-180.0 <= x < 180.0)public int getAltitude()
GeoLocationObtains the geographical altitude of this instance relative to sea level.
getAltitude in interface GeoLocation0 <= x < 11,0000)public TZID getObserverZoneID()
Obtains the observer timezone which is associated with any calendar date input.
ofLocation(TZID)public LunarTime.Moonlight on(CalendarDate date)
Determines moonrise and moonset on given calendar date.
date - calendar dateCopyright © 2014–2021. All rights reserved.