Table of Contents

Class LibraryItemState

Namespace
EncDotNet.S100.Collections.Library
Assembly
EncDotNet.S100.Collections.dll

One library item as a host sees it now: where its data can be had (Availability), the copy that would open (EffectiveItem) and the time its data covers (ValidWindow). The viewer's Library rows and the MCP Library tools both read items through it, so they agree.

public sealed class LibraryItemState
Inheritance
LibraryItemState
Inherited Members

Remarks

Values are resolved on first access and then kept; create a new state when the item is downloaded, opened or closed.

Constructors

LibraryItemState(CollectionItem, LibrarySource, ILibraryLocalCopies?, Func<CollectionItem, LibraryLoadState>?, TimeProvider?)

Creates the state of item from source.

public LibraryItemState(CollectionItem item, LibrarySource source, ILibraryLocalCopies? copies = null, Func<CollectionItem, LibraryLoadState>? loadState = null, TimeProvider? time = null)

Parameters

item CollectionItem

The indexed item.

source LibrarySource

The source it was indexed from.

copies ILibraryLocalCopies

Downloaded copies of online items, or null when the host downloads nothing.

loadState Func<CollectionItem, LibraryLoadState>

Whether an item is open in the host's session, or null when nothing is.

time TimeProvider

The clock that decides whether a downloaded forecast run has ended.

Properties

Availability

Where the data can be had now.

public LibraryAvailability Availability { get; }

Property Value

LibraryAvailability

CatalogueRun

The catalogue's latest run and its valid window, for a forecast (UTC).

public (DateTime Run, DateTime End)? CatalogueRun { get; }

Property Value

(DateTime Start, DateTime End)?

Credit

The source's credit for the item's data, as a layer row and pick report show it ("NOAA/NCEP GFS-Wave · Public domain"), or null when it has none (#1075).

public string? Credit { get; }

Property Value

string

EffectiveItem

The item as it can be opened now: an online item that has been downloaded, with its downloaded (local) location; otherwise Item.

public CollectionItem EffectiveItem { get; }

Property Value

CollectionItem

Id

The item's id across the library: <sourceId>:<key>.

public string Id { get; }

Property Value

string

IsForecast

True for a dataset of one forecast run (#685).

public bool IsForecast { get; }

Property Value

bool

IsLoadedNow

True when the item's downloaded copy is loaded now.

public bool IsLoadedNow { get; }

Property Value

bool

IsPinnedRun

True for a pinned weather run: a copy kept beside the latest (#1075).

public bool IsPinnedRun { get; }

Property Value

bool

IsStaleRun

True for a weather run (#1075) whose shown run — the downloaded copy's, else the listed one — is more than StaleAfter (12 hours) old: the Library marks it stale and offers to load the latest run. A pinned run never is.

public bool IsStaleRun { get; }

Property Value

bool

Item

The indexed item.

public CollectionItem Item { get; }

Property Value

CollectionItem

LocalRun

The run of the downloaded copy, if any.

public DateTimeOffset? LocalRun { get; }

Property Value

DateTimeOffset?

NotForNavigation

True when the source flags the item not for navigation.

public bool NotForNavigation { get; }

Property Value

bool

Source

The source the item was indexed from.

public LibrarySource Source { get; }

Property Value

LibrarySource

ValidWindow

The time the item's data covers (#711), in UTC: a forecast run's valid window (the downloaded copy's run, else the catalogue's), or a dataset's own time coverage; null for none.

public (DateTime Start, DateTime End)? ValidWindow { get; }

Property Value

(DateTime Start, DateTime End)?

Methods

FormatId(Guid, string)

Formats an item id: <sourceId>:<key>.

public static string FormatId(Guid sourceId, string key)

Parameters

sourceId Guid
key string

Returns

string

Matches(string)

True when the item matches a free-text filter (name, title, spec, or a property value such as a state code), case-insensitively.

public bool Matches(string filter)

Parameters

filter string

Returns

bool

TimeCoverage(CollectionItem)

A dataset's own time coverage, as a local index records it (timeStart/timeEnd).

public static (DateTime Start, DateTime End)? TimeCoverage(CollectionItem item)

Parameters

item CollectionItem

Returns

(DateTime Start, DateTime End)?

TryParseId(string, out Guid, out string)

Parses an item id (<sourceId>:<key>).

public static bool TryParseId(string itemId, out Guid sourceId, out string key)

Parameters

itemId string
sourceId Guid
key string

Returns

bool