Package com.helger.datetime.period
Interface ILocalDateTimePeriod
-
- All Superinterfaces:
IHasStartAndEnd<LocalDateTime>
- All Known Implementing Classes:
LocalDateTimePeriod
public interface ILocalDateTimePeriod extends IHasStartAndEnd<LocalDateTime>
Base interface for a period consisting of 2 local date periods.- Since:
- 10.0.0
- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static booleanhasOverlap(LocalDateTime aStart1, LocalDateTime aEnd1, LocalDateTime aStart2, LocalDateTime aEnd2, boolean bInclBoundaries)Check if the provided range 1 has an overlap with the provided range 2.default booleanisInPeriod(boolean bInclBoundaries, LocalDateTime aDate)Check if the provided date time is inside this period, assuming that start and end are included in/part of the range.default booleanisInPeriodExcl(LocalDateTime aDateTime)Check if the provided date time is inside this period, assuming that start and end are excluded from/not part of the range.default booleanisInPeriodIncl(LocalDateTime aDateTime)Check if the provided date time is inside this period, assuming that start and end are included in/part of the range.static booleanisInside(LocalDateTime aStart, boolean bInclStart, LocalDateTime aEnd, boolean bInclEnd, LocalDateTime aQuery)Check if the provided query date time is between start and end.default booleanisNowInPeriodExcl()Check if the current date time is inside this period, assuming that start and end are excluded from/not part of the range.default booleanisNowInPeriodIncl()Check if the current date time is inside this period, assuming that start and end are included in/part of the range.default booleanisOverlappingWith(ILocalDateTimePeriod aPeriod, boolean bInclBoundaries)default booleanisOverlappingWithExcl(ILocalDateTimePeriod aPeriod)default booleanisOverlappingWithIncl(ILocalDateTimePeriod aPeriod)-
Methods inherited from interface com.helger.datetime.domain.IHasStartAndEnd
getEnd, getStart, hasEnd, hasStart
-
-
-
-
Method Detail
-
isInside
static boolean isInside(@Nullable LocalDateTime aStart, boolean bInclStart, @Nullable LocalDateTime aEnd, boolean bInclEnd, @Nonnull LocalDateTime aQuery)
Check if the provided query date time is between start and end. Anullstart means "since forever". Anullend means "until eternity and beyond".- Parameters:
aStart- Start date time. May benull.bInclStart-trueif "start date time" = "query date time" should be a match,falseif not.aEnd- End date time may benull.bInclEnd-trueif "end date time" = "query date time" should be a match,falseif not.aQuery- Date time to query whether it is inside or not. May not benull.- Returns:
trueif query date time ≥ start date time and ≤ end date time
-
isInPeriod
default boolean isInPeriod(boolean bInclBoundaries, @Nonnull LocalDateTime aDate)Check if the provided date time is inside this period, assuming that start and end are included in/part of the range.- Parameters:
bInclBoundaries-trueif "start date" = "query date" should be a match i.e. if "end date" = "query date" should be a match,falseif this should not be a match.aDate- time Date time to check. May not benull.- Returns:
trueif it is contained,falseotherwise.- See Also:
isInside(LocalDateTime, boolean, LocalDateTime, boolean, LocalDateTime)
-
isInPeriodIncl
default boolean isInPeriodIncl(@Nonnull LocalDateTime aDateTime)
Check if the provided date time is inside this period, assuming that start and end are included in/part of the range.- Parameters:
aDateTime- Date time to check. May not benull.- Returns:
trueif it is contained,falseotherwise.- See Also:
isInPeriod(boolean, LocalDateTime),isNowInPeriodIncl()
-
isNowInPeriodIncl
default boolean isNowInPeriodIncl()
Check if the current date time is inside this period, assuming that start and end are included in/part of the range.- Returns:
trueif the current date is contained,falseotherwise.- See Also:
isInPeriod(boolean, LocalDateTime),isInPeriodIncl(LocalDateTime)
-
isInPeriodExcl
default boolean isInPeriodExcl(@Nonnull LocalDateTime aDateTime)
Check if the provided date time is inside this period, assuming that start and end are excluded from/not part of the range.- Parameters:
aDateTime- Date time to check. May not benull.- Returns:
trueif it is contained,falseotherwise.- See Also:
isInPeriod(boolean, LocalDateTime),isNowInPeriodExcl()
-
isNowInPeriodExcl
default boolean isNowInPeriodExcl()
Check if the current date time is inside this period, assuming that start and end are excluded from/not part of the range.- Returns:
trueif the current date time is contained,falseotherwise.- See Also:
isInPeriod(boolean, LocalDateTime),isInPeriodExcl(LocalDateTime)
-
hasOverlap
static boolean hasOverlap(@Nullable LocalDateTime aStart1, @Nullable LocalDateTime aEnd1, @Nullable LocalDateTime aStart2, @Nullable LocalDateTime aEnd2, boolean bInclBoundaries)
Check if the provided range 1 has an overlap with the provided range 2.- Parameters:
aStart1- Start date of the first range. May benull.aEnd1- End date of the first range. May benullmeaning it's validity is "until eternity and beyond".aStart2- Start date of the second range. May benull.aEnd2- End date of the second range. May benullmeaning it's validity is "until eternity and beyond".bInclBoundaries-trueif "start date" = "query date" should be a match i.e. if "end date time" = "query date time" should be a match,falseif this should not be a match.- Returns:
trueif the 2 ranges have at least one point in time (with duration 0) that they share.
-
isOverlappingWith
default boolean isOverlappingWith(@Nonnull ILocalDateTimePeriod aPeriod, boolean bInclBoundaries)
-
isOverlappingWithIncl
default boolean isOverlappingWithIncl(@Nonnull ILocalDateTimePeriod aPeriod)
-
isOverlappingWithExcl
default boolean isOverlappingWithExcl(@Nonnull ILocalDateTimePeriod aPeriod)
-
-