Interface ILocalDateTimePeriod

    • 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. A null start means "since forever". A null end means "until eternity and beyond".
        Parameters:
        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.
        Returns:
        true if 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 - 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.
        Returns:
        true if it is contained, false otherwise.
        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 be null.
        Returns:
        true if it is contained, false otherwise.
        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:
        true if the current date is contained, false otherwise.
        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 be null.
        Returns:
        true if it is contained, false otherwise.
        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:
        true if the current date time is contained, false otherwise.
        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 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.
        Returns:
        true if the 2 ranges have at least one point in time (with duration 0) that they share.