Class TimeCoverage


  • @Immutable
    public class TimeCoverage
    extends Object
    A range of dates, using DateType start/end, and/or a TimeDuration. You can use a DateType = "present" and a time duration to specify "real time" intervals, eg "last 3 days" uses endDate = "present" and duration = "3 days".

    A DateRange can be specified in any of the following ways:
    1. a start date and end date
    2. a start date and duration
    3. an end date and duration
    • Method Detail

      • contains

        public boolean contains​(CalendarDate date)
        Determine if the given date is contained in this date range. The date range includes the start and end dates.
        Parameters:
        date - the gicen date
        Returns:
        true if date in inside this range
      • intersects

        public boolean intersects​(CalendarDate start_want,
                                  CalendarDate end_want)
        Determine if the given range intersects this TimeCoverage.
        Parameters:
        start_want - range starts here
        end_want - range ends here
        Returns:
        true if ranges intersect
      • intersects

        public boolean intersects​(TimeCoverage other)
        Determine if the given range intersects this TimeCoverage.
        Parameters:
        other - date range
        Returns:
        true if ranges intersect
      • intersect

        public TimeCoverage intersect​(TimeCoverage clip)
        Intersect with another TimeCoverage
        Parameters:
        clip - intersect with this date range
        Returns:
        new TimeCoverage that is the intersection
      • extend

        public TimeCoverage extend​(TimeCoverage dr)
        Extend this TimeCoverage by the given one.
        Returns:
        new TimeCoverage that is extended if needed.
      • extend

        public TimeCoverage extend​(CalendarDate date)
        Extend this TimeCoverage by the given date.
        Returns:
        new TimeCoverage that is extended if needed.
      • getStart

        public DateType getStart()
        Get the starting Date.
      • getEnd

        public DateType getEnd()
        Get the ending Date.
      • getDuration

        public TimeDuration getDuration()
        Get the duration of the interval
      • getResolution

        public TimeDuration getResolution()
        Get the time resolution.
      • fixedStart

        public boolean fixedStart()
        Get if the start is fixed.
      • fixedEnd

        public boolean fixedEnd()
        Get if the end is fixed.
      • fixedDuration

        public boolean fixedDuration()
        Get if the duration is fixed.
      • fixedResolution

        public boolean fixedResolution()
        Get if the resolution is set.
      • isPoint

        public boolean isPoint()
        Return true if start date equals end date, so date range is a point.
      • isEmpty

        public boolean isEmpty()
        If the range is empty
      • hashCode

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

        public static TimeCoverage create​(@Nullable
                                          DateType start,
                                          @Nullable
                                          DateType end,
                                          @Nullable
                                          TimeDuration duration,
                                          @Nullable
                                          TimeDuration resolution)
        Encapsulates a range of dates, using DateType start/end, and/or a TimeDuration. A DateRange can be specified in any of the following ways:
        1. a start date and end date
        2. a start date and duration
        3. an end date and duration
        Parameters:
        start - starting date; may be null
        end - ending date; may be null
        duration - time duration; may be null
        resolution - time resolution; may be null