Class ObservableEnumerable<T>
- Namespace
- NMF.Expressions.Linq
- Assembly
- NMF.Expressions.Linq.dll
Denotes an abstract base class for collection-valued DDG nodes
public abstract class ObservableEnumerable<T> : INotifyEnumerable<T>, INotifyEnumerable, INotifiable, ICollection<T>, IEnumerable<T>, INotifyCollectionChanged, IDisposable, ISuccessorList, IList, ICollection, IEnumerable
Type Parameters
T
The type of elements
- Inheritance
-
ObservableEnumerable<T>
- Implements
-
ICollection<T>IEnumerable<T>
- Derived
- Inherited Members
- Extension Methods
-
ObservableExtensions.Average<TSource>(INotifyEnumerable<TSource>, Expression<Func<TSource, double>>)ObservableExtensions.Average<TSource>(INotifyEnumerable<TSource>, Expression<Func<TSource, float?>>)ObservableExtensions.IsProperSubsetOf<T>(INotifyEnumerable<T>, IEnumerable<T>, IEqualityComparer<T>)ObservableExtensions.TopX<TItem, TKey>(INotifyEnumerable<TItem>, int, Expression<Func<TItem, TKey>>)
Properties
AllSuccessors
public IEnumerable<INotifiable> AllSuccessors { get; }
Property Value
Count
Gets the number of elements contained in the ICollection<T>.
public virtual int Count { get; }
Property Value
- int
The number of elements contained in the ICollection<T>.
Dependencies
Nodes that notify this node.
public abstract IEnumerable<INotifiable> Dependencies { get; }
Property Value
ExecutionMetaData
Used by the execution engine during incremental execution.
public ExecutionMetaData ExecutionMetaData { get; }
Property Value
HasEventSubscriber
Indicates whether the collection has event subscribers attached
protected bool HasEventSubscriber { get; }
Property Value
HasSuccessors
True, if there is any successor, otherwise False
public bool HasSuccessors { get; }
Property Value
IsAttached
True, if successors are attached, otherwise False
public bool IsAttached { get; }
Property Value
IsFixedSize
public virtual bool IsFixedSize { get; }
Property Value
IsReadOnly
Gets a value indicating whether the ICollection<T> is read-only.
public virtual bool IsReadOnly { get; }
Property Value
- bool
true if the ICollection<T> is read-only; otherwise, false.
IsSynchronized
public bool IsSynchronized { get; }
Property Value
this[int]
public virtual object this[int index] { get; set; }
Parameters
index
int
Property Value
Successors
The nodes that will get notified by this node.
public ISuccessorList Successors { get; }
Property Value
SyncRoot
public object SyncRoot { get; }
Property Value
Methods
Add(T)
Adds an item to the ICollection<T>.
public virtual void Add(T item)
Parameters
item
TThe object to add to the ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Clear()
Removes all items from the ICollection<T>.
public virtual void Clear()
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Contains(T)
Determines whether the ICollection<T> contains a specific value.
public virtual bool Contains(T item)
Parameters
item
TThe object to locate in the ICollection<T>.
Returns
- bool
true if
item
is found in the ICollection<T>; otherwise, false.
CopyTo(T[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public void CopyTo(T[] array, int arrayIndex)
Parameters
array
T[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndex
intThe zero-based index in
array
at which copying begins.
Exceptions
- ArgumentNullException
array
is null.- ArgumentOutOfRangeException
arrayIndex
is less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndex
to the end of the destinationarray
.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetEnumerator()
Returns an enumerator that iterates through the collection.
public abstract IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
An enumerator that can be used to iterate through the collection.
GetSuccessor(int)
Gets the successor at the given index
public INotifiable GetSuccessor(int index)
Parameters
index
intThe index
Returns
- INotifiable
The DDG node with the given index
Notify(IList<INotificationResult>)
Gets called when one of the dependencies signals a notification.
public abstract INotificationResult Notify(IList<INotificationResult> sources)
Parameters
sources
IList<INotificationResult>Contains information about what triggered this notification.
Returns
- INotificationResult
An object describing the changes that happened in this notification.
OnAddItem(T, int)
Raises the collection changed event for an added item
protected void OnAddItem(T item, int index = -1)
Parameters
item
TThe item that is added
index
intThe index at which the item is added or -1
OnAddItems(IEnumerable<T>, int)
Raises the collection changed event for added items
protected void OnAddItems(IEnumerable<T> items, int index = -1)
Parameters
items
IEnumerable<T>The items that are added
index
intThe start index at which items are added
OnAttach()
Gets called when a successor attaches and there was no successor before
protected virtual void OnAttach()
OnCleared()
Raises the event that the collection was cleared
protected void OnCleared()
OnCollectionChanged(NotifyCollectionChangedEventArgs)
Raises a collection changed event
protected void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters
e
NotifyCollectionChangedEventArgsthe event data
OnDetach()
Gets called when the last successor detaches
protected virtual void OnDetach()
OnMoveItem(T, int, int)
Raises the event that the item was moved
protected void OnMoveItem(T item, int oldIndex = 0, int newIndex = 0)
Parameters
OnMoveItems(IEnumerable<T>, int, int)
Raises the event that the items were moved
protected void OnMoveItems(IEnumerable<T> items, int oldIndex = 0, int newIndex = 0)
Parameters
items
IEnumerable<T>the moved items
oldIndex
intthe old index
newIndex
intthe new index
OnRemoveItem(T, int)
Raises the event that an item was removed
protected void OnRemoveItem(T item, int index = -1)
Parameters
item
TThe item that was removed
index
intThe index at which the item was removed or -1
OnRemoveItems(IEnumerable<T>, int)
Raises the event that items were removed
protected void OnRemoveItems(IEnumerable<T> items, int index = -1)
Parameters
items
IEnumerable<T>The items that have been removed
index
intThe index at which items have been removed
OnReplaceItem(T, T, int)
Raises the event that the item was replaced
protected void OnReplaceItem(T old, T item, int index = -1)
Parameters
old
Tthe old item
item
Tthe new item
index
intthe index of the elemnt or -1
OnReplaceItems(IEnumerable<T>, IEnumerable<T>, int)
Raises the event that items were replaced
protected void OnReplaceItems(IEnumerable<T> oldItems, IEnumerable<T> newItems, int index = -1)
Parameters
oldItems
IEnumerable<T>the old items
newItems
IEnumerable<T>the new items
index
intthe index at which the items have been replaced
RaiseEvents(IList<T>, IList<T>, IList<T>, int, int)
Raises the events for the collections of changes
protected void RaiseEvents(IList<T> added, IList<T> removed, IList<T> moved, int oldItemsStartIndex = -1, int newItemsStartIndex = -1)
Parameters
added
IList<T>A list of the added items
removed
IList<T>A list of the removed items
moved
IList<T>A list of the moved items
oldItemsStartIndex
intthe start index of old items or -1
newItemsStartIndex
intthe start index of new items or -1
Remove(T)
Removes the first occurrence of a specific object from the ICollection<T>.
public virtual bool Remove(T item)
Parameters
item
TThe object to remove from the ICollection<T>.
Returns
- bool
true if
item
was successfully removed from the ICollection<T>; otherwise, false. This method also returns false ifitem
is not found in the original ICollection<T>.
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Set(INotifiable)
Add the given DDG node to the list
public void Set(INotifiable node)
Parameters
node
INotifiableThe DDG node to add
SetDummy()
Sets a dummy
public void SetDummy()
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Unset(INotifiable, bool)
Unset the given DDG node as successor
public void Unset(INotifiable node, bool leaveDummy = false)
Parameters
node
INotifiablethe DDG node
leaveDummy
boolTrue, to leave the dummy in operation, otherwise False
UnsetAll()
Clear the list
public void UnsetAll()
Events
CollectionChanged
Occurs when the collection changes.
public event NotifyCollectionChangedEventHandler CollectionChanged