uavsim.datatypes
Class Altitude

java.lang.Object
  extended by uavsim.datatypes.Altitude
All Implemented Interfaces:
java.lang.Comparable<Altitude>, I_Unitable<Altitude>

public class Altitude
extends java.lang.Object
implements I_Unitable<Altitude>

Defines an altitude. The units are assumed to be feet, but no calculations rely on this. It allows negative values to support delta values.

Author:
Dan Tappan [27.06.11]

Field Summary
private  double _altitude
          the altitude
private static double DEFAULT_ALTITUDE
          the default altitude
 
Constructor Summary
Altitude()
          Creates an altitude object with a default value of zero.
Altitude(double altitude)
          Creates an altitude object.
 
Method Summary
 Altitude add_(Altitude altitude)
          Adds another unit to this one.
 int compareTo(Altitude altitude)
          
 double getValue_()
          Returns the numerical value of this unit.
private  void setValue(double altitude)
          Sets the altitude.
 Altitude subtract_(Altitude altitude)
          Subtract another unit from this one.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_altitude

private double _altitude
the altitude


DEFAULT_ALTITUDE

private static final double DEFAULT_ALTITUDE
the default altitude

See Also:
Constant Field Values
Constructor Detail

Altitude

public Altitude()
Creates an altitude object with a default value of zero.


Altitude

public Altitude(double altitude)
Creates an altitude object.

Parameters:
altitude - - the altitude in feet
Method Detail

add_

public Altitude add_(Altitude altitude)
Adds another unit to this one.

Specified by:
add_ in interface I_Unitable<Altitude>
Parameters:
altitude - - the unit
Returns:
the result as a new unit

compareTo

public int compareTo(Altitude altitude)

Specified by:
compareTo in interface java.lang.Comparable<Altitude>

getValue_

public double getValue_()
Returns the numerical value of this unit.

Specified by:
getValue_ in interface I_Unitable<Altitude>
Returns:
the value

setValue

private void setValue(double altitude)
Sets the altitude.

Parameters:
altitude - - the altitude

subtract_

public Altitude subtract_(Altitude altitude)
Subtract another unit from this one. A negative result is illegal.

Specified by:
subtract_ in interface I_Unitable<Altitude>
Parameters:
altitude - - the unit
Returns:
the result as a new unit

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object