public interface ILocalDatePeriod extends IHasStartAndEnd<LocalDate>
| Modifier and Type | Method and Description |
|---|---|
static boolean |
hasOverlap(LocalDate aStart1,
LocalDate aEnd1,
LocalDate aStart2,
LocalDate aEnd2,
boolean bInclBoundaries)
Check if the provided range 1 has an overlap with the provided range 2.
|
default boolean |
isInPeriod(boolean bInclBoundaries,
LocalDate aDate)
Check if the provided date is inside this period, assuming that start and
end are included in/part of the range.
|
default boolean |
isInPeriodExcl(LocalDate aDate)
Check if the provided date is inside this period, assuming that start and
end are excluded from/not part of the range.
|
default boolean |
isInPeriodIncl(LocalDate aDate)
Check if the provided date is inside this period, assuming that start and
end are included in/part of the range.
|
static boolean |
isInside(LocalDate aStart,
boolean bInclStart,
LocalDate aEnd,
boolean bInclEnd,
LocalDate aQuery)
Check if the provided query date is between start and end.
|
default boolean |
isNowInPeriodExcl()
Check if the current date 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 is inside this period, assuming that start and
end are included in/part of the range.
|
default boolean |
isOverlappingWith(ILocalDatePeriod aPeriod,
boolean bInclBoundaries) |
default boolean |
isOverlappingWithExcl(ILocalDatePeriod aPeriod) |
default boolean |
isOverlappingWithIncl(ILocalDatePeriod aPeriod) |
getEnd, getStart, hasEnd, hasStartstatic boolean isInside(@Nullable LocalDate aStart, boolean bInclStart, @Nullable LocalDate aEnd, boolean bInclEnd, @Nonnull LocalDate aQuery)
null start means "since forever". A null end
means "until eternity and beyond".aStart - Start date. May be null.bInclStart - true if "start date" = "query date" should be a match,
false if not.aEnd - End date may be null.bInclEnd - true if "end date" = "query date" should be a match,
false if not.aQuery - Date to query whether it is inside or not. May not be
null.true if query date ≥ start date and ≤ end datedefault boolean isInPeriod(boolean bInclBoundaries,
@Nonnull
LocalDate 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 - Date to check. May not be null.true if it is contained, false otherwise.isInside(LocalDate, boolean, LocalDate, boolean, LocalDate)default boolean isInPeriodIncl(@Nonnull LocalDate aDate)
aDate - Date to check. May not be null.true if it is contained, false otherwise.isInPeriod(boolean, LocalDate),
isNowInPeriodIncl()default boolean isNowInPeriodIncl()
true if the current date is contained,
false otherwise.isInPeriod(boolean, LocalDate),
isInPeriodIncl(LocalDate)default boolean isInPeriodExcl(@Nonnull LocalDate aDate)
aDate - Date to check. May not be null.true if it is contained, false otherwise.isInPeriod(boolean, LocalDate),
isNowInPeriodExcl()default boolean isNowInPeriodExcl()
true if the current date is contained,
false otherwise.isInPeriod(boolean, LocalDate),
isInPeriodExcl(LocalDate)static boolean hasOverlap(@Nullable LocalDate aStart1, @Nullable LocalDate aEnd1, @Nullable LocalDate aStart2, @Nullable LocalDate 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" = "query date" 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 ILocalDatePeriod aPeriod, boolean bInclBoundaries)
default boolean isOverlappingWithIncl(@Nonnull ILocalDatePeriod aPeriod)
default boolean isOverlappingWithExcl(@Nonnull ILocalDatePeriod aPeriod)
Copyright © 2014–2022 Philip Helger. All rights reserved.