|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.icu.util.CalendarAstronomer
CalendarAstronomer
is a class that can perform the calculations to
determine the positions of the sun and moon, the time of sunrise and
sunset, and other astronomy-related data. The calculations it performs
are in some cases quite complicated, and this utility class saves you
the trouble of worrying about them.
The measurement of time is a very important part of astronomy. Because
astronomical bodies are constantly in motion, observations are only valid
at a given moment in time. Accordingly, each CalendarAstronomer
object has a time
property that determines the date
and time for which its calculations are performed. You can set and
retrieve this property with setDate
, getDate
and related methods.
Almost all of the calculations performed by this class, or by any astronomer, are approximations to various degrees of accuracy. The calculations in this class are mostly modelled after those described in the book Practical Astronomy With Your Calculator, by Peter J. Duffett-Smith, Cambridge University Press, 1990. This is an excellent book, and if you want a greater understanding of how these calculations are performed it a very good, readable starting point.
WARNING: This class is very early in its development, and
it is highly likely that its API will change to some degree in the future.
At the moment, it basically does just enough to support IslamicCalendar
and ChineseCalendar
.
Inner Class Summary | |
static class |
CalendarAstronomer.Ecliptic
Represents the position of an object in the sky relative to the ecliptic, the plane of the earth's orbit around the Sun. |
static class |
CalendarAstronomer.Equatorial
Represents the position of an object in the sky relative to the plane of the earth's equator. |
static class |
CalendarAstronomer.Horizon
Represents the position of an object in the sky relative to the local horizon. |
Field Summary | |
static com.ibm.icu.util.CalendarAstronomer.SolarLongitude |
AUTUMN_EQUINOX
Constant representing the autumnal equinox. |
static long |
DAY_MS
The number of milliseconds in one day. |
static com.ibm.icu.util.CalendarAstronomer.MoonAge |
FIRST_QUARTER
Constant representing the moon's first quarter. |
static com.ibm.icu.util.CalendarAstronomer.MoonAge |
FULL_MOON
Constant representing a full moon. |
static int |
HOUR_MS
The number of milliseconds in one hour. |
static long |
JULIAN_EPOCH_MS
The start of the julian day numbering scheme used by astronomers, which is 1/1/4713 BC (Julian), 12:00 GMT. |
static com.ibm.icu.util.CalendarAstronomer.MoonAge |
LAST_QUARTER
Constant representing the moon's last quarter. |
static int |
MINUTE_MS
The number of milliseconds in one minute. |
static com.ibm.icu.util.CalendarAstronomer.MoonAge |
NEW_MOON
Constant representing a new moon. |
static int |
SECOND_MS
The number of milliseconds in one second. |
static double |
SIDEREAL_DAY
The number of standard hours in one sidereal day. |
static double |
SIDEREAL_MONTH
The average number of days it takes for the moon to return to the same ecliptic longitude relative to the stellar background. |
static double |
SIDEREAL_YEAR
The average number of days it takes for the sun to return to the same position against the fixed stellar background. |
static double |
SOLAR_DAY
The number of sidereal hours in one mean solar day. |
static com.ibm.icu.util.CalendarAstronomer.SolarLongitude |
SUMMER_SOLSTICE
Constant representing the summer solstice. |
static double |
SYNODIC_MONTH
The average number of solar days from one new moon to the next. |
static double |
TROPICAL_YEAR
The average number number of days between successive vernal equinoxes. |
static com.ibm.icu.util.CalendarAstronomer.SolarLongitude |
VERNAL_EQUINOX
Constant representing the vernal equinox. |
static com.ibm.icu.util.CalendarAstronomer.SolarLongitude |
WINTER_SOLSTICE
Constant representing the winter solstice. |
Constructor Summary | |
CalendarAstronomer()
Construct a new CalendarAstronomer object that is initialized to
the current date and time. |
|
CalendarAstronomer(java.util.Date d)
Construct a new CalendarAstronomer object that is initialized to
the specified date and time. |
|
CalendarAstronomer(double longitude,
double latitude)
Construct a new CalendarAstronomer object with the given
latitude and longitude. |
|
CalendarAstronomer(long aTime)
Construct a new CalendarAstronomer object that is initialized to
the specified time. |
Method Summary | |
CalendarAstronomer.Equatorial |
eclipticToEquatorial(CalendarAstronomer.Ecliptic ecliptic)
Convert from ecliptic to equatorial coordinates. |
CalendarAstronomer.Equatorial |
eclipticToEquatorial(double eclipLong)
Convert from ecliptic longitude to equatorial coordinates. |
CalendarAstronomer.Equatorial |
eclipticToEquatorial(double eclipLong,
double eclipLat)
Convert from ecliptic to equatorial coordinates. |
CalendarAstronomer.Horizon |
eclipticToHorizon(double eclipLong)
|
java.util.Date |
getDate()
Get the current time of this CalendarAstronomer object,
represented as a Date object. |
double |
getGreenwichSidereal()
Returns the current Greenwich sidereal time, measured in hours |
double |
getJulianCentury()
Return this object's time expressed in julian centuries: the number of centuries after 1/1/1900 AD, 12:00 GMT |
double |
getJulianDay()
Get the current time of this CalendarAstronomer object,
expressed as a "julian day number", which is the number of elapsed
days since 1/1/4713 BC (Julian), 12:00 GMT. |
double |
getLocalSidereal()
Returns the current local sidereal time, measured in hours |
double |
getMoonAge()
The "age" of the moon at the time specified in this object. |
double |
getMoonPhase()
Calculate the phase of the moon at the time set in this object. |
CalendarAstronomer.Equatorial |
getMoonPosition()
The position of the moon at the time set on this object, in equatorial coordinates. |
long |
getMoonRiseSet(boolean rise)
Returns the time (GMT) of sunrise or sunset on the local date to which this calendar is currently set. |
long |
getMoonTime(com.ibm.icu.util.CalendarAstronomer.MoonAge desired,
boolean next)
Find the next or previous time at which the moon will be in the desired phase. |
long |
getMoonTime(double desired,
boolean next)
Find the next or previous time at which the Moon's ecliptic longitude will have the desired value. |
double |
getSunLongitude()
The longitude of the sun at the time specified by this object. |
CalendarAstronomer.Equatorial |
getSunPosition()
The position of the sun at this object's current date and time, in equatorial coordinates. |
long |
getSunRiseSet(boolean rise)
Returns the time (GMT) of sunrise or sunset on the local date to which this calendar is currently set. |
long |
getSunTime(com.ibm.icu.util.CalendarAstronomer.SolarLongitude desired,
boolean next)
Find the next time at which the sun's ecliptic longitude will have the desired value. |
long |
getSunTime(double desired,
boolean next)
Find the next time at which the sun's ecliptic longitude will have the desired value. |
long |
getTime()
Get the current time of this CalendarAstronomer object,
represented as the number of milliseconds since
1/1/1970 AD 0:00 GMT (Gregorian). |
java.lang.String |
local(long localMillis)
|
void |
setDate(java.util.Date date)
Set the current date and time of this CalendarAstronomer object. |
void |
setJulianDay(double jdn)
Set the current date and time of this CalendarAstronomer object. |
void |
setTime(long aTime)
Set the current date and time of this CalendarAstronomer object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final double SIDEREAL_DAY
public static final double SOLAR_DAY
public static final double SYNODIC_MONTH
SIDEREAL_MONTH
public static final double SIDEREAL_MONTH
SYNODIC_MONTH
public static final double TROPICAL_YEAR
SIDEREAL_YEAR
public static final double SIDEREAL_YEAR
TROPICAL_YEAR
public static final int SECOND_MS
public static final int MINUTE_MS
public static final int HOUR_MS
public static final long DAY_MS
public static final long JULIAN_EPOCH_MS
public static final com.ibm.icu.util.CalendarAstronomer.SolarLongitude VERNAL_EQUINOX
getSunTime
.
Note: In this case, "vernal" refers to the northern hemisphere's seasons.public static final com.ibm.icu.util.CalendarAstronomer.SolarLongitude SUMMER_SOLSTICE
getSunTime
.
Note: In this case, "summer" refers to the northern hemisphere's seasons.public static final com.ibm.icu.util.CalendarAstronomer.SolarLongitude AUTUMN_EQUINOX
getSunTime
.
Note: In this case, "autumn" refers to the northern hemisphere's seasons.public static final com.ibm.icu.util.CalendarAstronomer.SolarLongitude WINTER_SOLSTICE
getSunTime
.
Note: In this case, "winter" refers to the northern hemisphere's seasons.public static final com.ibm.icu.util.CalendarAstronomer.MoonAge NEW_MOON
getMoonTime
public static final com.ibm.icu.util.CalendarAstronomer.MoonAge FIRST_QUARTER
getMoonTime
public static final com.ibm.icu.util.CalendarAstronomer.MoonAge FULL_MOON
getMoonTime
public static final com.ibm.icu.util.CalendarAstronomer.MoonAge LAST_QUARTER
getMoonTime
Constructor Detail |
public CalendarAstronomer()
CalendarAstronomer
object that is initialized to
the current date and time.public CalendarAstronomer(java.util.Date d)
CalendarAstronomer
object that is initialized to
the specified date and time.public CalendarAstronomer(long aTime)
CalendarAstronomer
object that is initialized to
the specified time. The time is expressed as a number of milliseconds since
January 1, 1970 AD (Gregorian).Date.getTime()
public CalendarAstronomer(double longitude, double latitude)
CalendarAstronomer
object with the given
latitude and longitude. The object's time is set to the current
date and time.
longitude
- The desired longitude, in degrees east of
the Greenwich meridian.latitude
- The desired latitude, in degrees. Positive
values signify North, negative South.Date.getTime()
Method Detail |
public void setTime(long aTime)
CalendarAstronomer
object. All
astronomical calculations are performed based on this time setting.aTime
- the date and time, expressed as the number of milliseconds since
1/1/1970 0:00 GMT (Gregorian).setDate(java.util.Date)
,
getTime()
public void setDate(java.util.Date date)
CalendarAstronomer
object. All
astronomical calculations are performed based on this time setting.aTime
- the time and date, expressed as a Date
object.setTime(long)
,
getDate()
public void setJulianDay(double jdn)
CalendarAstronomer
object. All
astronomical calculations are performed based on this time setting.jdn
- the desired time, expressed as a "julian day number",
which is the number of elapsed days since
1/1/4713 BC (Julian), 12:00 GMT. Note that julian day
numbers start at noon. To get the jdn for
the corresponding midnight, subtract 0.5.getJulianDay()
,
JULIAN_EPOCH_MS
public long getTime()
CalendarAstronomer
object,
represented as the number of milliseconds since
1/1/1970 AD 0:00 GMT (Gregorian).setTime(long)
,
getDate()
public java.util.Date getDate()
CalendarAstronomer
object,
represented as a Date
object.setDate(java.util.Date)
,
getTime()
public double getJulianDay()
CalendarAstronomer
object,
expressed as a "julian day number", which is the number of elapsed
days since 1/1/4713 BC (Julian), 12:00 GMT.setJulianDay(double)
,
JULIAN_EPOCH_MS
public double getJulianCentury()
getJulianDay()
public double getGreenwichSidereal()
public double getLocalSidereal()
public final CalendarAstronomer.Equatorial eclipticToEquatorial(CalendarAstronomer.Ecliptic ecliptic)
ecliptic
- A point in the sky in ecliptic coordinates.public final CalendarAstronomer.Equatorial eclipticToEquatorial(double eclipLong, double eclipLat)
eclipLong
- The ecliptic longitudeeclipLat
- The ecliptic latitudepublic final CalendarAstronomer.Equatorial eclipticToEquatorial(double eclipLong)
eclipLong
- The ecliptic longitudepublic CalendarAstronomer.Horizon eclipticToHorizon(double eclipLong)
public double getSunLongitude()
Currently, this method uses an approximation of the two-body Kepler's equation for the earth and the sun. It does not take into account the perturbations caused by the other planets, the moon, etc.
public CalendarAstronomer.Equatorial getSunPosition()
public long getSunTime(double desired, boolean next)
public long getSunTime(com.ibm.icu.util.CalendarAstronomer.SolarLongitude desired, boolean next)
public long getSunRiseSet(boolean rise)
public CalendarAstronomer.Equatorial getMoonPosition()
public double getMoonAge()
getMoonPhase()
public double getMoonPhase()
double
in the range
0 <= phase < 1
, interpreted as follows:
getMoonAge()
public long getMoonTime(double desired, boolean next)
desired
- The desired longitude.next
- true if the next occurrance of the phase
is desired, false for the previous occurrance.public long getMoonTime(com.ibm.icu.util.CalendarAstronomer.MoonAge desired, boolean next)
desired
- The desired phase of the moon.next
- true if the next occurrance of the phase
is desired, false for the previous occurrance.public long getMoonRiseSet(boolean rise)
public java.lang.String local(long localMillis)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |