jsky.science
Class Time

java.lang.Object
  extended by jsky.science.AbstractScienceObject
      extended by jsky.science.Quantity
          extended by jsky.science.Time
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable, java.util.EventListener, ScienceObjectModel, ReplaceablePropertyChangeListener

public class Time
extends Quantity

Time, an object to manage quantities of Time. This is not Time of Day based (see Java Calendar class for that stuff), but rather amounts of Time.

Currently support units are: SECOND, MINUTE, HOUR, DAY

This code was developed by NASA, Goddard Space Flight Center, Code 587 for the Scientist's Expert Assistant (SEA) project for Next Generation Space Telescope (NGST).

Version:
5.29.99
Author:
Sandy Grosvenor
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jsky.science.AbstractScienceObject
AbstractScienceObject.EventMonitor
 
Field Summary
static java.lang.String DAY
           
static java.lang.String DAYABBREV
           
static java.lang.String DEFAULTUNITS_PROPERTY
           
static java.lang.String HOUR
           
static java.lang.String HOURABBREV
           
static java.lang.String MINUTE
           
static java.lang.String MINUTEABBREV
           
static java.lang.String SECOND
           
static java.lang.String SECONDABBREV
           
 
Fields inherited from class jsky.science.Quantity
fValue
 
Fields inherited from interface jsky.science.ScienceObjectModel
NAME_PROPERTY, PENDING_PROPERTY, VALID_PROPERTY
 
Constructor Summary
Time()
          Creates a default Time of length 0 in the default units.
Time(double inValue)
          Create a Time quantity of specified value in the default units.
Time(double inValue, java.lang.String inUnits)
          Primary constructor.
 
Method Summary
static void addDefaultUnitsChangeListener(java.beans.PropertyChangeListener listener)
           
static double convert(double inVal, java.lang.String fromUnits, java.lang.String toUnits)
          The workhorse of the Time class.
static java.lang.String getDefaultUnitsAbbrev()
           
static java.lang.String getUnitsAbbrev(java.lang.String unitType)
           
 double getValue(java.lang.String unitsName)
          Returns value in specified Units.
 Quantity newInstance(double inValue)
          returns a new Time object with the specified value in the default units.
static void removeDefaultUnitsChangeListener(java.beans.PropertyChangeListener listener)
           
protected  void setValue(double inValue, java.lang.String unitsName)
          Sets the value with the specified units
 
Methods inherited from class jsky.science.Quantity
add, addDefaultUnitsChangeListener, equals, fireDefaultUnitsChange, fireDefaultUnitsChange, getAllUnits, getAllUnits, getAllUnitsAbbrev, getAllUnitsAbbrev, getDefaultUnits, getDefaultUnits, getDefaultUnitsAbbrev, getDefaultUnitsProperty, getUnitsAbbrev, getUnitsIgnoreCase, getValue, hashCode, initializeSubClass, isInitialized, removeDefaultUnitsChangeListener, setDefaultUnits, toString, toString
 
Methods inherited from class jsky.science.AbstractScienceObject
addEventMonitor, addPropertyChangeListener, areNamesEqual, clearAllListeners, clone, compareTo, createDefaultName, firePropertyChange, firePropertyChange, fireReplaceObject, fireReplaceObject, fireReplaceObject, fireVetoableChange, fireVetoableChange, getException, getLabel, getName, getObjectIdString, getObjectIdString, getParent, isHolding, isPending, isTracing, isValid, notifyEventMonitors, propertyChange, removeEventMonitor, removePropertyChangeListener, replaceObject, replaceObjectNYI, setException, setHolding, setName, setParent, setTraceAll, setTracing, writeDebug, writeError
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULTUNITS_PROPERTY

public static final java.lang.String DEFAULTUNITS_PROPERTY

SECOND

public static final java.lang.String SECOND

MINUTE

public static final java.lang.String MINUTE

HOUR

public static final java.lang.String HOUR

DAY

public static final java.lang.String DAY

SECONDABBREV

public static final java.lang.String SECONDABBREV

MINUTEABBREV

public static final java.lang.String MINUTEABBREV

HOURABBREV

public static final java.lang.String HOURABBREV

DAYABBREV

public static final java.lang.String DAYABBREV
Constructor Detail

Time

public Time()
Creates a default Time of length 0 in the default units.


Time

public Time(double inValue)
Create a Time quantity of specified value in the default units.


Time

public Time(double inValue,
            java.lang.String inUnits)
Primary constructor.

Parameters:
inValue - double of the time quantity
inUnits - string containing the units in which the value is given
Method Detail

newInstance

public Quantity newInstance(double inValue)
returns a new Time object with the specified value in the default units.

Specified by:
newInstance in class Quantity

getValue

public double getValue(java.lang.String unitsName)
Returns value in specified Units.

Specified by:
getValue in class Quantity

setValue

protected void setValue(double inValue,
                        java.lang.String unitsName)
Sets the value with the specified units

Specified by:
setValue in class Quantity

convert

public static double convert(double inVal,
                             java.lang.String fromUnits,
                             java.lang.String toUnits)
                      throws UnitsNotSupportedException
The workhorse of the Time class. Converts a value between a source and a destination units

Throws:
UnitsNotSupportedException

addDefaultUnitsChangeListener

public static void addDefaultUnitsChangeListener(java.beans.PropertyChangeListener listener)

removeDefaultUnitsChangeListener

public static void removeDefaultUnitsChangeListener(java.beans.PropertyChangeListener listener)

getDefaultUnitsAbbrev

public static java.lang.String getDefaultUnitsAbbrev()

getUnitsAbbrev

public static java.lang.String getUnitsAbbrev(java.lang.String unitType)