Package ucar.nc2.time
Class CalendarDuration
- java.lang.Object
-
- ucar.nc2.time.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:- a valid udunits string compatible with "secs"
- 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"
-
-
Constructor Summary
Constructors Constructor Description CalendarDuration(int value, CalendarPeriod.Field timeUnit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)static CalendarDurationfromUnitString(String unitString)CalendarPeriod.FieldgetTimeUnit()doublegetValue()Get the duration in natural units, ie units of getTimeUnit()inthashCode()StringtoString()String representation
-
-
-
Constructor Detail
-
CalendarDuration
public CalendarDuration(int value, CalendarPeriod.Field timeUnit)
-
-
Method Detail
-
getTimeUnit
public CalendarPeriod.Field getTimeUnit()
-
fromUnitString
public static CalendarDuration fromUnitString(String unitString)
-
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
-
-