net.agmodel.physical
Class Composite

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

public class Composite
extends AbstractQuantity
implements Comparable

This class represents a combination of several quantities.

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

Field Summary
 
Fields inherited from class net.agmodel.physical.AbstractQuantity
COMPLETE, DEVOID, SPATIALLYINTERPOLATED, TEMPORALLYINTERPOLATED, UNINTERPOLATED
 
Method Summary
 Composite add(Composite x)
          Returns a Composite whose value is (this + x).
 int compareTo(Composite x)
          Compares this Composite with the specified Composite.
 int compareTo(Object o)
          Compares this Composite with the specified Object.
 Composite divide(double coefficient)
          Returns a Composite whose value is (this / coefficient).
 double getValueSI()
          Gets the quantity in SI units.
 Composite inverse()
          Returns the Composite whose value is (1 / this).
 Composite multiply(double coefficient)
          Returns a Composite whose value is (this * coefficient).
 Composite subtract(Composite x)
          Returns a Composite 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
 

Method Detail

add

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

Parameters:
x - the Composite to be added.
Returns:
(this + x)
Throws:
UnitDimensionException - different unit dimensions

subtract

public Composite subtract(Composite x)
Returns a Composite whose value is (this - x).

Parameters:
x - the Composite to be subtracted.
Returns:
(this - x)
Throws:
UnitDimensionException - different unit dimensions

multiply

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

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

divide

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

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

inverse

public Composite inverse()
Returns the Composite whose value is (1 / this).

Returns:
(1 / this)
Throws:
ArithmeticException - this.getValueSI() == 0.0

compareTo

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

compareTo

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

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

getValueSI

public double getValueSI()
Gets the quantity in SI units.

Returns:
quantity in SI units.


Copyright (C) NARC 2001 All Rights Reserved.