AdjustmentScope Class
Definition
- Namespace
- Bodu.Globalization.Calendar
- Assembly
- Bodu.Globalization.Calendar.dll
- Package
- Bodu.Globalization.Calendar 1.0.1
- Source
- AdjustmentScope.cs
Constrains where a reusable adjustment policy may apply: by territory, calendar, category, notable-date concept, or specific rule.
public sealed class AdjustmentScope
- Inheritance
-
AdjustmentScope
- Inherited Members
- Extension Methods
Remarks
Each dimension is independent. A dimension with no entries imposes no restriction; a dimension with entries requires the candidate value to be one of them. An empty scope therefore matches every rule, while a populated scope must satisfy every populated dimension.
Constructors
AdjustmentScope(IEnumerable<string>, IEnumerable<CalendarSystem>, IEnumerable<NotableDateCategory>, IEnumerable<string>, IEnumerable<string>, int?, int?, IEnumerable<int>?, IEnumerable<int>?)
Initializes a new instance of the AdjustmentScope class.
public AdjustmentScope(IEnumerable<string> territories, IEnumerable<CalendarSystem> calendars, IEnumerable<NotableDateCategory> categories, IEnumerable<string> notableDateRefs, IEnumerable<string> ruleRefs, int? fromYear = null, int? toYear = null, IEnumerable<int>? onlyYears = null, IEnumerable<int>? exceptYears = null)
Parameters
territoriesIEnumerable<string>The territories the policy is limited to, if any.
calendarsIEnumerable<CalendarSystem>The calendar systems the policy is limited to, if any.
categoriesIEnumerable<NotableDateCategory>The categories the policy is limited to, if any.
notableDateRefsIEnumerable<string>The notable-date concepts the policy is limited to, if any.
ruleRefsIEnumerable<string>The rules the policy is limited to, if any.
fromYearint?The first year the policy applies, or null for no lower bound.
toYearint?The last year the policy applies, or null for no upper bound.
onlyYearsIEnumerable<int>The explicit inclusion years, or null for no restriction.
exceptYearsIEnumerable<int>The explicit exclusion years, or null for no exclusions.
Exceptions
- ArgumentNullException
territories,calendars,categories,notableDateRefs, orruleRefsis null.
Properties
Calendars
Gets the calendar systems the policy is limited to.
public IReadOnlyList<CalendarSystem> Calendars { get; }
Property Value
- IReadOnlyList<CalendarSystem>
The scoped calendar systems; empty when unrestricted.
Categories
Gets the categories the policy is limited to.
public IReadOnlyList<NotableDateCategory> Categories { get; }
Property Value
- IReadOnlyList<NotableDateCategory>
The scoped categories; empty when unrestricted.
ExceptYears
Gets the explicit exclusion years.
public IReadOnlyList<int> ExceptYears { get; }
Property Value
- IReadOnlyList<int>
The years the policy is suppressed for; empty when there are none.
FromYear
Gets the first year the policy applies.
public int? FromYear { get; }
Property Value
Global
Gets a shared AdjustmentScope that imposes no restriction.
public static AdjustmentScope Global { get; }
Property Value
- AdjustmentScope
An empty, global scope.
NotableDateRefs
Gets the notable-date concepts the policy is limited to.
public IReadOnlyList<string> NotableDateRefs { get; }
Property Value
- IReadOnlyList<string>
The scoped notable-date identifiers; empty when unrestricted.
OnlyYears
Gets the explicit inclusion years.
public IReadOnlyList<int> OnlyYears { get; }
Property Value
- IReadOnlyList<int>
The years the policy is restricted to; empty when unrestricted.
RuleRefs
Gets the rules the policy is limited to.
public IReadOnlyList<string> RuleRefs { get; }
Property Value
- IReadOnlyList<string>
The scoped rule identifiers; empty when unrestricted.
Territories
Gets the territories the policy is limited to.
public IReadOnlyList<string> Territories { get; }
Property Value
- IReadOnlyList<string>
The scoped territory codes; empty when unrestricted.
ToYear
Gets the last year the policy applies.
public int? ToYear { get; }
Property Value
Methods
Matches(string, CalendarSystem, NotableDateCategory, string, string, int)
Determines whether the policy may apply to a rule with the supplied attributes in the supplied year.
public bool Matches(string territory, CalendarSystem calendar, NotableDateCategory category, string notableDateId, string ruleId, int year)
Parameters
territorystringThe territory being resolved.
calendarCalendarSystemThe calendar system of the rule.
categoryNotableDateCategoryThe effective category of the rule.
notableDateIdstringThe identifier of the rule's notable-date concept.
ruleIdstringThe identifier of the rule.
yearintThe Gregorian year of the occurrence the policy would adjust.
Returns
Remarks
The year dimensions combine like a rule's applicability: FromYear and ToYear bound an inclusive range, OnlyYears further restricts to an explicit set when non-empty, and ExceptYears removes individual years.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |