Class VariableRoot<TKey>
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
TKeyChild node's key type.
- Inheritance
-
VariableRoot<TKey>
- Implements
-
IVariableRoot<TKey>IReadOnlyVariableRoot<TKey>
- 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
comparerIEqualityComparer<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
OnValidate
Event stream that emits events when variable's validation state changes.
public override sealed IEventStream<VariableRootValidationEvent<TKey>> OnValidate { get; }
Property Value
State
Specifies this node's current state.
public override sealed VariableState State { get; }
Property Value
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
eventVariableRootChangeEvent<TKey>Event to publish.
OnPublishValidationEvent(VariableRootValidationEvent<TKey>)
Emits the provided validation event.
protected virtual void OnPublishValidationEvent(VariableRootValidationEvent<TKey> @event)
Parameters
eventVariableRootValidationEvent<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
keyTKeyKey to register the node under.
nodeTNodeNode to register.
Returns
- TNode
node.
Type Parameters
TNodeNode type.
Exceptions
- VariableNodeRegistrationException
When this is disposed or has a parent or when
nodeis disposed or has a parent or when this andnodeare the same.- ArgumentException
When
keyalready exists.
SetReadOnly(bool)
Changes the read-only state of this variable.
public void SetReadOnly(bool enabled)
Parameters
enabledboolSpecifies 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.