net.agmodel.physical
Class VolumetricDensity

java.lang.Object
  extended bynet.agmodel.physical.AbstractQuantity
      extended bynet.agmodel.physical.VolumetricDensity
All Implemented Interfaces:
Cloneable, Comparable, Serializable

public final class VolumetricDensity
extends AbstractQuantity
implements Comparable

This class represents a mass per unit volume of a substance under specified conditions of pressure and temperature

Version:
1.2, 1 April 1999
Author:
Jean-Marie Dautelle
See Also:
Mass, Volume, Serialized Form

Field Summary
static int GRAINS_PER_GALLON_UK
          Used to specify grains per gallon unit (UK).
static int GRAINS_PER_GALLON_US
          Used to specify grains per gallon unit (US).
static int GRAMS_PER_CUBIC_CENTIMETER
          Used to specify grams per cubic centimeter unit.
static int GRAMS_PER_CUBIC_CENTIMETRE
           
static int GRAMS_PER_LITER
          Used to specify grams per liter.
static int GRAMS_PER_LITRE
           
static int GRAMS_PER_MILLILITER
          Used to specify grams per milliliter.
static int GRAMS_PER_MILLILITRE
           
static int KILOGRAMS_PER_CUBIC_METER
          Used to specify kilogram per cubic meter unit.
static int KILOGRAMS_PER_CUBIC_METRE
           
static int KILOGRAMS_PER_LITER
          Used to specify kilograms per liter.
static int KILOGRAMS_PER_LITRE
           
static int MEGAGRAMS_PER_CUBIC_METER
          Used to specify megagrams per cubic meter.
static int MEGAGRAMS_PER_CUBIC_METRE
           
static int MILLIGRAMS_PER_LITER
          Used to specify milligrams per liter.
static int MILLIGRAMS_PER_LITRE
           
static int MILLIGRAMS_PER_MILLILITER
          Used to specify milligrams per milliliter.
static int MILLIGRAMS_PER_MILLILITRE
           
static int OUNCES_PER_CUBIC_INCH
          Used to specify ounces per cubic inch.
static int OUNCES_PER_GALLON_UK
          Used to specify ounces per gallon (UK).
static int OUNCES_PER_GALLON_US
          Used to specify ounces per gallon (US).
static int POUNDS_PER_CUBIC_FOOT
          Used to specify pounds per cubic foot.
static int POUNDS_PER_CUBIC_INCH
          Used to specify pounds per cubic inch.
static int POUNDS_PER_GALLON_UK
          Used to specify pounds per gallon (UK).
static int POUNDS_PER_GALLON_US
          Used to specify pounds per gallon (US).
static int TONNES_PER_CUBIC_METER
          Used to specify tonnes per cubic meter.
static int TONNES_PER_CUBIC_METRE
           
static int TONS_PER_CUBIC_YARD_UK
          Used to specify tons per cubic yard (UK).
static int TONS_PER_CUBIC_YARD_US
          Used to specify tons per cubic yard (US).
 
Fields inherited from class net.agmodel.physical.AbstractQuantity
COMPLETE, DEVOID, SPATIALLYINTERPOLATED, TEMPORALLYINTERPOLATED, UNINTERPOLATED
 
Constructor Summary
VolumetricDensity(Composite c)
          VolumetricDensity constructor from Composite quantity.
VolumetricDensity(double value, int unit)
          VolumetricDensity constructor.
 
Method Summary
 VolumetricDensity add(VolumetricDensity x)
          Returns a VolumetricDensity whose value is (this + x).
 int compareTo(Object o)
          Compares this VolumetricDensity with the specified Object.
 int compareTo(VolumetricDensity x)
          Compares this VolumetricDensity with the specified VolumetricDensity.
 VolumetricDensity divide(double coefficient)
          Returns a VolumetricDensity whose value is (this / coefficient).
 double getValue(int unit)
          Gets the volumetric density in the specified unit.
 VolumetricDensity multiply(double coefficient)
          Returns a VolumetricDensity whose value is (this * coefficient).
 Mass multiply(Volume v)
          Returns a Mass whose value is (this * v).
 void setValue(double value, int unit)
          Sets this VolumetricDensity using the specified unit.
 VolumetricDensity substract(VolumetricDensity x)
          Returns a VolumetricDensity whose value is (this - x).
 
Methods inherited from class net.agmodel.physical.AbstractQuantity
clone, divide, isSpatiallyInterpolated, isTemporallyInterpolated, multiply, toComposite, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KILOGRAMS_PER_CUBIC_METER

public static final int KILOGRAMS_PER_CUBIC_METER
Used to specify kilogram per cubic meter unit.

See Also:
Constant Field Values

KILOGRAMS_PER_CUBIC_METRE

public static final int KILOGRAMS_PER_CUBIC_METRE
See Also:
Constant Field Values

GRAINS_PER_GALLON_UK

public static final int GRAINS_PER_GALLON_UK
Used to specify grains per gallon unit (UK).

See Also:
Constant Field Values

GRAINS_PER_GALLON_US

public static final int GRAINS_PER_GALLON_US
Used to specify grains per gallon unit (US).

See Also:
Constant Field Values

GRAMS_PER_CUBIC_CENTIMETER

public static final int GRAMS_PER_CUBIC_CENTIMETER
Used to specify grams per cubic centimeter unit.

See Also:
Constant Field Values

GRAMS_PER_CUBIC_CENTIMETRE

public static final int GRAMS_PER_CUBIC_CENTIMETRE
See Also:
Constant Field Values

GRAMS_PER_LITER

public static final int GRAMS_PER_LITER
Used to specify grams per liter.

See Also:
Constant Field Values

GRAMS_PER_LITRE

public static final int GRAMS_PER_LITRE
See Also:
Constant Field Values

GRAMS_PER_MILLILITER

public static final int GRAMS_PER_MILLILITER
Used to specify grams per milliliter.

See Also:
Constant Field Values

GRAMS_PER_MILLILITRE

public static final int GRAMS_PER_MILLILITRE
See Also:
Constant Field Values

MEGAGRAMS_PER_CUBIC_METER

public static final int MEGAGRAMS_PER_CUBIC_METER
Used to specify megagrams per cubic meter.

See Also:
Constant Field Values

MEGAGRAMS_PER_CUBIC_METRE

public static final int MEGAGRAMS_PER_CUBIC_METRE
See Also:
Constant Field Values

MILLIGRAMS_PER_MILLILITER

public static final int MILLIGRAMS_PER_MILLILITER
Used to specify milligrams per milliliter.

See Also:
Constant Field Values

MILLIGRAMS_PER_MILLILITRE

public static final int MILLIGRAMS_PER_MILLILITRE
See Also:
Constant Field Values

MILLIGRAMS_PER_LITER

public static final int MILLIGRAMS_PER_LITER
Used to specify milligrams per liter.

See Also:
Constant Field Values

MILLIGRAMS_PER_LITRE

public static final int MILLIGRAMS_PER_LITRE
See Also:
Constant Field Values

KILOGRAMS_PER_LITER

public static final int KILOGRAMS_PER_LITER
Used to specify kilograms per liter.

See Also:
Constant Field Values

KILOGRAMS_PER_LITRE

public static final int KILOGRAMS_PER_LITRE
See Also:
Constant Field Values

OUNCES_PER_CUBIC_INCH

public static final int OUNCES_PER_CUBIC_INCH
Used to specify ounces per cubic inch.

See Also:
Constant Field Values

OUNCES_PER_GALLON_UK

public static final int OUNCES_PER_GALLON_UK
Used to specify ounces per gallon (UK).

See Also:
Constant Field Values

OUNCES_PER_GALLON_US

public static final int OUNCES_PER_GALLON_US
Used to specify ounces per gallon (US).

See Also:
Constant Field Values

POUNDS_PER_CUBIC_INCH

public static final int POUNDS_PER_CUBIC_INCH
Used to specify pounds per cubic inch.

See Also:
Constant Field Values

POUNDS_PER_CUBIC_FOOT

public static final int POUNDS_PER_CUBIC_FOOT
Used to specify pounds per cubic foot.

See Also:
Constant Field Values

POUNDS_PER_GALLON_UK

public static final int POUNDS_PER_GALLON_UK
Used to specify pounds per gallon (UK).

See Also:
Constant Field Values

POUNDS_PER_GALLON_US

public static final int POUNDS_PER_GALLON_US
Used to specify pounds per gallon (US).

See Also:
Constant Field Values

TONNES_PER_CUBIC_METER

public static final int TONNES_PER_CUBIC_METER
Used to specify tonnes per cubic meter.

See Also:
Constant Field Values

TONNES_PER_CUBIC_METRE

public static final int TONNES_PER_CUBIC_METRE
See Also:
Constant Field Values

TONS_PER_CUBIC_YARD_UK

public static final int TONS_PER_CUBIC_YARD_UK
Used to specify tons per cubic yard (UK).

See Also:
Constant Field Values

TONS_PER_CUBIC_YARD_US

public static final int TONS_PER_CUBIC_YARD_US
Used to specify tons per cubic yard (US).

See Also:
Constant Field Values
Constructor Detail

VolumetricDensity

public VolumetricDensity(double value,
                         int unit)
VolumetricDensity constructor.

Parameters:
value - the volumetric density in the specified unit.
unit - the measurement unit being used.
Throws:
ArrayIndexOutOfBoundsException - unknown measurement unit

VolumetricDensity

public VolumetricDensity(Composite c)
VolumetricDensity constructor from Composite quantity.

Parameters:
c - the quantity to convert.
Throws:
UnitDimensionException - composite is not a volumetric density.
See Also:
Composite
Method Detail

getValue

public double getValue(int unit)
Gets the volumetric density in the specified unit.

Parameters:
unit - the measurement unit being used.
Returns:
volumetric density in the specified measurement unit.
Throws:
ArrayIndexOutOfBoundsException - unknown measurement unit

setValue

public void setValue(double value,
                     int unit)
Sets this VolumetricDensity using the specified unit.

Parameters:
value - the new volumetric density in the specified unit.
unit - the measurement unit being used.
Throws:
ArrayIndexOutOfBoundsException - unknown measurement unit

add

public VolumetricDensity add(VolumetricDensity x)
Returns a VolumetricDensity whose value is (this + x).

Parameters:
x - the VolumetricDensity to be added.
Returns:
(this + x)

substract

public VolumetricDensity substract(VolumetricDensity x)
Returns a VolumetricDensity whose value is (this - x).

Parameters:
x - the VolumetricDensity to be substracted.
Returns:
(this - x)

multiply

public VolumetricDensity multiply(double coefficient)
Returns a VolumetricDensity whose value is (this * coefficient).

Parameters:
coefficient - the dimensionless multiplier.
Returns:
(this * coefficient)

divide

public VolumetricDensity divide(double coefficient)
Returns a VolumetricDensity whose value is (this / coefficient).

Parameters:
coefficient - the dimensionless divisor.
Returns:
(this / coefficient)
Throws:
ArithmeticException - coefficient == 0.0

multiply

public Mass multiply(Volume v)
Returns a Mass whose value is (this * v).

Parameters:
v - the volume multiplier.
Returns:
(this * v)

compareTo

public int compareTo(VolumetricDensity x)
Compares this VolumetricDensity with the specified VolumetricDensity. This method is provided in preference to individual methods for each of the six boolean comparison operators (<, ==, >, >=, !=, <=). The suggested idiom for performing these comparisons is: (x.compareTo(y) <op> 0), where <op> is one of the six comparison operators.

Parameters:
x - VolumetricDensity to which this VolumetricDensity is to be compared.
Returns:
-1, 0 or 1 as this VolumetricDensity is numerically less than, equal to, or greater than x.

compareTo

public int compareTo(Object o)
Compares this VolumetricDensity with the specified Object. If the Object is a VolumetricDensity, this method behaves like compareTo(VolumetricDensity). Otherwise, it throws a ClassCastException (as VolumetricDensitys are comparable only to other VolumetricDensitys).

Specified by:
compareTo in interface Comparable
Parameters:
o - Object to which this VolumetricDensity is to be compared.
Returns:
a negative number, zero, or a positive number as this VolumetricDensity is numerically less than, equal to, or greater than o, which must be a VolumetricDensity.
Throws:
ClassCastException - o is not a VolumetricDensity.
See Also:
compareTo(VolumetricDensity), Comparable


Copyright (C) NARC 2001 All Rights Reserved.