Interface TimeFrame


  • public interface TimeFrame
    An abstraction for describing a time frame.
    Since:
    1.0.0
    Author:
    Christian Beikov
    • Method Detail

      • getNearestTimeFrameSchedule

        static Instant getNearestTimeFrameSchedule​(Set<? extends TimeFrame> timeFrames,
                                                   Instant time)
        Returns the earliest instant after the given instant that is part of any of the given time frames.
        Parameters:
        timeFrames - The time frames
        time - The instant
        Returns:
        the earliest instant
      • isContained

        static boolean isContained​(Set<? extends TimeFrame> timeFrames,
                                   Instant time)
        Returns whether the given instant is contained in any of the time frames.
        Parameters:
        timeFrames - The time frames
        time - The instant
        Returns:
        whether the given instant is contained in any of the time frames
      • getStartYear

        Year getStartYear()
        Returns the year at which this time frame starts or null if it has no defined start.
        Returns:
        the year at which this time frame starts or null
      • getEndYear

        Year getEndYear()
        Returns the year at which this time frame ends or null if it has no defined end.
        Returns:
        the year at which this time frame ends or null
      • getStartMonth

        Month getStartMonth()
        Returns the month at which this time frame starts or null if it has no defined start.
        Returns:
        the month at which this time frame starts or null
      • getEndMonth

        Month getEndMonth()
        Returns the month at which this time frame ends or null if it has no defined end.
        Returns:
        the month at which this time frame ends or null
      • getWeekDay

        DayOfWeek getWeekDay()
        Returns the day of week which is allowed for this time frame null if it has no defined day of week.
        Returns:
        the day of week which is allowed for this time frame null
      • getStartTime

        LocalTime getStartTime()
        Returns the time at which this time frame starts or null if it has no defined start.
        Returns:
        the time at which this time frame starts or null
      • getEndTime

        LocalTime getEndTime()
        Returns the time at which this time frame ends or null if it has no defined end.
        Returns:
        the time at which this time frame ends or null
      • contains

        default boolean contains​(Instant time)
        Returns whether the given instant is contained in this time frame.
        Parameters:
        time - The instant
        Returns:
        whether the given instant is contained in this time frame
      • getEarliestInstant

        default Instant getEarliestInstant​(Instant fromInstant)
        Returns the earliest instant after the given instant that is part of this time frame.
        Parameters:
        fromInstant - The reference instant
        Returns:
        the earliest instant