Package com.helger.datetime.period
Interface ILocalDatePeriod
-
- All Superinterfaces:
IHasStartAndEnd<LocalDate>
- All Known Implementing Classes:
LocalDatePeriod
public interface ILocalDatePeriod extends IHasStartAndEnd<LocalDate>
Base interface for a period consisting of 2 local date periods.- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description static booleanhasOverlap(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 booleanisInPeriod(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 booleanisInPeriodExcl(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 booleanisInPeriodIncl(LocalDate aDate)Check if the provided date is inside this period, assuming that start and end are included in/part of the range.static booleanisInside(LocalDate aStart, boolean bInclStart, LocalDate aEnd, boolean bInclEnd, LocalDate aQuery)Check if the provided query date is between start and end.default booleanisNowInPeriodExcl()Check if the current date is inside this period, assuming that start and end are excluded from/not part of the range.default booleanisNowInPeriodIncl()Check if the current date is inside this period, assuming that start and end are included in/part of the range.default booleanisOverlappingWith(ILocalDatePeriod aPeriod, boolean bInclBoundaries)default booleanisOverlappingWithExcl(ILocalDatePeriod aPeriod)default booleanisOverlappingWithIncl(ILocalDatePeriod aPeriod)-
Methods inherited from interface com.helger.datetime.domain.IHasStartAndEnd
getEnd, getStart, hasEnd, hasStart
-
-
-
-
Method Detail
-
isInside
static boolean isInside(@Nullable LocalDate aStart, boolean bInclStart, @Nullable LocalDate aEnd, boolean bInclEnd, @Nonnull LocalDate aQuery)
Check if the provided query date is between start and end. Anullstart means "since forever". Anullend means "until eternity and beyond".- Parameters:
aStart- Start date. May benull.bInclStart-trueif "start date" = "query date" should be a match,falseif not.aEnd- End date may benull.bInclEnd-trueif "end date" = "query date" should be a match,falseif not.aQuery- Date to query whether it is inside or not. May not benull.- Returns:
trueif query date ≥ start date and ≤ end date- Since:
- 10.0.0
-
isInPeriod
default boolean isInPeriod(boolean bInclBoundaries, @Nonnull LocalDate aDate)Check if the provided date 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- Date to check. May not benull.- Returns:
trueif it is contained,falseotherwise.- Since:
- 10.0.0
- See Also:
isInside(LocalDate, boolean, LocalDate, boolean, LocalDate)
-
isInPeriodIncl
default boolean isInPeriodIncl(@Nonnull LocalDate aDate)
Check if the provided date is inside this period, assuming that start and end are included in/part of the range.- Parameters:
aDate- Date to check. May not benull.- Returns:
trueif it is contained,falseotherwise.- Since:
- 8.6.5
- See Also:
isInPeriod(boolean, LocalDate),isNowInPeriodIncl()
-
isNowInPeriodIncl
default boolean isNowInPeriodIncl()
Check if the current date is inside this period, assuming that start and end are included in/part of the range.- Returns:
trueif the current date is contained,falseotherwise.- Since:
- 8.6.5
- See Also:
isInPeriod(boolean, LocalDate),isInPeriodIncl(LocalDate)
-
isInPeriodExcl
default boolean isInPeriodExcl(@Nonnull LocalDate aDate)
Check if the provided date is inside this period, assuming that start and end are excluded from/not part of the range.- Parameters:
aDate- Date to check. May not benull.- Returns:
trueif it is contained,falseotherwise.- Since:
- 8.6.5
- See Also:
isInPeriod(boolean, LocalDate),isNowInPeriodExcl()
-
isNowInPeriodExcl
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.- Returns:
trueif the current date is contained,falseotherwise.- Since:
- 8.6.5
- See Also:
isInPeriod(boolean, LocalDate),isInPeriodExcl(LocalDate)
-
hasOverlap
static boolean hasOverlap(@Nullable LocalDate aStart1, @Nullable LocalDate aEnd1, @Nullable LocalDate aStart2, @Nullable LocalDate 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" = "query date" 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.- Since:
- 10.0.0
-
isOverlappingWith
default boolean isOverlappingWith(@Nonnull ILocalDatePeriod aPeriod, boolean bInclBoundaries)
-
isOverlappingWithIncl
default boolean isOverlappingWithIncl(@Nonnull ILocalDatePeriod aPeriod)
-
isOverlappingWithExcl
default boolean isOverlappingWithExcl(@Nonnull ILocalDatePeriod aPeriod)
-
-