org.n52.oxf.valueDomains.time
Class TimePosition
java.lang.Object
org.n52.oxf.valueDomains.time.TimePosition
- All Implemented Interfaces:
- Comparable<ITimePosition>, Comparator<ITimePosition>, ITime, ITimePosition
public class TimePosition
- extends Object
- implements 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 Foerster
| Fields inherited from interface org.n52.oxf.owsCommon.capabilities.ITime |
NOT_SET |
|
Constructor Summary |
TimePosition(String timePos)
constructs a timePosition out of a ISO 8601 String. |
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
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 -
- Throws:
IllegalArgumentException -
- if string ends with "T"
- if string is empty,
null or -
- or does not match any additional pattern
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)
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than
the specified object.
- Specified by:
compareTo in interface Comparable<ITimePosition>
- Parameters:
timePosP -
- Returns:
- -1 if this is before timePos; 1 if timePos is before this; 0 if this and timePos are equal.
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 © 2005 - 2010 52°North Initiative for Geospatial Open Source Software GmbH. All rights reserved.