|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hermit.astro.Body
public abstract class Body
A celestial body in astronomical calculations; this class calculates and caches all parameters relating to a specific body. Derived classes represent specific bodies or types of body.
The public enum Body.Name
identifies a particular body. It also contains
all the orbital elements and other static info for each body.
Applications do not create instances of Body; they are obtained by
calling Observation.getSun()
, Observation.getMoon()
and
Observation.getPlanet(Body.Name which)
.
The core of this class is a database of all the data we have calculated
for this body. Fields in the database are identified by enum Body.Field
;
clients ask for a particular field by calling get(Field)
. All field
values are doubles. Each member of Field has a pointer to the
calculation method which calculates the value of that field (and
maybe others); if a value is requested which is not in the database,
the calculation method is called automatically. Hence the database
acts as a cache of computed data for the body.
The cache must be invalidated, by calling invalidate(), if any of the
circumstances of the current observation (such as time) changes. This
is generally done by the controlling Observation
automatically.
Since there may be multiple Observations in existence at one time, there may well be multiple versions of each Body floating around, since a Body -- and its associated cached data -- is associated with the set of circumstances in a particular Observation. So be sure you keep straight which Sun, for example, is which.
Note that we depart from the usual Java naming conventions here. To simplify reference to source materials, variables are named according to the original source text, Greek letters included. So, be careful when looking at names; "Χ" may be the Greek Chi, rather than Roman.
Nested Class Summary | |
---|---|
static class |
Body.Field
This enumeration defines the data fields that are stored for each body. |
static class |
Body.Name
This enumeration defines the celestial bodies we know about. |
Field Summary | |
---|---|
static Body.Name[] |
ALL_BODIES
The names of all the celestial bodies we have information on. |
static int |
NUM_BODIES
The number of celestial bodies we have information on. |
Fields inherited from interface org.hermit.astro.AstroConstants |
---|
ABERRATION, AU, HALFPI, J1900, J1990, J2000, JD_UNIX, REFRACTION, SECS_PER_DAY, SIDEREAL_RATIO, SIDEREAL_YEAR, TROPICAL_YEAR, TWILIGHT, TWOPI, ε_2000 |
Constructor Summary | |
---|---|
protected |
Body(Observation o,
Body.Name which)
Create a Body. |
Method Summary | |
---|---|
double |
get(Body.Field key)
Get the value of one of the data fields of this body. |
Body.Name |
getId()
Get this body's identifier. |
java.lang.String |
getName()
Get this body's name. |
protected void |
invalidate()
Invalidate the data cache. |
protected void |
put(Body.Field key,
java.lang.Double val)
Save a specified value in the data cache. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Body.Name[] ALL_BODIES
public static final int NUM_BODIES
Constructor Detail |
---|
protected Body(Observation o, Body.Name which)
Observation
.
o
- The Observation this Body belongs to. This
contains all global configuration, like the
current time.which
- Which body this is.Method Detail |
---|
public Body.Name getId()
public java.lang.String getName()
public double get(Body.Field key) throws AstroError
key
- The field we want.
AstroError
- The request was invalid.protected void put(Body.Field key, java.lang.Double val)
key
- The name of the value to save.val
- The value.protected void invalidate()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |