ucar.nc2.units
Class DateType

java.lang.Object
  extended by ucar.nc2.units.DateType

public class DateType
extends java.lang.Object

Implements the thredds "dateType" and "dateTypeFormatted" XML element types. This is mostly a general way to specify dates in a string. It allows a date to mean "present". "Present" always sorts after any date, including dates in the future. It allows an optional attribute called "type" which is an enumeration like "created", "modified", etc taken from Dublin Core vocabulary. A DateType can be specified in the following ways:

  1. an xsd:date, with form "CCYY-MM-DD"
  2. an xsd:dateTime with form "CCYY-MM-DDThh:mm:ss"
  3. a valid udunits date string
  4. the string "present"

Author:
john caron
See Also:
"http://www.unidata.ucar.edu/projects/THREDDS/tech/catalog/InvCatalogSpec.html#dateType", "http://www.unidata.ucar.edu/projects/THREDDS/tech/catalog/InvCatalogSpec.html#dateTypeFormatted"

Constructor Summary
DateType()
          no argument constructor for beans
DateType(boolean isPresent, java.util.Date date)
          Constructor using a java.util.Date
DateType(DateType src)
          copy constructor
DateType(java.lang.String text, java.lang.String format, java.lang.String type)
          Constructor.
 
Method Summary
 DateType add(TimeDuration d)
           
 DateType add(TimeUnit d)
           
 boolean after(java.util.Date d)
           
 boolean before(java.util.Date d)
           
 boolean before(DateType d)
           
 boolean equals(java.lang.Object o)
           
 java.util.Date getDate()
           
 java.lang.String getFormat()
           
 java.lang.String getText()
           
 java.lang.String getType()
           
 int hashCode()
           
static java.lang.String hiddenProperties()
           
 boolean isBlank()
           
 boolean isPresent()
           
static void main(java.lang.String[] args)
           
 void setDate(java.util.Date date)
           
 void setType(java.lang.String type)
           
 DateType subtract(TimeDuration d)
           
 DateType subtract(TimeUnit d)
           
 java.lang.String toDateString()
           
 java.lang.String toDateTimeString()
           
 java.lang.String toDateTimeStringISO()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DateType

public DateType(boolean isPresent,
                java.util.Date date)
Constructor using a java.util.Date

Parameters:
isPresent - represents the "present time"
date - the given date

DateType

public DateType()
no argument constructor for beans


DateType

public DateType(DateType src)
copy constructor

Parameters:
src - copy from here

DateType

public DateType(java.lang.String text,
                java.lang.String format,
                java.lang.String type)
         throws java.text.ParseException
Constructor.

Parameters:
text - string representation
format - using java.text.SimpleDateFormat, or null
type - type of date, or null
Throws:
java.text.ParseException - if error parsing text
Method Detail

hiddenProperties

public static java.lang.String hiddenProperties()

getDate

public java.util.Date getDate()

setDate

public void setDate(java.util.Date date)

isPresent

public boolean isPresent()

isBlank

public boolean isBlank()

getText

public java.lang.String getText()

getFormat

public java.lang.String getFormat()

getType

public java.lang.String getType()

setType

public void setType(java.lang.String type)

before

public boolean before(java.util.Date d)

before

public boolean before(DateType d)

after

public boolean after(java.util.Date d)

toDateString

public java.lang.String toDateString()

toDateTimeString

public java.lang.String toDateTimeString()

toDateTimeStringISO

public java.lang.String toDateTimeStringISO()

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

add

public DateType add(TimeDuration d)

add

public DateType add(TimeUnit d)

subtract

public DateType subtract(TimeDuration d)

subtract

public DateType subtract(TimeUnit d)

main

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