Class LocalDateTimeInterval


  • public final class LocalDateTimeInterval
    extends Object
    Represents an interval between two LocalDateTime. Intervals are inclusive of the start time and exclusive of the end time. The end time is always greater than or equal to the start time.
    • Method Detail

      • of

        public static LocalDateTimeInterval of​(LocalDateTime start,
                                               LocalDateTime end)
        Creates an interval from a start and end time.
        Parameters:
        start - the start time of the interval
        end - the end time of the interval
        Returns:
        the interval
      • of

        public static LocalDateTimeInterval of​(LocalDateTime start,
                                               Period period)
        Creates an interval from a start time and a period.
        Parameters:
        start - the start time of the interval
        period - the period of the interval
        Returns:
        the interval
      • of

        public static LocalDateTimeInterval of​(Period period,
                                               LocalDateTime end)
        Creates an interval from a period and an end time.
        Parameters:
        period - the period of the interval
        end - the end time of the interval
        Returns:
        the interval
      • contains

        public boolean contains​(LocalDateTime t)
        Whether this time interval contains the given time.
        Parameters:
        t - the time to test
        Returns:
        true if this interval contains the given time
      • overlaps

        public boolean overlaps​(LocalDateTimeInterval other)
        Whether this time interval overlaps with the given time interval.
        Parameters:
        other - the interval to test
        Returns:
        true if this interval overlaps with the given interval
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object