public interface ILocalDateTimePeriod extends IHasStartAndEnd<LocalDateTime>
| Modifier and Type | Method and Description |
|---|---|
static boolean |
hasOverlap(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 boolean |
isInPeriod(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 boolean |
isInPeriodExcl(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 boolean |
isInPeriodIncl(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 boolean |
isInside(LocalDateTime aStart,
boolean bInclStart,
LocalDateTime aEnd,
boolean bInclEnd,
LocalDateTime aQuery)
Check if the provided query date time is between start and end.
|
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.
|
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.
|
default boolean |
isOverlappingWith(ILocalDateTimePeriod aPeriod,
boolean bInclBoundaries) |
default boolean |
isOverlappingWithExcl(ILocalDateTimePeriod aPeriod) |
default boolean |
isOverlappingWithIncl(ILocalDateTimePeriod aPeriod) |
getEnd, getStart, hasEnd, hasStartstatic boolean isInside(@Nullable LocalDateTime aStart, boolean bInclStart, @Nullable LocalDateTime aEnd, boolean bInclEnd, @Nonnull LocalDateTime aQuery)
null start means "since forever". A null end
means "until eternity and beyond".aStart - Start date time. May be null.bInclStart - true if "start date time" = "query date time" should be
a match, false if not.aEnd - End date time may be null.bInclEnd - true if "end date time" = "query date time" should be a
match, false if not.aQuery - Date time to query whether it is inside or not. May not be
null.true if query date time ≥ start date time and ≤
end date timedefault boolean isInPeriod(boolean bInclBoundaries,
@Nonnull
LocalDateTime aDate)
bInclBoundaries - true if "start date" = "query date" should be a match
i.e. if "end date" = "query date" should be a match,
false if this should not be a match.aDate - time Date time to check. May not be null.true if it is contained, false otherwise.isInside(LocalDateTime, boolean, LocalDateTime, boolean,
LocalDateTime)default boolean isInPeriodIncl(@Nonnull LocalDateTime aDateTime)
aDateTime - Date time to check. May not be null.true if it is contained, false otherwise.isInPeriod(boolean, LocalDateTime),
isNowInPeriodIncl()default boolean isNowInPeriodIncl()
true if the current date is contained,
false otherwise.isInPeriod(boolean, LocalDateTime),
isInPeriodIncl(LocalDateTime)default boolean isInPeriodExcl(@Nonnull LocalDateTime aDateTime)
aDateTime - Date time to check. May not be null.true if it is contained, false otherwise.isInPeriod(boolean, LocalDateTime),
isNowInPeriodExcl()default boolean isNowInPeriodExcl()
true if the current date time is contained,
false otherwise.isInPeriod(boolean, LocalDateTime),
isInPeriodExcl(LocalDateTime)static boolean hasOverlap(@Nullable LocalDateTime aStart1, @Nullable LocalDateTime aEnd1, @Nullable LocalDateTime aStart2, @Nullable LocalDateTime aEnd2, boolean bInclBoundaries)
aStart1 - Start date of the first range. May be null.aEnd1 - End date of the first range. May be null meaning it's
validity is "until eternity and beyond".aStart2 - Start date of the second range. May be null.aEnd2 - End date of the second range. May be null meaning it's
validity is "until eternity and beyond".bInclBoundaries - true if "start date" = "query date" should be a match
i.e. if "end date time" = "query date time" should be a match,
false if this should not be a match.true if the 2 ranges have at least one point in time
(with duration 0) that they share.default boolean isOverlappingWith(@Nonnull ILocalDateTimePeriod aPeriod, boolean bInclBoundaries)
default boolean isOverlappingWithIncl(@Nonnull ILocalDateTimePeriod aPeriod)
default boolean isOverlappingWithExcl(@Nonnull ILocalDateTimePeriod aPeriod)
Copyright © 2014–2023 Philip Helger. All rights reserved.