net.agmodel.physical
Class Temperature

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

public final class Temperature
extends AbstractQuantity
implements Comparable

This class represents the degree of hotness or coldness of a body or an environment

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
Temperature(Composite c)
          Temperature constructor from Composite quantity.
Temperature(double value, TemperatureUnit unit)
          Temperature constructor.
 
Method Summary
 Temperature add(Temperature x)
          Returns a Temperature whose value is (this + x).
 int compareTo(Object o)
          Compares this Temperature with the specified Object.
 int compareTo(Temperature x)
          Compares this Temperature with the specified Temperature.
 Temperature divide(double coefficient)
          Returns a Temperature whose value in degree Kelvin is (this / coefficient).
protected  int getDimensionSI()
          Gets the SI dimension of this Temperature.
 double getValue(TemperatureUnit unit)
          Gets the temperature in the specified unit.
protected  double getValueSI()
          Gets the temperature in degrees Kelvin.
 Temperature multiply(double coefficient)
          Returns a Temperature whose value in degree Kelvin is (this * coefficient).
 void setValue(double value, TemperatureUnit unit)
          Sets this Temperature using the specified unit.
 Temperature substract(Temperature x)
          Returns a Temperature 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

Temperature

public Temperature(double value,
                   TemperatureUnit unit)
Temperature constructor.

Parameters:
value - the temperature in the specified unit.
unit - the measurement unit being used.
Throws:
RuntimeException - unknown measurement unit

Temperature

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

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

getValue

public double getValue(TemperatureUnit unit)
Gets the temperature in the specified unit.

Parameters:
unit - the measurement unit being used.
Returns:
temperature in the specified measurement unit.
Throws:
RuntimeException - unknown measurement unit

setValue

public void setValue(double value,
                     TemperatureUnit unit)
Sets this Temperature using the specified unit.

Parameters:
value - the new temperature in the specified unit.
unit - the measurement unit being used.
Throws:
RuntimeException - unknown measurement unit

add

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

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

substract

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

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

multiply

public Temperature multiply(double coefficient)
Returns a Temperature whose value in degree Kelvin is (this * coefficient).

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

divide

public Temperature divide(double coefficient)
Returns a Temperature whose value in degree Kelvin is (this / coefficient).

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

compareTo

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

compareTo

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

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

getValueSI

protected double getValueSI()
Gets the temperature in degrees Kelvin.

Specified by:
getValueSI in class AbstractQuantity
Returns:
temperature in degrees Kelvin.

getDimensionSI

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

Specified by:
getDimensionSI in class AbstractQuantity
Returns:
THERMODYNAMIC_TEMPERATURE