net.agmodel.physical
Class Area

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

public final class Area
extends AbstractQuantity
implements Comparable

This class represents the extent of a planar region or of the surface of a solid measured in square units.

Version:
1.1, 22 March 1999
Author:
Jean-Marie Dautelle
See Also:
Serialized Form

Field Summary
static int ACRE
          Used to specify acre unit.
static int ARE
          Used to specify are unit.
static int CIRCULAR_INCH
          Used to specify circular inch unit.
static int HECTARE
          Used to specify hectare unit.
static int MORGEN
          Used to specify morgen unit (Dutch & South Africa).
static int MOU
          Used to specify mou unit (China).
static int ROOD
          Used to specify rood unit.
static int SE
          Used to specify se unit (Japan).
static int SECTION
          Used to specify section unit.
static int SQUARE
          Used to specify square (of timber) unit.
static int SQUARE_CENTIMETER
          Used to specify square centimeter unit.
static int SQUARE_CENTIMETRE
           
static int SQUARE_FOOT
          Used to specify square foot unit.
static int SQUARE_INCH
          Used to specify square inch unit.
static int SQUARE_KILOMETER
          Used to specify square kilometer unit.
static int SQUARE_KILOMETRE
           
static int SQUARE_METER
          Used to specify square meter unit.
static int SQUARE_METRE
           
static int SQUARE_MILE
          Used to specify square mile unit.
static int SQUARE_MILLIMETER
          Used to specify square millimeter unit.
static int SQUARE_MILLIMETRE
           
static int SQUARE_POLE
          Used to specify square pole unit (= square rod).
static int SQUARE_ROD
          Used to specify square rod unit.
static int SQUARE_YARD
          Used to specify square yard unit.
static int TOWNSHIP
          Used to specify township unit.
 
Fields inherited from class net.agmodel.physical.AbstractQuantity
COMPLETE, DEVOID, SPATIALLYINTERPOLATED, TEMPORALLYINTERPOLATED, UNINTERPOLATED
 
Constructor Summary
Area(Composite c)
          Area constructor from Composite quantity.
Area(double value, int unit)
          Area constructor.
Area(Length radius, Angle theta)
          Area constructor from a Length and an Angle (slice of a circle).
 
Method Summary
 Area add(Area x)
          Returns an Area whose value is (this + x).
 int compareTo(Area x)
          Compares this Area with the specified Area.
 int compareTo(Object o)
          Compares this Area with the specified Object.
 Area divide(double coefficient)
          Returns an Area whose value is (this / coefficient).
 Length divide(Length x)
          Returns a Length whose value is (this / x).
 double getValue(int unit)
          Gets the area in the specified unit.
 Area multiply(double coefficient)
          Returns an Area whose value is (this * coefficient).
 Volume multiply(Length x)
          Returns a Volume whose value is (this * x).
 void setValue(double value, int unit)
          Sets this Area using the specified unit.
 Area substract(Area x)
          Returns an Area 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

SQUARE_METER

public static final int SQUARE_METER
Used to specify square meter unit.

See Also:
Constant Field Values

SQUARE_METRE

public static final int SQUARE_METRE
See Also:
Constant Field Values

SQUARE_FOOT

public static final int SQUARE_FOOT
Used to specify square foot unit.

See Also:
Constant Field Values

SQUARE_YARD

public static final int SQUARE_YARD
Used to specify square yard unit.

See Also:
Constant Field Values

SQUARE_INCH

public static final int SQUARE_INCH
Used to specify square inch unit.

See Also:
Constant Field Values

SQUARE_MILE

public static final int SQUARE_MILE
Used to specify square mile unit.

See Also:
Constant Field Values

ACRE

public static final int ACRE
Used to specify acre unit.

See Also:
Constant Field Values

HECTARE

public static final int HECTARE
Used to specify hectare unit.

See Also:
Constant Field Values

ARE

public static final int ARE
Used to specify are unit.

See Also:
Constant Field Values

ROOD

public static final int ROOD
Used to specify rood unit.

See Also:
Constant Field Values

SQUARE_MILLIMETER

public static final int SQUARE_MILLIMETER
Used to specify square millimeter unit.

See Also:
Constant Field Values

SQUARE_MILLIMETRE

public static final int SQUARE_MILLIMETRE
See Also:
Constant Field Values

SQUARE_CENTIMETER

public static final int SQUARE_CENTIMETER
Used to specify square centimeter unit.

See Also:
Constant Field Values

SQUARE_CENTIMETRE

public static final int SQUARE_CENTIMETRE
See Also:
Constant Field Values

SQUARE_KILOMETER

public static final int SQUARE_KILOMETER
Used to specify square kilometer unit.

See Also:
Constant Field Values

SQUARE_KILOMETRE

public static final int SQUARE_KILOMETRE
See Also:
Constant Field Values

SQUARE

public static final int SQUARE
Used to specify square (of timber) unit.

See Also:
Constant Field Values

SQUARE_ROD

public static final int SQUARE_ROD
Used to specify square rod unit.

See Also:
Constant Field Values

SQUARE_POLE

public static final int SQUARE_POLE
Used to specify square pole unit (= square rod).

See Also:
Constant Field Values

CIRCULAR_INCH

public static final int CIRCULAR_INCH
Used to specify circular inch unit.

See Also:
Constant Field Values

TOWNSHIP

public static final int TOWNSHIP
Used to specify township unit.

See Also:
Constant Field Values

MORGEN

public static final int MORGEN
Used to specify morgen unit (Dutch & South Africa).

See Also:
Constant Field Values

MOU

public static final int MOU
Used to specify mou unit (China).

See Also:
Constant Field Values

SE

public static final int SE
Used to specify se unit (Japan).

See Also:
Constant Field Values

SECTION

public static final int SECTION
Used to specify section unit.

See Also:
Constant Field Values
Constructor Detail

Area

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

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

Area

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

Parameters:
c - the quantity to convert.
Throws:
UnitDimensionException - composite is not an area.
See Also:
Composite

Area

public Area(Length radius,
            Angle theta)
Area constructor from a Length and an Angle (slice of a circle). It returns the area of the slice defined from the specified circle radius and central angle.

Parameters:
radius - the circle radius.
theta - the central angle.
Method Detail

getValue

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

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

setValue

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

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

add

public Area add(Area x)
Returns an Area whose value is (this + x).

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

substract

public Area substract(Area x)
Returns an Area whose value is (this - x).

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

multiply

public Area multiply(double coefficient)
Returns an Area whose value is (this * coefficient).

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

multiply

public Volume multiply(Length x)
Returns a Volume whose value is (this * x).

Parameters:
x - the Length multiplier.
Returns:
(this * x)

divide

public Area divide(double coefficient)
Returns an Area whose value is (this / coefficient).

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

divide

public Length divide(Length x)
Returns a Length whose value is (this / x).

Parameters:
x - the Length divisor.
Returns:
(this / x)
Throws:
ArithmeticException - x.getValue(METER) == 0.0

compareTo

public int compareTo(Area x)
Compares this Area with the specified Area. 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 - Area to which this Area is to be compared.
Returns:
-1, 0 or 1 as this Area is numerically less than, equal to, or greater than x.

compareTo

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

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


Copyright (C) NARC 2001 All Rights Reserved.