edu.nrao.sss.measure
Class EquatorialArc<A extends EquatorialArc<A>>

java.lang.Object
  extended by edu.nrao.sss.measure.EquatorialArc<A>
All Implemented Interfaces:
Cloneable, Comparable<A>
Direct Known Subclasses:
Latitude, Longitude

public abstract class EquatorialArc<A extends EquatorialArc<A>>
extends Object
implements Cloneable, Comparable<A>

An arc of either latitude or longitude on a sphere.

Version Info:

$Revision: 1707 $
$Date: 2008-11-14 10:23:59 -0700 (Fri, 14 Nov 2008) $
$Author: dharland $ (last person to modify)

Since:
2006-05-25
Author:
David M. Harland

Method Summary
 A add(A otherArc)
          Adds the other arc to this one.
 A add(Angle addend)
          Adds the given angle to this arc.
 A add(BigDecimal amount)
          Adds amount, assumed to be in the same units as this arc, to this arc.
 A add(BigDecimal amount, ArcUnits units)
          Adds amount units to this arc.
 A add(String amount)
          Adds amount, assumed to be in the same units as this arc, to this arc.
 A add(String amount, ArcUnits units)
          Adds amount units to this arc.
 A clone()
          Returns an arc that is equal to this one.
 int compareTo(A otherArc)
          Compares this arc with the otherArc for order.
 A convertTo(ArcUnits newUnits)
          Converts this arc to the new units.
 boolean equals(Object o)
          Returns true if o is equal to this arc.
 ArcUnits getUnits()
          Returns the units of this arc.
 BigDecimal getValue()
          Returns the magnitude of this arc.
 int hashCode()
          Returns a hash code value for this arc.
 void set(BigDecimal newValue, ArcUnits newUnits)
          Sets the magnitude and units of this arc.
 void set(String newValue, ArcUnits newUnits)
          Sets the magnitude and units of this arc.
 A subtract(A otherArc)
          Subtracts the other arc from this one.
 A subtract(Angle subtrahend)
          Subtracts the given angle from this arc.
 A subtract(BigDecimal amount)
          Subtracts amount, assumed to be in the same units as this declination, from this arc.
 A subtract(BigDecimal amount, ArcUnits units)
          Subtracts amount units from this arc.
 A subtract(String amount)
          Subtracts amount, assumed to be in the same units as this declination, from this arc.
 A subtract(String amount, ArcUnits units)
          Subtracts amount units from this arc.
 Angle toAngle()
          Returns this arc as an Angle.
 Number[] toDms()
          Returns a representation of this arc in degrees, minutes, and seconds.
 Number[] toHms()
          Returns a representation of this arc in hours, minutes, and seconds.
 String toString()
          Returns a text representation of this arc.
 String toString(int minFracDigits, int maxFracDigits)
          Returns a text representation of this arc.
 String toStringDms()
          Returns a text representation of this angle in degrees, arc-minutes, and arc-seconds.
 String toStringDms(int minFracDigits, int maxFracDigits)
          Returns a text representation of this angle in degrees, arc-minutes, and arc-seconds.
 String toStringDmsHtml(int minFracDigits, int maxFracDigits)
          Returns a text representation of this angle in degrees, arc-minutes, and arc-seconds, with HTML-friendly symbols.
 String toStringHms()
          Returns a text representation of this angle in hours, minutes, and seconds.
 String toStringHms(int minFracDigits, int maxFracDigits)
          Returns a text representation of this angle in hours, minutes, and seconds.
 BigDecimal toUnits(ArcUnits otherUnits)
          Returns the magnitude of this arc in otherUnits.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getValue

public BigDecimal getValue()
Returns the magnitude of this arc.

Returns:
the magnitude of this arc.

getUnits

public ArcUnits getUnits()
Returns the units of this arc.

Returns:
the units of this arc.

set

public void set(BigDecimal newValue,
                ArcUnits newUnits)
Sets the magnitude and units of this arc.

Parameters:
newValue - the new magnitude for this arc.
newUnits - the new units for this declination.
Throws:
IllegalArgumentException - if the new value is outside of its legal range.

set

public void set(String newValue,
                ArcUnits newUnits)
Sets the magnitude and units of this arc.

Parameters:
newValue - the new magnitude for this arc.
newUnits - the new units for this declination.
Throws:
IllegalArgumentException - if the new value is outside of its legal range.

add

public A add(BigDecimal amount)
Adds amount, assumed to be in the same units as this arc, to this arc.

If the addition of amount leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
amount - an amount to be added to this arc.
Returns:
this arc, after the addition.

add

public A add(String amount)
Adds amount, assumed to be in the same units as this arc, to this arc.

If the addition of amount leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
amount - an amount to be added to this arc.
Returns:
this arc, after the addition.

add

public A add(BigDecimal amount,
             ArcUnits units)
Adds amount units to this arc.

If the addition of amount leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
amount - an amount to be added to this arc.
units - the units in which amount is expressed.
Returns:
this arc, after the addition.

add

public A add(String amount,
             ArcUnits units)
Adds amount units to this arc.

If the addition of amount leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
amount - an amount to be added to this arc.
units - the units in which amount is expressed.
Returns:
this arc, after the addition.

add

public A add(Angle addend)
Adds the given angle to this arc.

If the addition of addend leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
addend - an angle to be added to this one.
Returns:
this arc, after the addition.

add

public A add(A otherArc)
Adds the other arc to this one.

If the addition of otherArc leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
otherArc - an arc to be added to this one.
Returns:
this arc, after the addition.

subtract

public A subtract(BigDecimal amount)
Subtracts amount, assumed to be in the same units as this declination, from this arc.

If the subtraction of amount leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
amount - an amount to be subtracted from this arc.
Returns:
this arc, after the subtraction.

subtract

public A subtract(String amount)
Subtracts amount, assumed to be in the same units as this declination, from this arc.

If the subtraction of amount leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
amount - an amount to be subtracted from this arc.
Returns:
this arc, after the subtraction.

subtract

public A subtract(BigDecimal amount,
                  ArcUnits units)
Subtracts amount units from this arc.

If the subtraction of amount leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
amount - an amount to be subtracted from this arc.
units - the units in which amount is expressed.
Returns:
this arc, after the subtraction.

subtract

public A subtract(String amount,
                  ArcUnits units)
Subtracts amount units from this arc.

If the subtraction of amount leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
amount - an amount to be subtracted from this arc.
units - the units in which amount is expressed.
Returns:
this arc, after the subtraction.

subtract

public A subtract(Angle subtrahend)
Subtracts the given angle from this arc.

If the subtraction of subtrahend leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
subtrahend - an angle to be subtracted from this one.
Returns:
this arc, after the subtraction.

subtract

public A subtract(A otherArc)
Subtracts the other arc from this one.

If the subtraction of otherArc leads to a value that is out of bounds, the result will be normalized in such a way that it is the equivalent in-bounds value.

Parameters:
otherArc - an arc to be subtracted from this one.
Returns:
this arc, after the subtraction.

convertTo

public A convertTo(ArcUnits newUnits)
Converts this arc to the new units.

After this method is complete this arc will have units of units and its value will have been converted accordingly.

Parameters:
newUnits - the new units for this arc. If newUnits is null it will be treated as ArcUnits.DEGREE.
Returns:
this arc. The reason for this return type is to allow code of this nature: double radians = myArc.convertTo(ArcUnits.RADIAN).getValue();

toUnits

public BigDecimal toUnits(ArcUnits otherUnits)
Returns the magnitude of this arc in otherUnits.

Note that this method does not alter the state of this arc. Contrast this with convertTo(ArcUnits).

Parameters:
otherUnits - the units in which to express this arc's magnitude.
Returns:
this arc's value converted to otherUnits.

toAngle

public Angle toAngle()
Returns this arc as an Angle. The returned angle is not referenced by this arc, so any changes made to it will not affect this object. Clients may manipulate the returned angle in ways that might not have been legal for this arc.

Returns:
this arc expressed as an angle.

toDms

public Number[] toDms()
Returns a representation of this arc in degrees, minutes, and seconds.

Returns:
an array of size three in this order:
  1. An integral number of degrees.
  2. An integral number of arc minutes.
  3. A real number of arc seconds.

toHms

public Number[] toHms()
Returns a representation of this arc in hours, minutes, and seconds.

Returns:
an array of size three in this order:
  1. An integral number of hours.
  2. An integral number of minutes.
  3. A real number of seconds.

toString

public String toString()
Returns a text representation of this arc.

Overrides:
toString in class Object

toString

public String toString(int minFracDigits,
                       int maxFracDigits)
Returns a text representation of this arc.

Parameters:
minFracDigits - the minimum number of places after the decimal point.
maxFracDigits - the maximum number of places after the decimal point.

toStringHms

public String toStringHms()
Returns a text representation of this angle in hours, minutes, and seconds.


toStringHms

public String toStringHms(int minFracDigits,
                          int maxFracDigits)
Returns a text representation of this angle in hours, minutes, and seconds.

Parameters:
minFracDigits - the minimum number of places after the decimal point for the seconds field.
maxFracDigits - the maximum number of places after the decimal point for the seconds field.

toStringDms

public String toStringDms()
Returns a text representation of this angle in degrees, arc-minutes, and arc-seconds.


toStringDms

public String toStringDms(int minFracDigits,
                          int maxFracDigits)
Returns a text representation of this angle in degrees, arc-minutes, and arc-seconds.

Parameters:
minFracDigits - the minimum number of places after the decimal point for the seconds field.
maxFracDigits - the maximum number of places after the decimal point for the seconds field.

toStringDmsHtml

public String toStringDmsHtml(int minFracDigits,
                              int maxFracDigits)
Returns a text representation of this angle in degrees, arc-minutes, and arc-seconds, with HTML-friendly symbols.

Parameters:
minFracDigits - the minimum number of places after the decimal point for the seconds field.
maxFracDigits - the maximum number of places after the decimal point for the seconds field.

clone

public A clone()
Returns an arc that is equal to this one.

Overrides:
clone in class Object

equals

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

Overrides:
equals in class Object

hashCode

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

Overrides:
hashCode in class Object

compareTo

public int compareTo(A otherArc)
Compares this arc with the otherArc for order.

Specified by:
compareTo in interface Comparable<A extends EquatorialArc<A>>


Copyright © 2009. All Rights Reserved.