Table of Contents

Class VariableRoot<TKey>

Namespace
LfrlAnvil.Reactive.State
Assembly
LfrlAnvil.Reactive.State.dll

Represents a generic variable root node that listens to its children's events and propagates them.

public abstract class VariableRoot<TKey> : VariableNode, IVariableRoot<TKey>, IReadOnlyVariableRoot<TKey>, IReadOnlyVariableRoot, IMutableVariableNode, IVariableNode, IDisposable where TKey : notnull

Type Parameters

TKey

Child node's key type.

Inheritance
VariableRoot<TKey>
Implements
Inherited Members
Extension Methods

Constructors

VariableRoot()

Creates a new VariableRoot<TKey> instance with Default node's key equality comparer.

protected VariableRoot()

VariableRoot(IEqualityComparer<TKey>)

Creates a new VariableRoot<TKey> instance.

protected VariableRoot(IEqualityComparer<TKey> comparer)

Parameters

comparer IEqualityComparer<TKey>

Node's key equality comparer.

Properties

Nodes

Nested collection of child nodes.

public IVariableNodeCollection<TKey> Nodes { get; }

Property Value

IVariableNodeCollection<TKey>

OnChange

Event stream that emits events when variable's value changes.

public override sealed IEventStream<VariableRootChangeEvent<TKey>> OnChange { get; }

Property Value

IEventStream<VariableRootChangeEvent<TKey>>

OnValidate

Event stream that emits events when variable's validation state changes.

public override sealed IEventStream<VariableRootValidationEvent<TKey>> OnValidate { get; }

Property Value

IEventStream<VariableRootValidationEvent<TKey>>

State

Specifies this node's current state.

public override sealed VariableState State { get; }

Property Value

VariableState

Methods

ClearValidation()

Removes all errors and warnings from this variable.

public void ClearValidation()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public virtual void Dispose()

GetChildren()

Returns the collection of all children nodes.

[Pure]
public override IEnumerable<IVariableNode> GetChildren()

Returns

IEnumerable<IVariableNode>

New IEnumerable<T> instance.

OnPublishChangeEvent(VariableRootChangeEvent<TKey>)

Emits the provided change event.

protected virtual void OnPublishChangeEvent(VariableRootChangeEvent<TKey> @event)

Parameters

event VariableRootChangeEvent<TKey>

Event to publish.

OnPublishValidationEvent(VariableRootValidationEvent<TKey>)

Emits the provided validation event.

protected virtual void OnPublishValidationEvent(VariableRootValidationEvent<TKey> @event)

Parameters

event VariableRootValidationEvent<TKey>

Event to publish.

Refresh()

Refreshes this variable.

public void Refresh()

RefreshValidation()

Refreshes this variable's validation.

public void RefreshValidation()

RegisterNode<TNode>(TKey, TNode)

Registers the provided node in this root's Nodes collection.

protected TNode RegisterNode<TNode>(TKey key, TNode node) where TNode : VariableNode

Parameters

key TKey

Key to register the node under.

node TNode

Node to register.

Returns

TNode

node.

Type Parameters

TNode

Node type.

Exceptions

VariableNodeRegistrationException

When this is disposed or has a parent or when node is disposed or has a parent or when this and node are the same.

ArgumentException

When key already exists.

SetReadOnly(bool)

Changes the read-only state of this variable.

public void SetReadOnly(bool enabled)

Parameters

enabled bool

Specifies whether or not the read-only state should be enabled.

ToString()

Returns a string representation of this VariableRoot<TKey> instance.

[Pure]
public override string ToString()

Returns

string

String representation.