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.
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 Summary
Modifier and TypeMethodDescriptiondefault DayPartitionRuleand(DayPartitionRule rule)Combines this rule with another one.getPartitions(PlainDate date)Obtains the partitions for given date if defined.default booleanisExcluded(PlainDate date)Determines if given date is excluded from creating day partitions.default booleanmatches(PlainTimestamp timestamp)Does this rule match given timestamp such that any rule interval contains it?
-
Method Details
-
getPartitions
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
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
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
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:
trueif given timestamp fits to this rule elsefalse- Since:
- 4.20
-