net.agmodel.physical
Class Proportion

java.lang.Object
  |
  +--net.agmodel.physical.AbstractQuantity
        |
        +--net.agmodel.physical.Proportion
All Implemented Interfaces:
Cloneable, Comparable, Serializable

public final class Proportion
extends AbstractQuantity
implements Comparable

This class represents the figure formed by two lines diverging from a common point.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.agmodel.physical.AbstractQuantity
AMOUNT_OF_SUBSTANCE, COMPLETE, derivation, DEVOID, DIMENSIONLESS, ELECTRIC_CURRENT, LENGTH, LUMINOUS_INTENSITY, MASS, SPATIALLYINTERPOLATED, TEMPORALLYINTERPOLATED, THERMODYNAMIC_TEMPERATURE, TIME, UNINTERPOLATED
 
Constructor Summary
Proportion(double value, ProportionUnit unit)
          Proportion constructor.
Proportion(Duration numerator, Duration denominator)
           
 
Method Summary
 Proportion add(Proportion x)
          Returns a Proportion whose value is (this + x).
 int compareTo(Object o)
          Compares this Proportion with the specified Object.
 int compareTo(Proportion x)
          Compares this Proportion with the specified Proportion.
 Proportion divide(double coefficient)
          Returns an Proportion whose value is (this / coefficient).
protected  int getDimensionSI()
          Gets the SI dimension of this Proportion.
 double getValue(ProportionUnit unit)
          Gets the proportion in the specified unit.
protected  double getValueSI()
          Gets the Proportion in radians.
 Proportion multiply(double coefficient)
          Returns an Proportion whose value is (this * coefficient).
 void setValue(double value, ProportionUnit unit)
          Sets this Proportion using the specified unit.
 Proportion substract(Proportion x)
          Returns an Proportion whose value is (this - x).
 
Methods inherited from class net.agmodel.physical.AbstractQuantity
clone, divide, getSymbolSI, isSpatiallyInterpolated, isTemporallyInterpolated, multiply, toComposite, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Proportion

public Proportion(double value,
                  ProportionUnit unit)
Proportion constructor.

Parameters:
value - the proportion in the specified unit.
unit - the measurement unit being used.
Throws:
ArrayArrayIndexOutOfBoundsException - unknown measurement unit

Proportion

public Proportion(Duration numerator,
                  Duration denominator)
Method Detail

getValue

public double getValue(ProportionUnit unit)
Gets the proportion in the specified unit.

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

setValue

public void setValue(double value,
                     ProportionUnit unit)
Sets this Proportion using the specified unit.

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

add

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

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

substract

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

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

multiply

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

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

divide

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

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

compareTo

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

compareTo

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

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

getValueSI

protected double getValueSI()
Gets the Proportion in radians.

Specified by:
getValueSI in class AbstractQuantity
Returns:
Proportion in radians.

getDimensionSI

protected int getDimensionSI()
Gets the SI dimension of this Proportion.

Specified by:
getDimensionSI in class AbstractQuantity
Returns:
DIMENSIONLESS