CalculatedEndDateDurationDefinition Class
Definition
- Namespace
- Bodu.Globalization.Calendar
- Assembly
- Bodu.Globalization.Calendar.dll
- Package
- Bodu.Globalization.Calendar 1.0.1
Represents an occurrence duration whose end date is calculated by a second date strategy, producing a span that can vary in length from year to year and can cross a civil-year boundary.
public sealed record CalculatedEndDateDurationDefinition : NotableDateDurationDefinition, IEquatable<NotableDateDurationDefinition>, IEquatable<CalculatedEndDateDurationDefinition>
- Inheritance
-
CalculatedEndDateDurationDefinition
- Implements
- Inherited Members
- Extension Methods
Remarks
The end strategy is evaluated relative to each resolved start occurrence: for the start anchor's civil year, and, when that yields no acceptable candidate, the immediately following civil year. This models patterns such as a company year-end shutdown that begins the Friday before Boxing Day and ends the Monday after New Year's Day, where the span length differs each year.
The effective start and end are derived by applying StartBoundary and EndBoundary to the resolved anchors. When the resulting span is shorter than one day, or no acceptable end anchor exists in the permitted two-year window, the occurrence is not emitted.
Constructors
CalculatedEndDateDurationDefinition(IDateCalculationStrategy, DateBoundary, DateBoundary, EndDateSelection)
Represents an occurrence duration whose end date is calculated by a second date strategy, producing a span that can vary in length from year to year and can cross a civil-year boundary.
public CalculatedEndDateDurationDefinition(IDateCalculationStrategy EndStrategy, DateBoundary StartBoundary = DateBoundary.Inclusive, DateBoundary EndBoundary = DateBoundary.Inclusive, EndDateSelection EndSelection = EndDateSelection.FirstOnOrAfterStart)
Parameters
EndStrategyIDateCalculationStrategyThe strategy that calculates the end anchor of the span.
StartBoundaryDateBoundaryWhether the start anchor is included in the span.
EndBoundaryDateBoundaryWhether the end anchor is included in the span.
EndSelectionEndDateSelectionHow the end anchor is selected relative to the start anchor.
Remarks
The end strategy is evaluated relative to each resolved start occurrence: for the start anchor's civil year, and, when that yields no acceptable candidate, the immediately following civil year. This models patterns such as a company year-end shutdown that begins the Friday before Boxing Day and ends the Monday after New Year's Day, where the span length differs each year.
The effective start and end are derived by applying StartBoundary and EndBoundary to the resolved anchors. When the resulting span is shorter than one day, or no acceptable end anchor exists in the permitted two-year window, the occurrence is not emitted.
- See Also
Properties
EndBoundary
Whether the end anchor is included in the span.
public DateBoundary EndBoundary { get; init; }
Property Value
EndSelection
How the end anchor is selected relative to the start anchor.
public EndDateSelection EndSelection { get; init; }
Property Value
EndStrategy
The strategy that calculates the end anchor of the span.
public IDateCalculationStrategy EndStrategy { get; init; }
Property Value
EqualityContract
protected override Type EqualityContract { get; }
Property Value
StartBoundary
Whether the start anchor is included in the span.
public DateBoundary StartBoundary { get; init; }
Property Value
Methods
Deconstruct(out IDateCalculationStrategy, out DateBoundary, out DateBoundary, out EndDateSelection)
public void Deconstruct(out IDateCalculationStrategy EndStrategy, out DateBoundary StartBoundary, out DateBoundary EndBoundary, out EndDateSelection EndSelection)
Parameters
EndStrategyIDateCalculationStrategyStartBoundaryDateBoundaryEndBoundaryDateBoundaryEndSelectionEndDateSelection
Equals(CalculatedEndDateDurationDefinition?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(CalculatedEndDateDurationDefinition? other)
Parameters
otherCalculatedEndDateDurationDefinitionAn object to compare with this object.
Returns
Equals(NotableDateDurationDefinition?)
Indicates whether the current object is equal to another object of the same type.
public override sealed bool Equals(NotableDateDurationDefinition? other)
Parameters
otherNotableDateDurationDefinitionAn object to compare with this object.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
PrintMembers(StringBuilder)
protected override bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator ==(CalculatedEndDateDurationDefinition?, CalculatedEndDateDurationDefinition?)
public static bool operator ==(CalculatedEndDateDurationDefinition? left, CalculatedEndDateDurationDefinition? right)
Parameters
Returns
operator !=(CalculatedEndDateDurationDefinition?, CalculatedEndDateDurationDefinition?)
public static bool operator !=(CalculatedEndDateDurationDefinition? left, CalculatedEndDateDurationDefinition? right)
Parameters
Returns
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |