Jeospace API

org.jeospace.measure
Class Temperature

java.lang.Object
  extended byorg.jeospace.measure.Temperature
All Implemented Interfaces:
java.lang.Cloneable

public class Temperature
extends java.lang.Object
implements java.lang.Cloneable

An object that represents a measure of temperature.

For reference see: http://ts.nist.gov/ts/htdocs/230/235/h4402/appenc.pdf

Version:
$Revision: 1.1.1.1 $
Author:
Rex Melton
See Also:
TemperatureUnit

Field Summary
protected  double magnitude
          The magnitude
protected  TemperatureUnit units
          The units
 
Constructor Summary
Temperature()
          Construct a Temperature object initialized to a value of 0 degrees Celsius.
Temperature(double magnitude, TemperatureUnit units)
          Construct a Temperature object.
 
Method Summary
 void add(Temperature temperature)
          Add to this object the argument Temperature object.
 void clear()
          Set the value of this Temperature object to 0 degrees Celsius.
 java.lang.Object clone()
          Return a copy of this Temperature object.
 int compareTo(java.lang.Object obj)
          Compare this object with the argument for order.
 int compareTo(Temperature that)
          Compare this object with the argument for order.
 boolean equals(java.lang.Object obj)
          Compare two Temperatures for equality.
 double getMagnitude(TemperatureUnit inUnits)
          Return the double value of the magnitude of this Temperature object in the specified units.
 void set(double inMagnitude, TemperatureUnit inUnits)
          Set this Temperature object to the specified value.
 void subtract(Temperature temperature)
          Subtract from this object the argument Temperature object.
 java.lang.String toString()
          Return a String representation of this Temperature object.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

magnitude

protected double magnitude
The magnitude


units

protected TemperatureUnit units
The units

Constructor Detail

Temperature

public Temperature()
Construct a Temperature object initialized to a value of 0 degrees Celsius.


Temperature

public Temperature(double magnitude,
                   TemperatureUnit units)
Construct a Temperature object.

Parameters:
magnitude - the magnitude value.
units - the units identifier.
Method Detail

set

public void set(double inMagnitude,
                TemperatureUnit inUnits)
Set this Temperature object to the specified value.

Parameters:
inMagnitude - The magnitude value.
inUnits - The units identifier.

add

public void add(Temperature temperature)
Add to this object the argument Temperature object.

Parameters:
temperature - A Temperature object.

subtract

public void subtract(Temperature temperature)
Subtract from this object the argument Temperature object.

Parameters:
temperature - A Temperature object.

getMagnitude

public double getMagnitude(TemperatureUnit inUnits)
Return the double value of the magnitude of this Temperature object in the specified units.

Parameters:
inUnits - The units identifier.
Returns:
the double value of the magnitude

clear

public void clear()
Set the value of this Temperature object to 0 degrees Celsius.


clone

public java.lang.Object clone()
Return a copy of this Temperature object. Overrides Cloneable.

Returns:
a copy of this Temperature object.

equals

public boolean equals(java.lang.Object obj)
Compare two Temperatures for equality. The result is true if and only if the argument object is not null, is a Temperature object and represents a temperature of the same magnitude as this Temperature.

Two Temperature objects are equal only if the getMagnitude method returns the same value for both with identical unit identifiers.

Parameters:
obj - The object to compare with
Returns:
true if the Lengths are equivalent; false otherwise.

toString

public java.lang.String toString()
Return a String representation of this Temperature object.

Returns:
a String representation of this Temperature object

compareTo

public int compareTo(Temperature that)
Compare this object with the argument for order.

Parameters:
that - The Temperature to compare
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

compareTo

public int compareTo(java.lang.Object obj)
Compare this object with the argument for order.

Parameters:
obj - The Object to compare
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the argument is not a Temperature.

Jeospace API

Copyright © 2006 - jeospace.org