Interface DayPartitionRule

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DayPartitionRule

Represents a rule how to partition a day into disjunct clock intervals.

Since:
4.18
Author:
Meno Hochschild
See Also:
DayPartitionBuilder, DateInterval.streamPartitioned(DayPartitionRule)
  • Method Details

    • getPartitions

      List<ChronoInterval<PlainTime>> getPartitions(PlainDate date)

      Obtains the partitions for given date if defined.

      All resulting partitions are half-open clock intervals (start inclusive and end exclusive) and refer only to given calendar date.

      Parameters:
      date - the calendar date to be queried
      Returns:
      unmodifiable sorted list of canonical day partitions, maybe empty
      Since:
      5.0
      See Also:
      ClockInterval.comparator(), IsoInterval.toCanonical()
    • and

      default DayPartitionRule and(DayPartitionRule rule)

      Combines this rule with another one.

      The new rule will never take into account dates which are excluded by either this rule or the given one.

      Parameters:
      rule - another day partition rule to be combined with this one
      Returns:
      new combined rule
      See Also:
      isExcluded(PlainDate)
    • isExcluded

      default boolean isExcluded(PlainDate date)

      Determines if given date is excluded from creating day partitions.

      The default implementation is equivalent to getPartition(date).isEmpty().

      Parameters:
      date - the calendar date to be checked for exclusion
      Returns:
      boolean
    • matches

      default boolean matches(PlainTimestamp timestamp)

      Does this rule match given timestamp such that any rule interval contains it?

      Example: If this rule describes shop opening times then this method yields the answer to the question if the shop is open at given timestamp.

      Parameters:
      timestamp - the timestamp to be checked
      Returns:
      true if given timestamp fits to this rule else false
      Since:
      4.20