org.n52.oxf.valueDomains.time
Class TimeResolution

java.lang.Object
  extended by 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

    Field Summary
    static String RESOLUTION_PATTERN
               
     
    Fields inherited from interface org.n52.oxf.ows.capabilities.ITime
    NOT_SET
     
    Constructor Summary
    TimeResolution(String res)
              constructs a timeResolution.
     
    Method Summary
     int getDays()
               
     int getHours()
               
     int getMinutes()
               
     int getMonths()
               
     float getSeconds()
               
     long getYears()
               
     String toISO8601Format()
               
     String toString()
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    RESOLUTION_PATTERN

    public static final String RESOLUTION_PATTERN
    See Also:
    Constant Field Values
    Constructor Detail

    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 -
    Method Detail

    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.