Interface ChronoInterval<T>

Type Parameters:
T - temporal type of time points within a given interval
All Known Implementing Classes:
CalendarMonth, CalendarPeriod, CalendarQuarter, CalendarWeek, CalendarYear, ClockInterval, DateInterval, FixedCalendarInterval, IsoInterval, MomentInterval, SimpleInterval, TimestampInterval, ValueInterval

public interface ChronoInterval<T>

Represents a temporal interval on a timeline.

Note: Time4J-intervals contain every timepoint between start and end boundary without exception (continuous intervals). The start must not be after the end.

Since:
2.0
Author:
Meno Hochschild
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    abuts​(ChronoInterval<T> other)
    Queries if this interval abuts the other one such that there is neither any overlap nor any gap between.
    boolean
    Does this interval contain the other one?
    boolean
    contains​(T temporal)
    Queries if given time point belongs to this interval.
    Yields the upper bound of this interval.
    Yields the lower bound of this interval.
    default boolean
    Queries if this interval intersects the other one such that there is at least one common time point.
    default boolean
    Is this interval after the other one?
    boolean
    isAfter​(T temporal)
    Is this interval after the given time point?
    boolean
    Is this interval before the other one?
    boolean
    isBefore​(T temporal)
    Is this interval before the given time point?
    boolean
    Determines if this interval is empty.
    default boolean
    Determines if this interval has finite boundaries.
  • Method Details

    • getStart

      Boundary<T> getStart()

      Yields the lower bound of this interval.

      Returns:
      start interval boundary
      Since:
      2.0
    • getEnd

      Boundary<T> getEnd()

      Yields the upper bound of this interval.

      Returns:
      end interval boundary
      Since:
      2.0
    • isFinite

      default boolean isFinite()

      Determines if this interval has finite boundaries.

      Returns:
      true if start and end are finite else false
      Since:
      2.0
    • isEmpty

      boolean isEmpty()

      Determines if this interval is empty.

      Returns:
      true if this interval does not contain any time point else false
      Since:
      2.0
    • contains

      boolean contains(T temporal)

      Queries if given time point belongs to this interval.

      Parameters:
      temporal - time point to be queried
      Returns:
      true if given time point belongs to this interval else false
      Since:
      2.0
    • contains

      boolean contains(ChronoInterval<T> other)

      Does this interval contain the other one?

      An interval cannot contain infinite intervals but can contain an empty interval if it contains the start anchor of the empty interval.

      Parameters:
      other - another interval whose relation to this interval is to be investigated
      Returns:
      true if this interval contains the other one else false
      Since:
      3.25/4.21
      See Also:
      intersects(ChronoInterval)
    • isAfter

      boolean isAfter(T temporal)

      Is this interval after the given time point?

      Parameters:
      temporal - reference time point
      Returns:
      true if this interval is after given time point else false
    • isAfter

      default boolean isAfter(ChronoInterval<T> other)

      Is this interval after the other one?

      Parameters:
      other - another interval whose relation to this interval is to be investigated
      Returns:
      true if this interval is after the other one else false
      Since:
      3.25/4.21
    • isBefore

      boolean isBefore(T temporal)

      Is this interval before the given time point?

      Parameters:
      temporal - reference time point
      Returns:
      true if this interval is before given time point else false
    • isBefore

      boolean isBefore(ChronoInterval<T> other)

      Is this interval before the other one?

      Parameters:
      other - another interval whose relation to this interval is to be investigated
      Returns:
      true if this interval is before the other one else false
      Since:
      3.25/4.21
    • abuts

      boolean abuts(ChronoInterval<T> other)

      Queries if this interval abuts the other one such that there is neither any overlap nor any gap between.

      Note: Empty intervals never abut.

      Parameters:
      other - another interval which might abut this interval
      Returns:
      true if there is no intersection and no gap between else false
      Since:
      3.25/4.21
    • intersects

      default boolean intersects(ChronoInterval<T> other)

      Queries if this interval intersects the other one such that there is at least one common time point.

      In contrast to contains(ChronoInterval), an interval can never intersect an empty interval.

      Parameters:
      other - another interval which might have an intersection with this interval
      Returns:
      true if there is an non-empty intersection of this interval and the other one else false
      Since:
      3.25/4.21
      See Also:
      isBefore(ChronoInterval), isAfter(ChronoInterval)