faa.tg.units
Class Weight

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

public class Weight
extends AMeasure

 Weight class defines the objects used to quantify a weight measurement.

 See section 5.6 of the Detailed Design Document for a discussion
    of design issues.
 
See the source: Weight.java

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

Field Summary
static java.lang.String CVS_VERSION_ID
          The CVS Version ID
(package private) static long serialVersionUID
           
static Weight ZERO
           
 
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
Weight(double theValue, WeightUnits theUnits)
          Constructor for the Weight class
 
Method Summary
 Weight add(Weight theMeasure)
          This summation method adds a value with like units.
 double as(WeightUnits theUnits)
          The as method extracts the value from a Measure in specified units.
 Weight sub(Weight theMeasure)
          This subtraction method subtracts a value with like units.
 java.lang.String toString()
          returns the String representation of this object in its canonical form.
 
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 Weight ZERO
Constructor Detail

Weight

public Weight(double theValue,
              WeightUnits theUnits)
Constructor for the Weight class

Parameters:
theValue - the magnitude of Weight as a double.
theUnits - the units of the value that will be stored (ex: lbs).
Method Detail

add

public Weight add(Weight theMeasure)
This summation method adds a value with like units. It overrides the method in the superclass, ensures that a Weight is the added value, and does the cast for you.

Parameters:
theMeasure - the unit of measure you wish to add to this measure.
Returns:
A Weight equal to this value plus the parameter value.

sub

public Weight sub(Weight theMeasure)
This subtraction method subtracts a value with like units. It overrides the method in the superclass, ensures that a Weight is the subtracted value, and does the cast for you.

Parameters:
theMeasure - the unit of measure you wish to add to this measure.
Returns:
A Weight equal to this value minus the parameter value.

as

public double as(WeightUnits theUnits)
The as method extracts the value from a Measure in specified units.

Parameters:
theUnits - the units of the value that will be returned (ex: km)
Returns:
the value of the measure in specified units

toString

public java.lang.String toString()
returns the String representation of this object in its canonical form. The Unit's canonical form can be found by looking at the static class created by the constructor which takes two arguments. These definitions can be found in Units.java. For example, the Distance class specifies "meters" as its canonical unit. It is created by the DistanceUnits constructor which takes two arguments:
    public static DistanceUnits meters =
                       new DistanceUnits("meters","m");
 
See the Units class for more details.

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