Class TimePeriod

java.lang.Object
org.n52.shetland.ogc.gml.time.Time
org.n52.shetland.ogc.gml.time.TimePeriod
All Implemented Interfaces:
Serializable, Comparable<Time>

public class TimePeriod extends Time
Class represents a GML conform timePeriod element.
Since:
1.0.0
See Also:
  • Constructor Details

    • TimePeriod

      public TimePeriod()
      default constructor
    • TimePeriod

      public TimePeriod(org.joda.time.Interval interval)
      Creates a new TimePeriod from an Interval.
      Parameters:
      interval - the interval
    • TimePeriod

      public TimePeriod(org.joda.time.DateTime start, org.joda.time.DateTime end)
      constructor with start and end date as parameters
      Parameters:
      start - start date of the time period
      end - end date of the time period
    • TimePeriod

      public TimePeriod(org.joda.time.DateTime start, org.joda.time.DateTime end, String id)
      constructor
      Parameters:
      start - start date of the time period
      end - end date of the time period
      id - GML id
    • TimePeriod

      public TimePeriod(org.joda.time.DateTime start, IndeterminateValue startIndet, org.joda.time.DateTime end, IndeterminateValue endIndet)
      constructor
      Parameters:
      start - start date of the time period
      startIndet - indeterminate time position of start
      end - end date of the time period
      endIndet - indeterminate time value of end position
    • TimePeriod

      public TimePeriod(org.joda.time.DateTime start, IndeterminateValue startIndet, org.joda.time.DateTime end, IndeterminateValue endIndet, String duration, String id) throws ParseException
      standard constructor
      Parameters:
      start - timeString of start position in ISO8601 format
      startIndet - indeterminate time position of start
      end - timeString of end position in ISO8601 format
      endIndet - indeterminate time value of end position
      duration - duration in ISO8601 format
      id - the optional GML id
      Throws:
      ParseException - if parsing the time strings of start or end into java.util.Date failed
    • TimePeriod

      public TimePeriod(TimeInstant startTime, TimeInstant endTime)
      Constructor using TimeInstants
      Parameters:
      startTime - Start TimeInstant
      endTime - End TimeInstant
    • TimePeriod

      public TimePeriod(Date start, Date end)
      Constructor using Java Dates, setting unknown indeterminate values if null
      Parameters:
      start - start Date
      end - end Date
    • TimePeriod

      public TimePeriod(Object start, Object end)
      Constructor using Java Objects, setting unknown indeterminate values if null
      Parameters:
      start - start Object
      end - end Object
  • Method Details

    • getDuration

      public org.joda.time.Period getDuration()
      Get duration
      Returns:
      Returns the duration.
    • setDuration

      public void setDuration(org.joda.time.Period duration)
      Set duration
      Parameters:
      duration - The duration to set.
    • getStart

      public org.joda.time.DateTime getStart()
      Get start time
      Returns:
      Returns the start.
    • setStart

      public void setStart(org.joda.time.DateTime start)
      Set start time
      Parameters:
      start - The start to set.
    • resolveStart

      public org.joda.time.DateTime resolveStart()
      Get start time, resolving indeterminate value if start is null
      Returns:
      Returns the resolved start time.
    • getEnd

      public org.joda.time.DateTime getEnd()
      Get end time
      Returns:
      Returns the end.
    • setEnd

      public void setEnd(org.joda.time.DateTime end)
      Set end time
      Parameters:
      end - The end to set.
    • resolveEnd

      public org.joda.time.DateTime resolveEnd()
      Get end time, resolving indeterminate value if start is null
      Returns:
      Returns the resolved end time.
    • getStartIndet

      public IndeterminateValue getStartIndet()
      Get start indet time
      Returns:
      Returns the startIndet.
    • setStartIndet

      public void setStartIndet(IndeterminateValue startIndet)
      Set start indet time
      Parameters:
      startIndet - The startIndet to set.
    • getEndIndet

      public IndeterminateValue getEndIndet()
      Get end indet time
      Returns:
      Returns the endIndet.
    • setEndIndet

      public void setEndIndet(IndeterminateValue endIndet)
      Set end indet time
      Parameters:
      endIndet - The endIndet to set.
    • getInterval

      public String getInterval()
      Get interval
      Returns:
      Interval string
    • setInterval

      public void setInterval(String interval)
      Set interval
      Parameters:
      interval - the interval
    • getStartTimePosition

      public TimePosition getStartTimePosition()
      Get TimePosition for start.
      Returns:
      Start TimePosition object
    • getEndTimePosition

      public TimePosition getEndTimePosition()
      Get TimePosition for end.
      Returns:
      End TimePosition object
    • extendToContain

      public void extendToContain(Collection<Time> times)
      Extend TimePeriod to contain provided collection of Times
      Parameters:
      times - the times to contain
    • extendToContain

      public void extendToContain(Time time)
      Extend TimePeriod to contain provided Time
      Parameters:
      time - To contain Time
    • extendToContain

      public void extendToContain(TimePeriod period)
      Extend TimePeriod to contain another TimePeriod
      Parameters:
      period - To contain TimePeriod
    • extendToContain

      public void extendToContain(TimeInstant instant)
      Extend TimePeriod to contain TimeInstant
      Parameters:
      instant - To contain TimeInstant
    • extendToContain

      public void extendToContain(org.joda.time.DateTime time)
      Extend TimePeriod to contain DateTime. Used by other extendToContain methods.
      Parameters:
      time - the time to contain
    • isWithin

      public boolean isWithin(TimePeriod otherTimePeriod)
      Is this TimePeriod contained by another TimePeriod? Equal start/end times are considered to be containing, as are equal indeterminate times.
      Parameters:
      otherTimePeriod - Potentially containing TimePeriod
      Returns:
      Whether the argument TimePeriod contains this one
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(Time o)
    • isEmpty

      public boolean isEmpty()
      Description copied from class: Time
      Check if time is empty
      Overrides:
      isEmpty in class Time
      Returns:
      true, if start and end are NOT set
      See Also:
    • isSetStart

      public boolean isSetStart()
      Returns:
      true, if start is set
      See Also:
    • isSetStartIndeterminateValue

      public boolean isSetStartIndeterminateValue()
      Returns:
      true, if start IndeterminateValue is set
    • isSetEndIndeterminateValue

      public boolean isSetEndIndeterminateValue()
      Returns:
      true, if end IndeterminateValue is set
    • isSetEnd

      public boolean isSetEnd()
      Returns:
      true, if end is set
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object