uavsim.datatypes
Class Airspeed

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

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

Defines an airspeed. The units are arbitrary as either miles per hour or knots. No internal calculations rely on the units.

Author:
Dan Tappan [21.06.11]

Field Summary
private  double _airspeed
          the airspeed
private static double DEFAULT_AIRSPEED
          the default airspeed
 
Constructor Summary
Airspeed()
          Creates an airspeed object with a default speed of zero.
Airspeed(double speed)
          Creates an airspeed object.
 
Method Summary
 Airspeed add_(Airspeed airspeed)
          Adds another unit to this one.
 int compareTo(Airspeed airspeed)
          
 double getValue_()
          Returns the numerical value of this unit.
 Airspeed interpolate(Airspeed airspeed, Scaler scaler)
          Interpolates between this airspeed and another in the forward direction.
private  void setValue(double airspeed)
          Sets the airspeed.
 Airspeed subtract_(Airspeed airspeed)
          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

_airspeed

private double _airspeed
the airspeed


DEFAULT_AIRSPEED

private static final double DEFAULT_AIRSPEED
the default airspeed

See Also:
Constant Field Values
Constructor Detail

Airspeed

public Airspeed()
Creates an airspeed object with a default speed of zero.


Airspeed

public Airspeed(double speed)
Creates an airspeed object.

Parameters:
speed - - the speed
Method Detail

add_

public Airspeed add_(Airspeed airspeed)
Adds another unit to this one.

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

compareTo

public int compareTo(Airspeed airspeed)

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

getValue_

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

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

interpolate

public Airspeed interpolate(Airspeed airspeed,
                            Scaler scaler)
Interpolates between this airspeed and another in the forward direction.

Parameters:
airspeed - - the other airspeed
scaler - - the scaler between the airspeeds
Returns:
the interpolated airspeed

setValue

private void setValue(double airspeed)
Sets the airspeed.

Parameters:
airspeed - - the airspeed

subtract_

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

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

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object