CollisionPolicy Enum
Definition
- Namespace
- Bodu.Globalization.Calendar.RangeResolution
- Assembly
- Bodu.Globalization.Calendar.dll
- Package
- Bodu.Globalization.Calendar 1.3.0
- Source
- CollisionPolicy.cs
Determines how the resolver treats multiple distinct notable dates that resolve to the same day.
public enum CollisionPolicy
- Extension Methods
Fields
KeepAll = 0Keep every colliding occurrence.
HighestPriorityOnly = 1Keep only the occurrence with the highest priority.
CategoryPriority = 2Resolve collisions using category precedence.
Custom = 3Resolve collisions using a custom strategy.
Remarks
The recommended default is KeepAll, because multiple notable dates can legitimately occur on the same day. The other policies thin a same-day group by priority or category, or defer to an INotableDateCollisionResolver when set to Custom.
The service applies the resource's SameDayCollisionPolicy to occurrences that share an emitted date, and then its SpanCollisionPolicy to every chain of surviving occurrences connected through overlapping emitted spans that holds a multi-day occurrence. A chain is ranked as a same-day group is, and a Custom resolver receives the chain's earliest emitted date.
A collision is settled once per emitted date, over every occurrence emitted on that date, whatever range is queried: a multi-day occurrence takes part only in the collision of its emitted date, and when it loses there it is absent from every query its span reaches into, including one whose window starts after the emitted date.
// Two concepts landing on the same day: HighestPriorityOnly keeps the winner,
// KeepAll surfaces both. Set via the resolution policy:
NotableDateDocumentBuilder.Create("demo")
.WithResolutionPolicy(p => p.WithSameDayCollisionPolicy(CollisionPolicy.HighestPriorityOnly));
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |