Package com.blazebit.job
Interface TimeFrame
-
public interface TimeFrame
An abstraction for describing a time frame.- Since:
- 1.0.0
- Author:
- Christian Beikov
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default boolean
contains(Instant time)
Returns whether the given instant is contained in this time frame.default Instant
getEarliestInstant()
ReturnsgetEarliestInstant(Instant)
withInstant.now()
.default Instant
getEarliestInstant(Instant fromInstant)
Returns the earliest instant after the given instant that is part of this time frame.Month
getEndMonth()
Returns the month at which this time frame ends ornull
if it has no defined end.LocalTime
getEndTime()
Returns the time at which this time frame ends ornull
if it has no defined end.Year
getEndYear()
Returns the year at which this time frame ends ornull
if it has no defined end.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.Month
getStartMonth()
Returns the month at which this time frame starts ornull
if it has no defined start.LocalTime
getStartTime()
Returns the time at which this time frame starts ornull
if it has no defined start.Year
getStartYear()
Returns the year at which this time frame starts ornull
if it has no defined start.DayOfWeek
getWeekDay()
Returns the day of week which is allowed for this time framenull
if it has no defined day of week.static boolean
isContained(Set<? extends TimeFrame> timeFrames, Instant time)
Returns whether the given instant is contained in any of the time frames.
-
-
-
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 framestime
- 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 framestime
- 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 ornull
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 ornull
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 ornull
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 ornull
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 framenull
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 ornull
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 ornull
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()
ReturnsgetEarliestInstant(Instant)
withInstant.now()
.- Returns:
- the earliest instant
-
-