edu.nrao.sss.model.project.scan
Class PointingPosition

java.lang.Object
  extended by edu.nrao.sss.model.project.scan.PointingPosition
All Implemented Interfaces:
Cloneable

public class PointingPosition
extends Object
implements Cloneable

A position used by a PointingScan.

This position may be used as either an offset or an absolute position by its containing client. Likewise, the interpretation of the position angles (as declinations, altitudes, or latitudes, for example) is left to the clients of this class.

CVS Info:

$Revision: 1494 $
$Date: 2008-08-14 13:51:17 -0600 (Thu, 14 Aug 2008) $
$Author: dharland $ (last person to modify)

Since:
2006-07-10
Author:
David M. Harland

Constructor Summary
PointingPosition()
          Creates a new instance.
 
Method Summary
 PointingPosition clone()
          Returns a position that is a copy of this one.
 boolean equals(Object o)
          Returns true if o is equal to this position.
 ScanTimeType getDurationType()
          Returns the type of duration used by this position.
 Angle getLatitude()
          Returns the latitudinal angle of this position.
 Angle getLongitude()
          Returns the longitudinal angle of this position.
 TimeDuration getTimeAtPosition()
          Returns the amount of time that the containing scan should spend at this position.
 ScanTimeSpecification getTimeSpec()
          A convenience method for fetching the time spent at this position.
 int hashCode()
          Returns a hash code value for this position.
 void setDurationType(ScanTimeType newType)
          Sets a new duration type for this position.
 void setLatitude(Angle latitude)
          Sets the latitudinal angle of this position.
 void setLongitude(Angle longitude)
          Sets the longitudinal angle of this position.
 void setTimeAtPosition(TimeDuration duration)
          Sets the amount of time that the containing scan should spend at this position.
 void setTimeSpec(ScanTimeSpecification newSpec)
          A convenience method for setting the time spent at this position.
 String toString()
          Returns a text representation of this pointing position.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PointingPosition

public PointingPosition()
Creates a new instance.

Method Detail

setLatitude

public void setLatitude(Angle latitude)
Sets the latitudinal angle of this position.

If latitude is null, it will be treated as an non-null latitude of size zero.

Parameters:
latitude - the latitudinal angle of this position.

getLatitude

public Angle getLatitude()
Returns the latitudinal angle of this position.

The returned value is guaranteed to be non-null. It is also the angle that is held internally by this position, so any changes made to the returned angle will be reflected in this object.

Returns:
the latitudinal angle of this position.

setLongitude

public void setLongitude(Angle longitude)
Sets the longitudinal angle of this position.

If longitude is null, it will be treated as an non-null longitude of size zero.

Parameters:
longitude - the longitudinal angle of this position.

getLongitude

public Angle getLongitude()
Returns the longitudinal angle of this position.

The returned value is guaranteed to be non-null. It is also the angle that is held internally by this position, so any changes made to the returned angle will be reflected in this object.

Returns:
the longitudinal angle of this position.

setTimeAtPosition

public void setTimeAtPosition(TimeDuration duration)
Sets the amount of time that the containing scan should spend at this position.

If duration is null, it will be treated as an non-null duration of size zero.

Parameters:
duration - the amount of time that should be spent at this position.

getTimeAtPosition

public TimeDuration getTimeAtPosition()
Returns the amount of time that the containing scan should spend at this position.

The returned value is guaranteed to be non-null. It is also the duration that is held internally by this offset, so any changes made to the returned duration will be reflected in this object.

Returns:
the amount of time that should be spent at this position.

setDurationType

public void setDurationType(ScanTimeType newType)
Sets a new duration type for this position.

Parameters:
newType - the new duration type for this position. If this value is null, the default duration type of ON_SOURCE_SIDEREAL will be used. This value must have its isDuration() method return true. If it does not, an IllegalArgumentException is thrown.
Throws:
IllegalArgumentException - if newType is not a duration type.

getDurationType

public ScanTimeType getDurationType()
Returns the type of duration used by this position. This method helps clients interpret the value returned by getTimeAtPosition().

The returned type will be non-null and its isDuration() method will always return true.

Returns:
the type of duration used by this position.

setTimeSpec

public void setTimeSpec(ScanTimeSpecification newSpec)
A convenience method for setting the time spent at this position. This position will not hold a reference to newSpec. Instead, this method will use its getTimeType() and getDuration() methods to set the time at position and duration type of this object.

Parameters:
newSpec - the provider of the time at position and duration type values for this position. A value of null will result in a NullPointerException.
Throws:
IllegalArgumentException - if the time type held by newSpec is not a duration type.

getTimeSpec

public ScanTimeSpecification getTimeSpec()
A convenience method for fetching the time spent at this position. The returned object is guaranteed to be non-null. It is not referenced internally by this position, so any changes made to it by clients will not affect this object.

Returns:
the time at offset and duration type of this offset.

toString

public String toString()
Returns a text representation of this pointing position. The returned string is of the form longitude,latitude,timeAtPosition.

Overrides:
toString in class Object

clone

public PointingPosition clone()
Returns a position that is a copy of this one.

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

Overrides:
clone in class Object

equals

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

Overrides:
equals in class Object

hashCode

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

Overrides:
hashCode in class Object


Copyright © 2009. All Rights Reserved.