Table of Contents

Class NetworkRule

Namespace
SpatialNET.Network
Assembly
SpatialNET.Network.dll

A rule that counts the direct neighbours of an element and compares the count with an allowed range (ADR 0052). Build one with SpatialNET.Network.NetworkRule.ForNodes(System.String,SpatialNET.Network.TypeSet) or SpatialNET.Network.NetworkRule.ForEdges(System.String,SpatialNET.Network.TypeSet), or resolve a SpatialNET.Network.NetworkRuleDefinition with SpatialNET.Network.NetworkRule.FromDefinition(SpatialNET.Network.NetworkRuleDefinition,SpatialNET.Network.TypeRegistry). Immutable and thread-safe; use it for any number of checks (SpatialNET.Network.NetworkValidation).

public sealed class NetworkRule

Inheritance

Inherited Members

Properties

CountTypes

The edge types that are counted.

public TypeSet CountTypes { get; }

Property Value

TypeSet

EndFilter

For an edge rule, which ends are checked.

public RuleEndFilter EndFilter { get; }

Property Value

RuleEndFilter

EndTypes

The node types of SpatialNET.Network.NetworkRule.EndFilter; null for SpatialNET.Network.RuleEndFilter.All.

public TypeSet? EndTypes { get; }

Property Value

TypeSet?

Id

The id of the rule.

public string Id { get; }

Property Value

string

Max

The largest allowed count; null for no upper limit.

public int? Max { get; }

Property Value

int?

Min

The smallest allowed count.

public int Min { get; }

Property Value

int

Severity

How serious a violation is.

public RuleSeverity Severity { get; }

Property Value

RuleSeverity

Subject

Whether the rule checks nodes or edges.

public RuleSubject Subject { get; }

Property Value

RuleSubject

SubjectTypes

The types that are checked.

public TypeSet SubjectTypes { get; }

Property Value

TypeSet

Methods

AsWarning()

The same rule with the severity SpatialNET.Network.RuleSeverity.Warning.

public NetworkRule AsWarning()

Returns

NetworkRule

ForEdges(string, TypeSet)

Starts a rule that checks the edges of the given types and counts the other edges at their ends.

public static EdgeRuleBuilder ForEdges(string id, TypeSet subjectTypes)

Parameters

id string

The id of the rule; not empty.

subjectTypes TypeSet

The edge types to check.

Returns

EdgeRuleBuilder

Exceptions

ArgumentNullException

subjectTypes is null.

ArgumentException

id is null, empty or white space.

ForNodes(string, TypeSet)

Starts a rule that checks the nodes of the given types and counts the edges at them.

public static NodeRuleBuilder ForNodes(string id, TypeSet subjectTypes)

Parameters

id string

The id of the rule; not empty.

subjectTypes TypeSet

The node types to check; SpatialNET.Network.TypeSet.Untyped addresses helper nodes.

Returns

NodeRuleBuilder

Exceptions

ArgumentNullException

subjectTypes is null.

ArgumentException

id is null, empty or white space.

FromDefinition(NetworkRuleDefinition, TypeRegistry)

Resolves a row into a rule, with the patterns resolved against the type registry.

public static NetworkRule FromDefinition(NetworkRuleDefinition definition, TypeRegistry types)

Parameters

definition NetworkRuleDefinition

The row.

types TypeRegistry

The types of the network.

Returns

NetworkRule

Exceptions

ArgumentNullException

An argument is null.

ArgumentException

The definition cannot be a rule: no id, a pattern that cannot be read, that matches no type or only a type of the wrong kind, an end filter on a node rule, or end types without an end filter. The message names the rule id.

ArgumentOutOfRangeException

Min is below 0 or above Max; the message names the rule id.

ToDefinition()

Gives the rule as a row, so that SpatialNET.Network.NetworkRule.FromDefinition(SpatialNET.Network.NetworkRuleDefinition,SpatialNET.Network.TypeRegistry) resolves it to an equal rule.

public NetworkRuleDefinition ToDefinition()

Returns

NetworkRuleDefinition

Exceptions

InvalidOperationException

A type set of the rule was made from type ids (SpatialNET.Network.TypeSet.Of(System.Collections.Generic.IEnumerable{System.Int32})) and has no pattern text. Rules from SpatialNET.Network.NetworkRule.FromDefinition(SpatialNET.Network.NetworkRuleDefinition,SpatialNET.Network.TypeRegistry) and from sets resolved by a SpatialNET.Network.TypeRegistry always have it.

ToString()

A readable form for reports, for example KV-FREIES-ENDE: edges [*, Kastenverbinder, ], ends not [, Kasten, ], other edges [, Leitung, *] = 1. For people, not for parsing.

public override string ToString()

Returns

string