Class WarningValidity
The in-force rule shared by every kind of warning the map draws: whether a warning applies at a time, judged on its validity ranges and cancellation date alone. S-124 navigational warnings (StatusAt(DateTimeOffset)) and CAP weather warnings both use it, so a warning starts and ends at the same instant whatever its format.
public static class WarningValidity
- Inheritance
-
WarningValidity
- Inherited Members
Remarks
A warning is ended once its cancellation date has passed or every validity range has ended, and not yet in force while it waits for a range to start. With no validity range it is in force until cancelled. A range includes both its start and its end: a warning valid until 12:00 is still in force at 12:00 and ended a tick later.
Rules that look across warnings, such as cancellations by other warnings and S-124 in-force bulletins, live in NavigationalWarningSet.
Methods
Changes(IReadOnlyList<NavigationalWarningValidity>, DateTimeOffset?)
The instants at which StatusAt(IReadOnlyList<NavigationalWarningValidity>, DateTimeOffset?, DateTimeOffset) can change for a warning
with ranges and cancellationDate:
each range's start, the tick after each range's end, and the
cancellation date, in no particular order. Between two consecutive
instants the status is constant, so a host that draws the warning only
needs to judge it again at these times.
public static IEnumerable<DateTimeOffset> Changes(IReadOnlyList<NavigationalWarningValidity> ranges, DateTimeOffset? cancellationDate)
Parameters
rangesIReadOnlyList<NavigationalWarningValidity>The warning's validity ranges.
cancellationDateDateTimeOffset?The cancellation date, or null.
Returns
- IEnumerable<DateTimeOffset>
The instants; open ends add none.
StatusAt(IReadOnlyList<NavigationalWarningValidity>, DateTimeOffset?, DateTimeOffset)
Whether a warning with ranges and
cancellationDate applies at time.
public static NavigationalWarningStatus StatusAt(IReadOnlyList<NavigationalWarningValidity> ranges, DateTimeOffset? cancellationDate, DateTimeOffset time)
Parameters
rangesIReadOnlyList<NavigationalWarningValidity>The warning's validity ranges, in any order; empty for none.
cancellationDateDateTimeOffset?When the warning stops applying whatever its ranges say, or null.
timeDateTimeOffsetThe time to test, usually the view time.
Returns
- NavigationalWarningStatus
The warning's status at that time.