faa.tg.units
Class Latitude

java.lang.Object
  extended by faa.tg.units.AMeasure
      extended by faa.tg.units.Angle
          extended by faa.tg.units.Latitude
All Implemented Interfaces:
HasText, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<AMeasure>

public class Latitude
extends Angle
implements java.lang.Cloneable

 Latitude represents the object for measuring units of Latitude.
 The standard map sign conventions used are:
   North latitude = "+" degrees,
   South latitude = "-" degrees.      
See section 5.6 of the Detailed Design Document for a discussion of design issues. See the source: Latitude.java

Version:
$Id: Latitude.java,v 3.6 2008/08/07 19:59:03 lykensj Exp $
Author:
Tim Kimmet (modeled after Robert G. Oliver's Units Classes)
See Also:
AUnits, AMeasure, Angle, Longitude, Serialized Form

Field Summary
static java.lang.String CVS_VERSION_ID
          The CVS Version ID.
static Latitude MAX
           
static Latitude MIN
           
(package private) static long serialVersionUID
           
static Latitude ZERO
           
 
Fields inherited from class faa.tg.units.Angle
D180_DIV_PI, DEG_1, DEG_180, DEG_270, DEG_30, DEG_330, DEG_5, DEG_60, DEG_90, DEG_NEG180, DEG_NEG270, DEG_NEG30, DEG_NEG5, DEG_NEG90, DEG_PER_RAD, NEG_NINETY_DEG, NEG_ONEEIGHTY_DEG, NINETY_DEG, ONEEIGHTY_DEG, PI, PI_DIV_180, PI_DIV_2, PI_DIV_4, PI_MUL_2, PI_MUL_4, RAD_PER_DEG, THIRTY_DEG, THREETHIRTY_DEG, TWOSEVENTY_DEG
 
Fields inherited from class faa.tg.units.AMeasure
DEC0, DEC0_, DEC00, DEC000, DEC1, DEC1_, DEC12, DEC12_, DEC1L, DEC1L_, DEC2, DEC2_, DEC3, DEC3_, DEC4, DEC4_, DEC5, DEC5_, DEC6, DEC6_, DEC7, DEC7_, DEC9, DEC9_, itsValue, TIME_FRACTION
 
Constructor Summary
Latitude(DMSString dms)
          Constructor for the Latitude class.
Latitude(double theValue, AngleUnits theUnits)
          Constructor for the Latitude class.
Latitude(Latitude origLat, LatitudeRate rate, Time timeToTravel)
          Constructor for the Latitude class that uses a reference latitude, a latitude rate and a time interval to travel at the specified rate.
Latitude(java.lang.String dms)
          Constructor for the Latitude class that takes a string with degrees or degrees-minutes-seconds in DD-MM-SS[.SSS] (and a few other formats).
 
Method Summary
 Latitude add(Latitude theMeasure)
          This summation method adds a value with like units.
 void checkValid()
          Checks for an invalid Latitude (value must be in range -90 to 90).
 boolean eq(Latitude theMeasure)
          This method provides a test for equality.
 boolean ge(Latitude theMeasure)
          This method provides a test for greater than / equal to.
 boolean gt(Latitude theMeasure)
          This method provides a test for greater than.
 boolean le(Latitude theMeasure)
          This method provides a test for less than / equal to.
 boolean lt(Latitude theMeasure)
          This method provides a test for less than.
static void main(java.lang.String[] args)
          Test case for Latitude that displays parsed parameter as degrees, as a DDD-MM-SS string, and as radians.
 double ratio(Latitude val)
          This division method produces a dimensionless ratio of like measures.
 Latitude sub(Latitude theMeasure)
          This subtraction method subtracts a value with like units.
 java.lang.String toDmsString()
          Converts Latitude to a string of form DD-MM-SS.SSSd (~0.1 ft precision).
 java.lang.String toString()
          Returns a String representation of this object in the form with which it was created.
 java.lang.String toXpvdString()
          Converts Latitude to a string of the format used as XPVD input: DDMMSS.
 
Methods inherited from class faa.tg.units.Angle
abs, add, aeq, as, average, cos, diff, eq, ge, gt, isBetween, le, lt, parseDmsString, ratio, reciprocalAngle, removeDelimiters, sin, sub, tan, toRadialString, toText
 
Methods inherited from class faa.tg.units.AMeasure
absoluteValue, add, as, as, clone, compareTo, debug, div, eq, equals, ge, getAUnit, getCanonicalUnit, getCanonicalValue, getInitialUnit, getUnitClass, gt, hashCode, isBetween, le, lt, mul, ratio, sub, toAMeasure, toString, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

CVS_VERSION_ID

public static final java.lang.String CVS_VERSION_ID
The CVS Version ID.

See Also:
Constant Field Values

ZERO

public static final Latitude ZERO

MAX

public static final Latitude MAX

MIN

public static final Latitude MIN
Constructor Detail

Latitude

public Latitude(double theValue,
                AngleUnits theUnits)
         throws java.lang.NumberFormatException
Constructor for the Latitude class.

Parameters:
theValue - The magnitude of the latitude as a double.
theUnits - The units of the value that will be stored (ex: deg)
Throws:
java.lang.NumberFormatException
See Also:
Units

Latitude

public Latitude(java.lang.String dms)
         throws java.lang.NumberFormatException
Constructor for the Latitude class that takes a string with degrees or degrees-minutes-seconds in DD-MM-SS[.SSS] (and a few other formats).

Parameters:
dms - A String containing a DMS string.
Throws:
java.lang.NumberFormatException
See Also:
for format list.

Latitude

public Latitude(DMSString dms)
         throws java.lang.NumberFormatException
Constructor for the Latitude class.

Parameters:
dms - A string of type DMSString.
Throws:
java.lang.NumberFormatException

Latitude

public Latitude(Latitude origLat,
                LatitudeRate rate,
                Time timeToTravel)
Constructor for the Latitude class that uses a reference latitude, a latitude rate and a time interval to travel at the specified rate.

Parameters:
origLat - The reference latitude to travel from.
rate - The rate of change of the latitude.
timeToTravel - The time interval to travel at the specified rate.
Method Detail

checkValid

public void checkValid()
                throws java.lang.NumberFormatException
Checks for an invalid Latitude (value must be in range -90 to 90).

Throws:
java.lang.NumberFormatException - If value was invalid.

add

public Latitude add(Latitude theMeasure)
This summation method adds a value with like units. It overrides the method in the superclass and checks for like AMeasures as well as doing the cast for you. Warning: This does not normalize. When you fly off of the grid, who knows what will happen

Parameters:
theMeasure - The latitude you wish to add to this measure.
Returns:
A new Latitude containing the sum.

sub

public Latitude sub(Latitude theMeasure)
This subtraction method subtracts a value with like units. It overrides the method in the superclass and checks for like AMeasures as well as doing the cast for you. Warning: This does not normalize. When you fly off of the grid, who knows what will happen

Parameters:
theMeasure - The latitude you wish to subtract from this measure.
Returns:
A new Latitude containing the difference.

ratio

public double ratio(Latitude val)
This division method produces a dimensionless ratio of like measures.

Returns:
The ratio of the two measures.

eq

public boolean eq(Latitude theMeasure)
This method provides a test for equality. It overrides the method in the superclass and checks for like AMeasures as well as doing the cast for you.

Returns:
Returns boolean indicating whether values are equal.

lt

public boolean lt(Latitude theMeasure)
This method provides a test for less than. It overrides the method in the superclass and checks for like AMeasures as well as doing the cast for you.

Returns:
Returns whether this value is less than the given value.

gt

public boolean gt(Latitude theMeasure)
This method provides a test for greater than. It overrides the method in the superclass and checks for like AMeasures as well as doing the cast for you.

Returns:
Returns whether this value is greater than the given value.

ge

public boolean ge(Latitude theMeasure)
This method provides a test for greater than / equal to. It overrides the method in the superclass and checks for like AMeasures as well as doing the cast for you.

Returns:
Returns result of test for less than or equal to.

le

public boolean le(Latitude theMeasure)
This method provides a test for less than / equal to. It overrides the method in the superclass and checks for like AMeasures as well as doing the cast for you.

Returns:
Returns result of test for greater than or equal to.

toDmsString

public java.lang.String toDmsString()
Converts Latitude to a string of form DD-MM-SS.SSSd (~0.1 ft precision).

Overrides:
toDmsString in class Angle
Returns:
String formatted as "DD-MM-SS.SSS[N|S]" (~0.1 ft precision).

toString

public java.lang.String toString()
Returns a String representation of this object in the form with which it was created.

Overrides:
toString in class Angle
Returns:
A String representing the measure in the canonical unit.
See Also:
Units

toXpvdString

public java.lang.String toXpvdString()
Converts Latitude to a string of the format used as XPVD input: DDMMSS.

Returns:
String formatted in the XPVD format "DDMMSS".

main

public static void main(java.lang.String[] args)
Test case for Latitude that displays parsed parameter as degrees, as a DDD-MM-SS string, and as radians.