Package ucar.nc2.time

Class CalendarDuration


  • @Immutable
    public class CalendarDuration
    extends Object
    A replacement for ucar.nc2.units.TimeDuration. incomplete. A Duration is a fixed number of seconds. I think thats wrong: a CalendarDuration should be a integer and a CalendarPeriod. Optionally, a CalendarPeriod could have an integer value. 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. an xsd:duration type specified in the following form "PnYnMnDTnHnMnS" where:
      • P indicates the period (required)
      • nY indicates the number of years
      • nM indicates the number of months
      • nD indicates the number of days
      • T indicates the start of a time section (required if you are going to specify hours, minutes, or seconds)
      • nH indicates the number of hours
      • nM indicates the number of minutes
      • nS indicates the number of seconds

    change to JSR-310 javax.time.Duration when ready relation to javax.xml.datatype ?

    See Also:
    "https://www.unidata.ucar.edu/projects/THREDDS/tech/catalog/InvCatalogSpec.html#durationType"
    • Method Detail

      • getValue

        public double getValue()
        Get the duration in natural units, ie units of getTimeUnit()
        Returns:
        the duration in natural units
      • toString

        public String toString()
        String representation
        Overrides:
        toString in class Object
        Returns:
        getText()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object