Class TypeRegistry
- Namespace
- SpatialNET.Network
- Assembly
- SpatialNET.Network.dll
The types of a network as facet vectors, built from the host's type table (ADR 0049). Resolves type patterns into SpatialNET.Network.TypeSets. Immutable and thread-safe.
public sealed class TypeRegistryInheritance
Inherited Members
Remarks
Patterns, several of them separated by | (OR):
[Niederspannung, *, Kabel]: one entry per facet, a value name, a number or*(any value, also "not set").Niederspannung.Leitung: the values from the first facet on; the facets after them must be "not set".Niederspannung.*: a trailing*means any value for all remaining facets, so it containsNiederspannungitself.*: every type of the kind, but not the untyped helper nodes;untyped: only the helper nodes.
Value names are compared ignoring case. A pattern that matches no type of the asked kind is an error.
Constructors
TypeRegistry(IReadOnlyList<Facet>, IEnumerable<NetworkType>)
Builds the registry and checks the table.
public TypeRegistry(IReadOnlyList<Facet> facets, IEnumerable<NetworkType> types)Parameters
facetsIReadOnlyList<Facet>-
The facets, at least one.
typesIEnumerable<NetworkType>-
The types; ids greater than 0 and unique.
Exceptions
- ArgumentNullException
-
An argument or an element is
null. - ArgumentException
-
The table is inconsistent; the message names the facet or the type.
Properties
AllEdges
Every edge type.
public TypeSet AllEdges { get; }Property Value
AllNodes
Every node type (not the untyped helper nodes).
public TypeSet AllNodes { get; }Property Value
Facets
The facets, in order.
public IReadOnlyList<Facet> Facets { get; }Property Value
Types
The types, by ascending id.
public IReadOnlyList<NetworkType> Types { get; }Property Value
this[int]
The type with the id.
public NetworkType this[int typeId] { get; }Property Value
Exceptions
- KeyNotFoundException
-
There is no type with this id.
Methods
Display(int)
A name for messages: the display name of the type, otherwise the names of its values joined with dots
(Niederspannung.Leitung.Kabel); untyped for 0, the number for an unknown id.
public string Display(int typeId)Parameters
typeIdint
Returns
Edges(params string[])
The edge types that match one of the patterns (OR); a pattern may hold alternatives separated by |.
public TypeSet Edges(params string[] patterns)Parameters
patternsstring[]
Returns
Exceptions
- ArgumentNullException
-
An argument is
null. - ArgumentException
-
No pattern is given, a pattern cannot be read, or it matches no edge type.
Nodes(params string[])
The node types that match one of the patterns (OR); a pattern may hold alternatives separated by |.
public TypeSet Nodes(params string[] patterns)Parameters
patternsstring[]
Returns
Exceptions
- ArgumentNullException
-
An argument is
null. - ArgumentException
-
No pattern is given, a pattern cannot be read, or it matches no node type.
TryGetType(int, out NetworkType)
Looks up a type by id.
public bool TryGetType(int typeId, out NetworkType type)Parameters
typeIdinttypeNetworkType