org.opengts.util
Class Temperature

java.lang.Object
  extended by org.opengts.util.Temperature

public class Temperature
extends java.lang.Object

Temperature container


Nested Class Summary
static class Temperature.TemperatureUnits
          Enum: Temperature Units
 
Field Summary
static double INVALID_TEMPERATURE
           
static long MINIMUM_TIMESTAMP
           
static double TEMPERATURE_LIMIT_HI
           
static double TEMPERATURE_LIMIT_LO
           
 
Constructor Summary
Temperature(long ts, double C)
          Temperature constructor
 
Method Summary
static double C2F(double C)
          Celsius to Fahrenheit
static double F2C(double F)
          Fahrenheit to Celsius
 double getTemperature(boolean F)
          Gets the temperature
 double getTemperatureC()
          Gets the temperature in Celsius units
 double getTemperatureF()
          Gets the temperature in Fahrenheit units
 long getTimestamp()
          Gets the timestamp (in seconds)
 long getTimestampMillis()
          Gets the timestamp (in milliseconds)
 boolean isValid()
          Returns true if the timestamp and temperature are valid
static boolean isValid(Temperature T)
          Returns true if the specified Celsius temperature is within a valid range
 boolean isValidTemperature()
          Returns true if the temperature is valid
static boolean isValidTemperature(double C)
          Returns true if the specified Celsius temperature is within a valid range
static boolean isValidTemperature(Temperature T)
          Returns true if the specified Celsius temperature is within a valid range
 boolean isValidTimestamp()
          Returns true if the timestamp is valid
 java.lang.String toString()
          Gets the String representation of this instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MINIMUM_TIMESTAMP

public static final long MINIMUM_TIMESTAMP
See Also:
Constant Field Values

INVALID_TEMPERATURE

public static final double INVALID_TEMPERATURE
See Also:
Constant Field Values

TEMPERATURE_LIMIT_LO

public static final double TEMPERATURE_LIMIT_LO
See Also:
Constant Field Values

TEMPERATURE_LIMIT_HI

public static final double TEMPERATURE_LIMIT_HI
See Also:
Constant Field Values
Constructor Detail

Temperature

public Temperature(long ts,
                   double C)
Temperature constructor

Parameters:
ts - The timestamp (in seconds)
C - The temperature (in Celsius)
Method Detail

isValidTemperature

public static boolean isValidTemperature(double C)
Returns true if the specified Celsius temperature is within a valid range


isValidTemperature

public static boolean isValidTemperature(Temperature T)
Returns true if the specified Celsius temperature is within a valid range


isValid

public static boolean isValid(Temperature T)
Returns true if the specified Celsius temperature is within a valid range


F2C

public static double F2C(double F)
Fahrenheit to Celsius

Parameters:
F - Fahrenheit temperature
Returns:
Celsius temperature

C2F

public static double C2F(double C)
Celsius to Fahrenheit

Parameters:
C - Celsius temperature
Returns:
Fahrenheit temperature

getTemperatureC

public double getTemperatureC()
Gets the temperature in Celsius units


getTemperatureF

public double getTemperatureF()
Gets the temperature in Fahrenheit units


getTemperature

public double getTemperature(boolean F)
Gets the temperature

Parameters:
F - true for Fahrenheit, false for Celsius
Returns:
The temperature

isValidTemperature

public boolean isValidTemperature()
Returns true if the temperature is valid


getTimestamp

public long getTimestamp()
Gets the timestamp (in seconds)


getTimestampMillis

public long getTimestampMillis()
Gets the timestamp (in milliseconds)


isValidTimestamp

public boolean isValidTimestamp()
Returns true if the timestamp is valid


isValid

public boolean isValid()
Returns true if the timestamp and temperature are valid


toString

public java.lang.String toString()
Gets the String representation of this instance

Overrides:
toString in class java.lang.Object