org.n52.oxf.valueDomains.time
Class TimePosition

java.lang.Object
  extended by org.n52.oxf.valueDomains.time.TimePosition
All Implemented Interfaces:
Comparable<ITimePosition>, Comparator<ITimePosition>, ITime, ITimePosition

public class TimePosition
extends Object
implements ITimePosition, Comparable<ITimePosition>

Represents a single timePosition. It is leaned on the WMS profile of ISO8601 spec. Any suggestions about that profile are made in the decisions.html.
Valid example time strings:

  • 2005-11-01
  • 2005-11-01T12:30
  • 2005-11-01T12:30:20Z
  • Author:
    Theodor Förster, Eike Hinderk Jürrens

    Field Summary
    static String DAY_PATTERN
               
    static String HOUR_PATTERN
               
    static String MINUTE_PATTERN
               
    static String MONTH_PATTERN
               
    static String SECOND_PATTERN
               
    static String UTC_PATTERN
               
    static String YEAR_PATTERN
               
     
    Fields inherited from interface org.n52.oxf.ows.capabilities.ITime
    NOT_SET
     
    Constructor Summary
    TimePosition(String timePos)
              Constructs a TimePosition out of a ISO 8601 String.
     
    Method Summary
     boolean after(ITimePosition timePosP)
               
     boolean before(ITimePosition timePosP)
               
     int compare(ITimePosition o1, ITimePosition o2)
              a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
     int compareTo(ITimePosition timePosP)
               
     boolean equals(Object obj)
               
     Calendar getCalendar()
               
     int getDay()
               
     int getHour()
               
     int getMinute()
               
     int getMonth()
               
     float getSecond()
               
     ITimeResolution getTimeResolution()
               
     String getTimezone()
               
     long getYear()
               
     void setTimezone(String timezone)
               
     String toISO8601Format()
               
     String toString()
               
     
    Methods inherited from class java.lang.Object
    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     

    Field Detail

    YEAR_PATTERN

    public static final String YEAR_PATTERN
    See Also:
    Constant Field Values

    MONTH_PATTERN

    public static final String MONTH_PATTERN
    See Also:
    Constant Field Values

    DAY_PATTERN

    public static final String DAY_PATTERN
    See Also:
    Constant Field Values

    HOUR_PATTERN

    public static final String HOUR_PATTERN
    See Also:
    Constant Field Values

    MINUTE_PATTERN

    public static final String MINUTE_PATTERN
    See Also:
    Constant Field Values

    SECOND_PATTERN

    public static final String SECOND_PATTERN
    See Also:
    Constant Field Values

    UTC_PATTERN

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

    TimePosition

    public TimePosition(String timePos)
                 throws IllegalArgumentException
    Constructs a TimePosition out of a ISO 8601 String. The string has at least to indicate the year.

    Parameters:
    timePos - a ISO 8601 compliant String
    Throws:
    IllegalArgumentException -
    • if string ends with "T"
    • if string is empty, null or -
    • or does not match any additional pattern
    Method Detail

    getYear

    public long getYear()
    Specified by:
    getYear in interface ITimePosition

    getMonth

    public int getMonth()
    Specified by:
    getMonth in interface ITimePosition

    getDay

    public int getDay()
    Specified by:
    getDay in interface ITimePosition

    getHour

    public int getHour()
    Specified by:
    getHour in interface ITimePosition

    getMinute

    public int getMinute()
    Specified by:
    getMinute in interface ITimePosition

    getSecond

    public float getSecond()
    Specified by:
    getSecond in interface ITimePosition

    getTimeResolution

    public ITimeResolution getTimeResolution()

    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 TimePosition object of the form: e.g.: 16.6.2006 14:53:12

    equals

    public boolean equals(Object obj)
    Specified by:
    equals in interface Comparator<ITimePosition>
    Overrides:
    equals in class Object

    compareTo

    public int compareTo(ITimePosition timePosP)
    Specified by:
    compareTo in interface Comparable<ITimePosition>

    compare

    public int compare(ITimePosition o1,
                       ITimePosition o2)
    a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

    Specified by:
    compare in interface Comparator<ITimePosition>
    Parameters:
    o1 -
    o2 -
    Returns:

    before

    public boolean before(ITimePosition timePosP)
    Specified by:
    before in interface ITimePosition
    Returns:
    whether this TimePosition represents a time before the time represented by the specified TimePosition object. This method is equivalent to: compareTo(when) < 0

    after

    public boolean after(ITimePosition timePosP)
    Specified by:
    after in interface ITimePosition
    Returns:
    whether this TimePosition represents a time after the time represented by the specified TimePosition object. This method is equivalent to: compareTo(when) > 0

    getCalendar

    public Calendar getCalendar()
    Specified by:
    getCalendar in interface ITimePosition
    Returns:
    this ITimePosition as a Calendar object.

    getTimezone

    public String getTimezone()
    Specified by:
    getTimezone in interface ITimePosition

    setTimezone

    public void setTimezone(String timezone)


    Copyright © 2012-2013 52north.org. All Rights Reserved.