Table of Contents

Class ZoneSourceBuilder

Namespace
Hegel.Temporal
Assembly
Hegel.dll

Collects the zones of a ZoneSource; Build() makes the source. Each method returns the builder.

public sealed class ZoneSourceBuilder
Inheritance
ZoneSourceBuilder
Inherited Members

Methods

Make name another name for the zone target.

public ZoneSourceBuilder AddLink(string name, string target)

Parameters

name string

The link name.

target string

The name of the zone whose data applies.

Returns

ZoneSourceBuilder

AddOracle(string, ZoneOracle)

Add a zone by probing oracle.

public ZoneSourceBuilder AddOracle(string name, ZoneOracle oracle)

Parameters

name string

The name the zone is drawn by.

oracle ZoneOracle

The function to probe and the years to probe it over.

Returns

ZoneSourceBuilder

AddTimeZone(TimeZoneInfo)

Add a zone that behaves as zone does, under its Id, which is also the object a draw of that name yields. Its offsets are read from the object the first time a draw needs them.

public ZoneSourceBuilder AddTimeZone(TimeZoneInfo zone)

Parameters

zone TimeZoneInfo

The zone.

Returns

ZoneSourceBuilder

AddTzif(string, byte[])

Add a zone from the contents of a TZif file (RFC 9636, version 2 or later), such as one under /usr/share/zoneinfo.

public ZoneSourceBuilder AddTzif(string name, byte[] tzif)

Parameters

name string

The name the zone is drawn by.

tzif byte[]

The file's contents.

Returns

ZoneSourceBuilder

Build()

The source. Later calls on the builder do not change it.

public ZoneSource Build()

Returns

ZoneSource

Exceptions

ArgumentException

The engine rejected a zone: a malformed TZif file, a bad name, an oracle that failed.

Declare(params string[])

Name zones the source has whose data Loader(Action<string, IZoneData>)'s function supplies when a draw first needs it.

public ZoneSourceBuilder Declare(params string[] names)

Parameters

names string[]

The names.

Returns

ZoneSourceBuilder

Loader(Action<string, IZoneData>)

Supply zone data on demand: loader is called with a name the source declared, or one a generator was told to draw, the first time its data is needed, and adds that zone to the IZoneData it is given, or adds nothing for a name it does not know. It may be called from any thread, and more than once for a name. An exception it throws fails the draw that needed the data, with the exception's message.

public ZoneSourceBuilder Loader(Action<string, IZoneData> loader)

Parameters

loader Action<string, IZoneData>

The function, given the name and where to add its data.

Returns

ZoneSourceBuilder

Version(string)

Record which release of its database the source holds, such as 2025b.

public ZoneSourceBuilder Version(string version)

Parameters

version string

The release.

Returns

ZoneSourceBuilder