Interface TimeInterval


public interface TimeInterval
Interface representing a closed time interval i.e. [a, b], possibly of infinite length.
Since:
13.1
Author:
Romain Serra
See Also:
  • Field Details

  • Method Details

    • getStartDate

      AbsoluteDate getStartDate()
      Getter for the left end of the interval.
      Returns:
      left end
    • getEndDate

      AbsoluteDate getEndDate()
      Getter for the right end of the interval.
      Returns:
      right end
    • duration

      default double duration()
      Computes the interval length in seconds.
      Returns:
      duration
    • contains

      default boolean contains(TimeStamped timeStamped)
      Method returning true if and only if the dated input is contained within the closed interval.
      Parameters:
      timeStamped - time stamped object
      Returns:
      boolean on inclusion
    • contains

      default boolean contains(TimeInterval interval)
      Method returning true if and only if input (also a closed time interval) contains the instance.
      Parameters:
      interval - time interval
      Returns:
      boolean on inclusion
    • intersects

      default boolean intersects(TimeInterval interval)
      Method returning true if and only if input (also a closed time interval) intersects the instance.
      Parameters:
      interval - time interval
      Returns:
      boolean on intersection
    • of

      static TimeInterval of(AbsoluteDate date, AbsoluteDate otherDate, boolean allowNonChronological)
      Create instance from two dates.
      Parameters:
      date - date
      otherDate - other date
      allowNonChronological - if true, the two dates can be in arbitrary order, they will be sorted internally. If false and otherDate is before date, then an exception is triggered
      Returns:
      time interval
      Since:
      14.0
    • of

      static TimeInterval of(AbsoluteDate date, AbsoluteDate otherDate)
      Create instance from two dates in arbitrary order.
      Parameters:
      date - date
      otherDate - other date
      Returns:
      time interval
    • of

      static TimeInterval of(AbsoluteDate date, double duration)
      Create instance from two dates in arbitrary order.
      Parameters:
      date - start (or end) date
      duration - duration, in seconds (if positive, time interval is from date to date + duration, if negative, the time interval will be from date - duration to date)
      Returns:
      time interval
      Since:
      14.0