|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.astronomy.EphemerisTable
public class EphemerisTable
A table of position entries for an astronomical source.
Version Info:
$Revision: 1707 $ |
$Date: 2008-11-14 10:23:59 -0700 (Fri, 14 Nov 2008) $ |
$Author: dharland $ |
Constructor Summary | |
---|---|
EphemerisTable()
Creates a new instance. |
Method Summary | |
---|---|
void |
addFrom(InputStream in,
String tableType)
Reads data from in and adds it to this table. |
void |
addFrom(String fileName,
String tableType)
Reads data from fileName and adds it to this table. |
EphemerisTable |
clone()
Returns a copy of this table. |
static EphemerisTable |
createFrom(InputStream in,
String tableType)
Creates a new ephemeris table and tries to load it with data from the given stream. |
static EphemerisTable |
createFrom(String fileName,
String tableType)
Creates a new ephemeris table and tries to load it with data from the given file. |
boolean |
equals(Object o)
Returns true if o is equal to this table. |
static EphemerisTable |
fromXml(Reader reader)
Creates a new ephemeris table based on the XML data read from reader . |
static EphemerisTable |
fromXml(String xmlFile)
Creates a new ephemeris table from the XML data in the given file. |
Angle |
getAngularSeparation(SphericalPosition other)
Calculates the current angular separation between this position and other . |
Angle |
getAngularSeparation(SphericalPosition other,
Date time)
Calculates current angular separation between this position and other at the given time. |
CelestialCoordinateSystem |
getCoordinateSystem()
Returns the coordinate system to use when interpreting the latitude and longitude values of this position. |
Distance |
getDistance()
Returns the current distance of this position. |
Distance |
getDistance(Date time)
Returns the distance of this position at the given point in time. |
Distance |
getDistanceUncertainty()
Returns the uncertainty in the distance of this position. |
Epoch |
getEpoch()
Returns the epoch on which this position is based. |
Latitude |
getLatitude()
Returns the current latitude of this position. |
Latitude |
getLatitude(Date time)
Returns the latitude of this position at the given point in time. |
Latitude |
getLatitudeUncertainty()
Returns the uncertainty in the latitude of this position. |
Longitude |
getLongitude()
Returns the current longitude of this position. |
Longitude |
getLongitude(Date time)
Returns the longitude of this position at the given point in time. |
Longitude |
getLongitudeUncertainty()
Returns the uncertainty in the longitude of this position. |
String |
getOriginOfInformation()
Returns the origin of this position's information. |
SkyPositionType |
getType()
Provides a hint as to how this position stores its information. |
TimeInterval |
getValidTime()
Returns the interval of time for which this table is valid. |
LinearVelocity |
getVelocity(Date time)
Returns the radial velocity of this position at the given point in time. |
int |
hashCode()
Returns a hash code value for this table. |
boolean |
isEmpty()
Returns true if this table has no entries. |
boolean |
isMoving()
Returns true if this position has different properties at time T than it does at time U ≠ T. |
boolean |
isValidFor(Date time)
Returns true if this position is valid for the given point in time. |
void |
reset()
Clears all entries from this table. |
void |
setCoordinateSystem(CelestialCoordinateSystem newSystem)
Sets the system of latitude and longitude on which this position is based. |
void |
setEpoch(Epoch newEpoch)
Sets the epoch on which this position is based. |
void |
setInterpolatorClass(Class<? extends Interpolator> interpClass)
Sets the implementation of Interpolator that this table will use
for calculating positional values. |
void |
setOriginOfInformation(String origin)
Sets the origin of this position's information. |
int |
size()
Returns the number of entries in this table. |
SkyPosition |
toPosition(CelestialCoordinateSystem system,
Epoch epoch,
EarthPosition observer,
LocalSiderealTime lst)
Returns a new position expressed in the given coordinate system and epoch that is equivalent to this position. |
SkyPosition |
toPosition(CelestialCoordinateSystem system,
Epoch epoch,
EarthPosition observer,
LocalSiderealTime lst,
CelestialCoordinateConverter converter)
Returns a new position expressed in the given coordinate system and epoch that is equivalent to this position. |
String |
toString()
Returns a text representation of this table. |
String |
toXml()
Returns an XML representation of this ephemeris table. |
void |
writeAsXmlTo(Writer writer)
Writes an XML representation of this ephemeris table to writer . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EphemerisTable()
Method Detail |
---|
public void reset()
A reset table is equivalent to a new table created via the no-argument constructor. Note that this means that even the class used as an interpolator is reset by this method.
public boolean isMoving()
SkyPosition
The determination of motion will be made with respect to the coordinate system in which this position is expressed. For example, a position that is expressed in the equatorial system, and that is holding steady at its position in that system, will said to be not moving, even though in other coordinate systems it may be moving quite rapidly.
public TimeInterval getValidTime()
public boolean isValidFor(Date time)
time
- the point in time to be checked.public SkyPositionType getType()
SkyPosition
public Longitude getLongitude(Date time)
If isValidFor(time)
returns false
this method will throw an IllegalArgumentException
.
time
- the point in time for which a value is requested.
IllegalArgumentException
- if param
is not a valid time,
as determined by isValidFor(Date)
.public Latitude getLatitude(Date time)
If isValidFor(time)
returns false
this method will throw an IllegalArgumentException
.
time
- the point in time for which a value is requested.
IllegalArgumentException
- if param
is not a valid time,
as determined by isValidFor(Date)
.public Distance getDistance(Date time)
If isValidFor(time)
returns false
this method will throw an IllegalArgumentException
.
time
- the point in time for which a value is requested.
IllegalArgumentException
- if param
is not a valid time,
as determined by isValidFor(Date)
.public LinearVelocity getVelocity(Date time)
If isValidFor(time)
returns false
this method will throw an IllegalArgumentException
.
time
- the point in time for which a value is requested.
IllegalArgumentException
- if param
is not a valid time,
as determined by isValidFor(Date)
.public void addFrom(String fileName, String tableType) throws FileNotFoundException, IOException
fileName
and adds it to this table.
fileName
- the name of the file that holds the data.tableType
- the particular type of table data in the file.
At the present time the only
supported type is "JPL". See
EphemerisTableReaderFactory.getNewReader(String)
for more details.
IllegalArgumentException
- if tableType
is cannot be
understood.
FileNotFoundException
- if no file can be found for fileName
.
IOException
- if anything goes wrong while reading the data.JplEphemerisTableReader
public void addFrom(InputStream in, String tableType) throws IOException, IllegalArgumentException
in
and adds it to this table.
in
- a stream that contains ephemeris data.tableType
- the particular type of table data in the stream.
At the present time the only
supported type is "JPL". See
EphemerisTableReaderFactory.getNewReader(String)
for more details.
IllegalArgumentException
- if tableType
is cannot be
understood.
IOException
- if anything goes wrong while reading the data.JplEphemerisTableReader
public static EphemerisTable createFrom(String fileName, String tableType) throws FileNotFoundException, IOException
fileName
- the name of a file that contains ephemeris data.tableType
- the particular type of table data in the stream.
At the present time the only
supported type is "JPL". See
EphemerisTableReaderFactory.getNewReader(String)
for more details.
IllegalArgumentException
- if tableType
is cannot be
understood.
FileNotFoundException
- if no file can be found for fileName
.
IOException
- if anything goes wrong while reading the data.addFrom(String, String)
public static EphemerisTable createFrom(InputStream in, String tableType) throws IOException
in
- a stream that contains ephemeris data.tableType
- the particular type of table data in the stream.
At the present time the only
supported type is "JPL". See
EphemerisTableReaderFactory.getNewReader(String)
for more details.
IllegalArgumentException
- if tableType
is cannot be
understood.
IOException
- if anything goes wrong while reading the data.addFrom(InputStream, String)
public int size()
public boolean isEmpty()
public void setInterpolatorClass(Class<? extends Interpolator> interpClass) throws IllegalAccessException, InstantiationException
Interpolator
that this table will use
for calculating positional values.
interpClass
- a class that implements Interpolator
.
IllegalAccessException
- if this method "does not have access to the
definition of the specified class" (see Sun's documentation on
this exception).
InstantiationException
- if "the specified class object cannot be
instantiated because it is an interface or is an abstract class"
(see Sun's documentation on this exception).public String toString()
The form of the returned string is:
time1;rightAscension1;declination1;distance1;velocity1; time2;rightAscension2;declination2;distance2;velocity2; ... timeN;rightAscensionN;declinationN;distanceN;velocityN;
toString
in class Object
public String toXml() throws JAXBException
JAXBException
- if anything goes wrong during the conversion to XML.public void writeAsXmlTo(Writer writer) throws JAXBException
writer
.
writer
- the device to which XML is written.
JAXBException
- if anything goes wrong during the conversion to XML.public static EphemerisTable fromXml(String xmlFile) throws JAXBException, XMLStreamException, FileNotFoundException
xmlFile
- the name of an XML file. This method will attempt to locate
the file by using Class.getResource(String)
.
FileNotFoundException
- if the XML file cannot be found.
JAXBException
- if the schema file used (if any) is malformed, if
the XML file cannot be read, or if the XML file is not
schema-valid.
XMLStreamException
- if there is a problem opening the XML file,
if the XML is not well-formed, or for some other
"unexpected processing conditions".public static EphemerisTable fromXml(Reader reader) throws JAXBException, XMLStreamException
reader
.
reader
- the source of the XML data.
If this value is null, null is returned.
reader
.
XMLStreamException
- if the XML is not well-formed,
or for some other "unexpected processing conditions".
JAXBException
- if anything else goes wrong during the
transformation.public EphemerisTable clone()
If anything goes wrong during the cloning procedure,
a RuntimeException
will be thrown.
clone
in interface SkyPosition
clone
in interface SphericalPosition
public boolean equals(Object o)
o
is equal to this table.
public int hashCode()
public void setCoordinateSystem(CelestialCoordinateSystem newSystem)
newSystem
is null, this method does nothing.
newSystem
- the system of latitude and longitude on which this
position is based.public CelestialCoordinateSystem getCoordinateSystem()
SkyPosition
getCoordinateSystem
in interface SkyPosition
public void setEpoch(Epoch newEpoch)
newEpoch
is null, this method does nothing.
newEpoch
- the epoch on which this position is based.public Epoch getEpoch()
SkyPosition
getEpoch
in interface SkyPosition
public void setOriginOfInformation(String origin)
origin
- the origin of this position's information. A value of
null will be replaced by a non-null default value.public String getOriginOfInformation()
SkyPosition
getOriginOfInformation
in interface SkyPosition
public Longitude getLongitude()
This is convenience method equivalent to getLongitude(new Date())
.
As such, whether or not the returned longitude is a reference to an
internally held object depends upon the behavior of
getLongitude(Date)
.
getLongitude
in interface SphericalPosition
public Latitude getLatitude()
This is convenience method equivalent to getLatitude(new Date())
.
As such, whether or not the returned latitude is a reference to an
internally held object depends upon the behavior of
getLatitude(Date)
.
getLatitude
in interface SphericalPosition
public Distance getDistance()
This is convenience method equivalent to getDistance(new Date())
.
As such, whether or not the returned distance is a reference to an
internally held object depends upon the behavior of
getDistance(Date)
.
getDistance
in interface SphericalPosition
public Latitude getLatitudeUncertainty()
Note that the object returned is not held internally by this position. This means that any changes made to the returned object by clients will not be reflected in this position.
getLatitudeUncertainty
in interface SphericalPosition
public Longitude getLongitudeUncertainty()
Note that the object returned is not held internally by this position. This means that any changes made to the returned object by clients will not be reflected in this position.
getLongitudeUncertainty
in interface SphericalPosition
public Distance getDistanceUncertainty()
Note that the object returned is not held internally by this position. This means that any changes made to the returned object by clients will not be reflected in this position.
getDistanceUncertainty
in interface SphericalPosition
public SkyPosition toPosition(CelestialCoordinateSystem system, Epoch epoch, EarthPosition observer, LocalSiderealTime lst) throws CoordinateConversionException
SkyPosition
toPosition
in interface SkyPosition
system
- the celestial coordinate system of the returned position.epoch
- the epoch of the returned position.observer
- the location of the observer. This value is used almost exclusively for
conversions to or from the HORIZONTAL (az/el) coordinate system.
If a given conversion does not require this parameter, a null
value will do no harm.lst
- the local sidereal time at the observer's location. This parameter
serves two purposes. First, it is integral in conversions to or from
the HORIZONTAL (az/el) coordinate system. Second, even for
conversions that do not depend on the observer's location, the conversion
method will use the UTC time represented by this LST to determine the
exact location of this position before converting it to another
system. When used this way the location associated with the LST is
immaterial. If this value is null it will be replaced with
the current time. Using a null value is not recommended when
dealing with the HORIZONTAL system because the LST may not
be for the location of interest.
system
, and
epoch of epoch
, and coordinates that represent a conversion
from those of this position.
CoordinateConversionException
- if anything goes wrong with the conversion.public SkyPosition toPosition(CelestialCoordinateSystem system, Epoch epoch, EarthPosition observer, LocalSiderealTime lst, CelestialCoordinateConverter converter) throws CoordinateConversionException
SkyPosition
toPosition
in interface SkyPosition
system
- the celestial coordinate system of the returned position.epoch
- the epoch of the returned position.observer
- the location of the observer. This value is used almost exclusively for
conversions to or from the HORIZONTAL (az/el) coordinate system.lst
- the local sidereal time at the observer's location. This parameter
serves two purposes. First, it is integral in conversions to or from
the HORIZONTAL (az/el) coordinate system. Second, even for
conversions that do not depend on the observer's location, the conversion
method will use the UTC time represented by this LST to determine the
exact location of this position before converting it to another
system. When used this way the location associated with the LST is
immaterial. If this value is null it will be replaced with
the current time. Using a null value is not recommended when
dealing with the HORIZONTAL system because the LST may not
be for the location of interest.converter
- the converter used to perform the transformation.
system
, and
epoch of epoch
, and coordinates that represent a conversion
from those of this position.
CoordinateConversionException
- if anything goes wrong with the conversion.public Angle getAngularSeparation(SphericalPosition other)
SphericalPosition
other
.
The distances of the positions from the center of the sphere are
not considered. The returned angle is the smallest possible
such angle. It is the angular size of the arc of a great circle that
passes through both the ray from the orgin to this position and the
ray from the origin to other
.
The returned value is never negative. This means that the returned angle does not contain directional information. That is, the angle from A to B is exactly equal to the angle from B to A.
getAngularSeparation
in interface SphericalPosition
other
- a position from which this one is separated by the
returned angle.
other
.public Angle getAngularSeparation(SphericalPosition other, Date time)
SkyPosition
other
at the given time.
The distances of the positions from the center of the sphere are
not considered. The returned angle is the smallest possible
such angle. It is the angular size of the arc of a great circle that
passes through both the ray from the orgin to this position and the
ray from the origin to other
.
The returned value is never negative. This means that the returned angle does not contain directional information. That is, the angle from A to B is exactly equal to the angle from B to A.
getAngularSeparation
in interface SkyPosition
other
- a position from which this one is separated by the
returned angle.time
- the point in time for which the separation is sought.
other
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |