Table of Contents

Class NotifyExpression<T>

Namespace
NMF.Expressions
Assembly
NMF.Expressions.dll

The common base class for incremental expressions

public abstract class NotifyExpression<T> : NotifyExpressionBase, INotifyExpression<T>, INotifyValue<T>, INotifyExpression, INotifiable, IDisposable, IValueChangedNotificationResult<T>, IValueChangedNotificationResult, INotificationResult, ISuccessorList

Type Parameters

T

The element type of the expression

Inheritance
NotifyExpression<T>
Implements
Inherited Members
Extension Methods

Constructors

NotifyExpression()

Creates a new instance

protected NotifyExpression()

NotifyExpression(T)

Creates a new incremental expression with the given initial value

protected NotifyExpression(T value)

Parameters

value T

The initial value

Properties

AllSuccessors

public IEnumerable<INotifiable> AllSuccessors { get; }

Property Value

IEnumerable<INotifiable>

CanBeConstant

Returns whether the current expression can be constant

public virtual bool CanBeConstant { get; }

Property Value

bool

CanReduce

Determines whether this expression can be reduced

public override bool CanReduce { get; }

Property Value

bool

Count

The number of elements

public int Count { get; }

Property Value

int

Dependencies

Nodes that notify this node.

public abstract IEnumerable<INotifiable> Dependencies { get; }

Property Value

IEnumerable<INotifiable>

ExecutionMetaData

Used by the execution engine during incremental execution.

public ExecutionMetaData ExecutionMetaData { get; }

Property Value

ExecutionMetaData

HasSuccessors

True, if there is any successor, otherwise False

public bool HasSuccessors { get; }

Property Value

bool

IsAttached

True, if successors are attached, otherwise False

public bool IsAttached { get; }

Property Value

bool

IsConstant

Returns whether this expression is a constant value

public virtual bool IsConstant { get; }

Property Value

bool

IsParameterFree

Returns whether this expression is parameter free

public abstract bool IsParameterFree { get; }

Property Value

bool

Successors

The nodes that will get notified by this node.

public ISuccessorList Successors { get; }

Property Value

ISuccessorList

Type

Gets the type of this incremental expression

public override sealed Type Type { get; }

Property Value

Type

Value

Gets the current value of this expression

public T Value { get; }

Property Value

T

ValueObject

Gets the current value as object

public object ValueObject { get; }

Property Value

object

Methods

ApplyParameters(IDictionary<string, object>, IDictionary<INotifiable, INotifiable>)

Applies the given set of parameters to the expression

public INotifyExpression<T> ApplyParameters(IDictionary<string, object> parameters, IDictionary<INotifiable, INotifiable> trace)

Parameters

parameters IDictionary<string, object>

A set of parameter values

trace IDictionary<INotifiable, INotifiable>

A trace to make sure parameters are only applied once for every DDG node

Returns

INotifyExpression<T>

A new expression with all parameter placeholders replaced with the parameter values

Remarks

In case that the current expression is parameter free, it simply returns itself

ApplyParametersCore(IDictionary<string, object>, IDictionary<INotifiable, INotifiable>)

Applies the given set of parameters to the expression

protected abstract INotifyExpression<T> ApplyParametersCore(IDictionary<string, object> parameters, IDictionary<INotifiable, INotifiable> trace)

Parameters

parameters IDictionary<string, object>

A set of parameter values

trace IDictionary<INotifiable, INotifiable>

A trace to make sure parameters are only applied once for every DDG node

Returns

INotifyExpression<T>

A new expression with all parameter placeholders replaced with the parameter values

Remarks

In case that the current expression is parameter free, it simply returns itself

BaseReduce()

Simplifies the current expression

protected override sealed Expression BaseReduce()

Returns

Expression

A simpler expression representing the same incremental value (e.g. a constant if this expression can be constant), otherwise itself

Dispose()

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

public void Dispose()

GetSuccessor(int)

Gets the successor at the given index

public INotifiable GetSuccessor(int index)

Parameters

index int

The index

Returns

INotifiable

The DDG node with the given index

GetValue()

Gets the value of the current incremental expression

protected abstract T GetValue()

Returns

T

The current value

Notify(IList<INotificationResult>)

Refreshes the current value

public virtual INotificationResult Notify(IList<INotificationResult> sources)

Parameters

sources IList<INotificationResult>

Returns

INotificationResult

OnAttach()

Occurs when this node gets (re)attached to another node for the first time

protected virtual void OnAttach()

OnDetach()

Occurs when the last successor of this node gets removed

protected virtual void OnDetach()

OnValueChanged(T, T)

Gets called when the value of the current expression changes

protected void OnValueChanged(T oldVal, T newVal)

Parameters

oldVal T

The old value

newVal T

The new value

Reduce()

Simplifies the current expression

public virtual INotifyExpression<T> Reduce()

Returns

INotifyExpression<T>

A simpler expression representing the same incremental value (e.g. a constant if this expression can be constant), otherwise itself

Set(INotifiable)

Add the given DDG node to the list

public void Set(INotifiable node)

Parameters

node INotifiable

The DDG node to add

SetDummy()

Sets a dummy

public void SetDummy()

ToString()

Returns a textual representation of the Expression.

public override string ToString()

Returns

string

A textual representation of the Expression.

Unset(INotifiable, bool)

Unset the given DDG node as successor

public void Unset(INotifiable node, bool leaveDummy = false)

Parameters

node INotifiable

the DDG node

leaveDummy bool

True, to leave the dummy in operation, otherwise False

UnsetAll()

Clear the list

public void UnsetAll()

Events

ValueChanged

Gets fired when the value changed

public event EventHandler<ValueChangedEventArgs> ValueChanged

Event Type

EventHandler<ValueChangedEventArgs>