thredds.datatype
Class TimeDuration

java.lang.Object
  extended by thredds.datatype.TimeDuration

public class TimeDuration
extends java.lang.Object

Implements the thredds "duration" XML element type: specifies a length of time. This is really the same as a ucar.nc2.units.TimeUnit, but it allows xsd:duration syntax as well as udunits syntax. It also keeps track if the text is empty. A duration can be one of the following:

  1. a valid udunits string compatible with "secs"
  2. NOT DONE YET an xsd:duration type specified in the following form "PnYnMnDTnHnMnS" where:

Version:
$Revision: 63 $ $Date: 2006-07-12 15:50:51 -0600 (Wed, 12 Jul 2006) $
Author:
john caron
See Also:
"http://www.unidata.ucar.edu/projects/THREDDS/tech/catalog/InvCatalogSpec.html#durationType"

Constructor Summary
TimeDuration(java.lang.String text)
           
TimeDuration(TimeDuration src)
          copy constructor
TimeDuration(TimeUnit timeUnit)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String getText()
           
 TimeUnit getTimeUnit()
           
 double getValue()
          get the duration in natural units
 double getValue(TimeUnit want)
          get the duration in want units
 double getValueInSeconds()
          get the duration in seconds
 int hashCode()
           
 boolean isBlank()
           
static void main(java.lang.String[] args)
          debug
 void setValueInSeconds(double secs)
          set the duration in seconds
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeDuration

public TimeDuration(TimeDuration src)
copy constructor


TimeDuration

public TimeDuration(TimeUnit timeUnit)

TimeDuration

public TimeDuration(java.lang.String text)
             throws java.text.ParseException
Throws:
java.text.ParseException
Method Detail

getValue

public double getValue()
get the duration in natural units


getValue

public double getValue(TimeUnit want)
                throws ucar.units.ConversionException
get the duration in want units

Throws:
ucar.units.ConversionException

getValueInSeconds

public double getValueInSeconds()
get the duration in seconds


setValueInSeconds

public void setValueInSeconds(double secs)
set the duration in seconds


isBlank

public boolean isBlank()

getTimeUnit

public TimeUnit getTimeUnit()

getText

public java.lang.String getText()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

main

public static void main(java.lang.String[] args)
debug