edu.nrao.sss.astronomy
Class PolynomialPositionTable

java.lang.Object
  extended by edu.nrao.sss.astronomy.PolynomialPositionTable
All Implemented Interfaces:
SkyPosition, SphericalPosition, Cloneable

public class PolynomialPositionTable
extends Object
implements SkyPosition

A table of polynomial positions.

This table is sorted according to the natural order of PolynomialPosition, which will result in positions with the earliest valid time intervals preceding those with later intervals. This table is kept in sorted order at all times.

Version Info:

$Revision: 1156 $
$Date: 2008-03-12 11:43:13 -0600 (Wed, 12 Mar 2008) $
$Author: dharland $

Since:
2007-04-17
Author:
David M. Harland

Constructor Summary
PolynomialPositionTable()
          Creates a new instance.
 
Method Summary
 boolean add(PolynomialPosition newPosition)
          Adds newPosition to this table.
 PolynomialPositionTable clone()
          Returns a copy of this table.
 boolean equals(Object o)
          Returns true if o is equal to this table.
 PolynomialPosition get(Date time)
          Returns a position for which time is a valid time.
 PolynomialPosition get(int index)
          Returns the position at index.
 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 from an origin.
 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.
 List<PolynomialPosition> getEntries()
          Returns a new list that contains references to all the entries in this table.
 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.
 int hashCode()
          Returns a hash code value for this table.
 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 table has one or more positions for which time is a valid time.
 boolean isWellFormed()
          Returns true if the valid time intervals of the positions of this table do not overlap and do not contain gaps.
 PolynomialPosition remove(int index)
          Removes the indexth position from this table.
 boolean remove(PolynomialPosition unwantedPosition)
          Removes the first occurrence of the unwanted position from this table.
 void reset()
          Clears all entries from this table.
 PolynomialPosition set(int index, PolynomialPosition replacement)
          Replaces the position currently at index with replacement.
 void setCoordinateSystem(CelestialCoordinateSystem newSystem)
          Sets the coordinate system of all entries in this table.
 void setEpoch(Epoch newEpoch)
          Sets the epoch of all entries in this table.
 void setOriginOfInformation(String newOrigin)
          Sets the origin of information of all entries in this table.
 int size()
          Returns the number of entries in this table.
 void sort()
          Sorts this table so that its entries are in their natural order.
 void sort(Comparator<PolynomialPosition> comparator)
          Sorts this table so that its entries are in the order dictated by comparator.
 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.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolynomialPositionTable

public PolynomialPositionTable()
Creates a new instance.

Method Detail

reset

public void reset()
Clears all entries from this table. A reset table is equivalent to a new table created via the no-argument constructor.


isMoving

public boolean isMoving()
Description copied from interface: SkyPosition
Returns true if this position has different properties at time T than it does at time U ≠ T.

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.

Specified by:
isMoving in interface SkyPosition
Returns:
true if this position is moving.

setCoordinateSystem

public void setCoordinateSystem(CelestialCoordinateSystem newSystem)
Sets the coordinate system of all entries in this table. If newSystem is null, this method does nothing.

Parameters:
newSystem - the new coordinate system for all entries in this table.

setEpoch

public void setEpoch(Epoch newEpoch)
Sets the epoch of all entries in this table. If newEpoch is null, this method does nothing.

Parameters:
newEpoch - the new epoch for all entries in this table.

setOriginOfInformation

public void setOriginOfInformation(String newOrigin)
Sets the origin of information of all entries in this table. If newOrigin is null, this method does nothing.

Parameters:
newOrigin - the new origin of information for all entries in this table.

add

public boolean add(PolynomialPosition newPosition)
Adds newPosition to this table.

If newPosition is null, this method does nothing. Otherwise this table will hold a reference to newPosition. This means that any changes made to newPosition after a call to this method will be reflected in this object.

Parameters:
newPosition - a new position to be added to this table.
Returns:
true if newPosition was added to this table.

remove

public boolean remove(PolynomialPosition unwantedPosition)
Removes the first occurrence of the unwanted position from this table.

Parameters:
unwantedPosition - a position to be removed from this table.
Returns:
true if the unwanted position was removed.

remove

public PolynomialPosition remove(int index)
Removes the indexth position from this table.

Parameters:
index - to index of the position to be removed.
Returns:
the position that had been at index.

set

public PolynomialPosition set(int index,
                              PolynomialPosition replacement)
Replaces the position currently at index with replacement.

If newPosition is null, this method does nothing. Otherwise this table will hold a reference to newPosition. This means that any changes made to newPosition after a call to this method will be reflected in this object.

Parameters:
index - the index of the position to be replaced.
replacement - the new position for the indexth slot in this table.
Returns:
the position that had been at index.

get

public PolynomialPosition get(int index)
Returns the position at index.

Note that the returned position is the one actually held by this table. This means that any changes made to it after a call to this method will be reflected in this object.

Parameters:
index - the index of the desired position.
Returns:
a reference to the position at index.

get

public PolynomialPosition get(Date time)
Returns a position for which time is a valid time.

If this table has no such position, null is returned. If this table has more than one such position, the one held at the index of lowest value will be returned. Just which position that is depends on whether, and how, this table was most recently sorted by its clients.

Note that the returned position is the one actually held by this table. This means that any changes made to it after a call to this method will be reflected in this object.

Parameters:
time - the time for which a position is desired. The returned position, unless it is null will have a valid time interval that contains this value.
Returns:
the a position for which time is a valid time, or null if this table has no such position.

getEntries

public List<PolynomialPosition> getEntries()
Returns a new list that contains references to all the entries in this table. The entries are ordered in the list in the same way they are ordered in this table.

Returns:
a new list of this table's entries.

size

public int size()
Returns the number of entries in this table.

Returns:
the size of this table.

isValidFor

public boolean isValidFor(Date time)
Returns true if this table has one or more positions for which time is a valid time.

Parameters:
time - the time for which a valid position is sought.
Returns:
true if this table has one or more positions for which time is a valid time.

isWellFormed

public boolean isWellFormed()
Returns true if the valid time intervals of the positions of this table do not overlap and do not contain gaps. Note that by this definition an empty table is well formed.

Returns:
true if the valid time intervals of the positions of this table are contiguous.

sort

public void sort()
Sorts this table so that its entries are in their natural order.


sort

public void sort(Comparator<PolynomialPosition> comparator)
Sorts this table so that its entries are in the order dictated by comparator.


getType

public SkyPositionType getType()
Description copied from interface: SkyPosition
Provides a hint as to how this position stores its information.

Specified by:
getType in interface SkyPosition
Returns:
a hint as to how this position stores its information.

getCoordinateSystem

public CelestialCoordinateSystem getCoordinateSystem()
Description copied from interface: SkyPosition
Returns the coordinate system to use when interpreting the latitude and longitude values of this position.

Specified by:
getCoordinateSystem in interface SkyPosition
Returns:
the system of latitude and longitude used by this position.

getEpoch

public Epoch getEpoch()
Description copied from interface: SkyPosition
Returns the epoch on which this position is based.

Specified by:
getEpoch in interface SkyPosition
Returns:
the epoch on which this position is based.

getOriginOfInformation

public String getOriginOfInformation()
Description copied from interface: SkyPosition
Returns the origin of this position's information.

Specified by:
getOriginOfInformation in interface SkyPosition
Returns:
the origin of this position's information.

getLongitude

public Longitude getLongitude()
Description copied from interface: SphericalPosition
Returns the current longitude of this position.

Classes that implement this interface are free to choose whether to return a reference to their internal longitudes, or to provide copies thereof. This means that clients of this interface should not write code that manipulates the returned object and relies on those changes being reflected in this object, unless they know they are using an implementation that returns internal references.

Specified by:
getLongitude in interface SphericalPosition
Returns:
the current longitude of this position.

getLatitude

public Latitude getLatitude()
Description copied from interface: SphericalPosition
Returns the current latitude of this position.

Classes that implement this interface are free to choose whether to return a reference to their internal latitudes, or to provide copies thereof. This means that clients of this interface should not write code that manipulates the returned object and relies on those changes being reflected in this object, unless they know they are using an implementation that returns internal references.

Specified by:
getLatitude in interface SphericalPosition
Returns:
the current latitude of this position.

getDistance

public Distance getDistance()
Description copied from interface: SphericalPosition
Returns the current distance of this position from an origin.

Classes that implement this interface are free to choose whether to return a reference to their internal distances, or to provide copies thereof. This means that clients of this interface should not write code that manipulates the returned object and relies on those changes being reflected in this object, unless they know they are using an implementation that returns internal references.

Specified by:
getDistance in interface SphericalPosition
Returns:
the current distance of this position from an origin.

getLongitude

public Longitude getLongitude(Date time)
Description copied from interface: SkyPosition
Returns the longitude of this position at the given point in time.

Classes that implement this interface are free to choose whether to return a reference to their internal longitudes, or to provide copies thereof. This means that clients of this interface should not write code that manipulates the returned object and relies on those changes being reflected in this object, unless they know they are using an implementation that returns internal references.

Specified by:
getLongitude in interface SkyPosition
Parameters:
time - the point in time for which the longitude is sought.
Returns:
the longitude at the given point in time.

getLatitude

public Latitude getLatitude(Date time)
Description copied from interface: SkyPosition
Returns the latitude of this position at the given point in time.

Classes that implement this interface are free to choose whether to return a reference to their internal latitudes, or to provide copies thereof. This means that clients of this interface should not write code that manipulates the returned object and relies on those changes being reflected in this object, unless they know they are using an implementation that returns internal references.

Specified by:
getLatitude in interface SkyPosition
Parameters:
time - the point in time for which the latitude is sought.
Returns:
the latitude at the given point in time.

getDistance

public Distance getDistance(Date time)
Description copied from interface: SkyPosition
Returns the distance of this position at the given point in time.

Classes that implement this interface are free to choose whether to return a reference to their internal distances, or to provide copies thereof. This means that clients of this interface should not write code that manipulates the returned object and relies on those changes being reflected in this object, unless they know they are using an implementation that returns internal references.

Specified by:
getDistance in interface SkyPosition
Parameters:
time - the point in time for which the distance is sought.
Returns:
the distance at the given point in time.

getLongitudeUncertainty

public Longitude getLongitudeUncertainty()
Description copied from interface: SphericalPosition
Returns the uncertainty in the longitude of this position.

Classes that implement this interface are free to choose whether to return a reference to their internal uncertainties, or to provide copies thereof. This means that clients of this interface should not write code that manipulates the returned object and relies on those changes being reflected in this object, unless they know they are using an implementation that returns internal references.

Specified by:
getLongitudeUncertainty in interface SphericalPosition
Returns:
the uncertainty in the longitude of this position.

getLatitudeUncertainty

public Latitude getLatitudeUncertainty()
Description copied from interface: SphericalPosition
Returns the uncertainty in the latitude of this position.

Classes that implement this interface are free to choose whether to return a reference to their internal uncertainties, or to provide copies thereof. This means that clients of this interface should not write code that manipulates the returned object and relies on those changes being reflected in this object, unless they know they are using an implementation that returns internal references.

Specified by:
getLatitudeUncertainty in interface SphericalPosition
Returns:
the uncertainty in the latitude of this position.

getDistanceUncertainty

public Distance getDistanceUncertainty()
Description copied from interface: SphericalPosition
Returns the uncertainty in the distance of this position.

Classes that implement this interface are free to choose whether to return a reference to their internal uncertainties, or to provide copies thereof. This means that clients of this interface should not write code that manipulates the returned object and relies on those changes being reflected in this object, unless they know they are using an implementation that returns internal references.

Specified by:
getDistanceUncertainty in interface SphericalPosition
Returns:
the uncertainty in the distance of this position.

getAngularSeparation

public Angle getAngularSeparation(SphericalPosition other)
Description copied from interface: SphericalPosition
Calculates the current angular separation between this position and 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.

Specified by:
getAngularSeparation in interface SphericalPosition
Parameters:
other - a position from which this one is separated by the returned angle.
Returns:
the angle of separation between this position and other.

getAngularSeparation

public Angle getAngularSeparation(SphericalPosition other,
                                  Date time)
Description copied from interface: SkyPosition
Calculates current angular separation between this position and 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.

Specified by:
getAngularSeparation in interface SkyPosition
Parameters:
other - a position from which this one is separated by the returned angle.
time - the point in time for which the separation is sought.
Returns:
the angle of separation between this position and other.

toPosition

public SkyPosition toPosition(CelestialCoordinateSystem system,
                              Epoch epoch,
                              EarthPosition observer,
                              LocalSiderealTime lst)
                       throws CoordinateConversionException
Description copied from interface: SkyPosition
Returns a new position expressed in the given coordinate system and epoch that is equivalent to this position. This position is not changed by this method.

Specified by:
toPosition in interface SkyPosition
Parameters:
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.
Returns:
a new position with a coordinate system of system, and epoch of epoch, and coordinates that represent a conversion from those of this position.
Throws:
CoordinateConversionException - if anything goes wrong with the conversion.

toPosition

public SkyPosition toPosition(CelestialCoordinateSystem system,
                              Epoch epoch,
                              EarthPosition observer,
                              LocalSiderealTime lst,
                              CelestialCoordinateConverter converter)
                       throws CoordinateConversionException
Description copied from interface: SkyPosition
Returns a new position expressed in the given coordinate system and epoch that is equivalent to this position. This position is not changed by this method.

Specified by:
toPosition in interface SkyPosition
Parameters:
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.
Returns:
a new position with a coordinate system of system, and epoch of epoch, and coordinates that represent a conversion from those of this position.
Throws:
CoordinateConversionException - if anything goes wrong with the conversion.

clone

public PolynomialPositionTable clone()
Returns a copy of this table.

If anything goes wrong during the cloning procedure, a RuntimeException will be thrown.

Specified by:
clone in interface SkyPosition
Specified by:
clone in interface SphericalPosition
Overrides:
clone in class Object
Returns:
a copy of this sky position.

equals

public boolean equals(Object o)
Returns true if o is equal to this table.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns a hash code value for this table.

Overrides:
hashCode in class Object


Copyright © 2009. All Rights Reserved.