org.n52.oxf.valueDomains.time
Class TimeResolution
java.lang.Object
org.n52.oxf.valueDomains.time.TimeResolution
- All Implemented Interfaces:
- ITime, ITimeResolution
public class TimeResolution
- extends Object
- implements ITimeResolution
Represents a TimeResolution as specified in ISO8601:2004. Inputs are validated against this pattern:
"P(\\d+Y)?(\\d+M)?(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+([.]\\d+)?S)?)?"
Valid example time strings:
P2Y P1Y1M3DT6H2M8.5S
- Author:
- Theodor Foerster
Fields inherited from interface org.n52.oxf.ows.capabilities.ITime |
NOT_SET |
RESOLUTION_PATTERN
public static final String RESOLUTION_PATTERN
- See Also:
- Constant Field Values
TimeResolution
public TimeResolution(String res)
- constructs a timeResolution. Validates against the pattern mentioned in the ISO8601:2004 spec (section
4.4.4.2.1). This pattern is extended in order to support a number of days with more than 2 digits.
- Parameters:
res
-
getYears
public long getYears()
- Specified by:
getYears
in interface ITimeResolution
getMonths
public int getMonths()
- Specified by:
getMonths
in interface ITimeResolution
getDays
public int getDays()
- Specified by:
getDays
in interface ITimeResolution
getMinutes
public int getMinutes()
- Specified by:
getMinutes
in interface ITimeResolution
getHours
public int getHours()
- Specified by:
getHours
in interface ITimeResolution
getSeconds
public float getSeconds()
- Specified by:
getSeconds
in interface ITimeResolution
toISO8601Format
public String toISO8601Format()
- Specified by:
toISO8601Format
in interface ITime
toString
public String toString()
- Specified by:
toString
in interface ITime
- Overrides:
toString
in class Object
- Returns:
- a String representation of this ITime object.
Copyright © 2012-2013 52north.org. All Rights Reserved.