Table of Contents

Class OppositeOrderedSet<TParent, TCollected>

Namespace
NMF.Collections.ObjectModel
Assembly
NMF.Collections.dll

Denotes an abstract base class for an ordered set with opposites

public abstract class OppositeOrderedSet<TParent, TCollected> : OrderedSet<TCollected>, IList, ICollection, IOrderedSet<TCollected>, IList<TCollected>, ISet<TCollected>, ICollection<TCollected>, IEnumerable<TCollected>, IEnumerable

Type Parameters

TParent

the type of the parent element

TCollected

the collection item type

Inheritance
DecoratedSet<TCollected>
OrderedSet<TCollected>
OppositeOrderedSet<TParent, TCollected>
Implements
IOrderedSet<TCollected>
IList<TCollected>
ISet<TCollected>
ICollection<TCollected>
IEnumerable<TCollected>
Inherited Members

Constructors

OppositeOrderedSet(TParent)

Creates a new instance

protected OppositeOrderedSet(TParent parent)

Parameters

parent TParent

the parent model element

Exceptions

ArgumentNullException

thrown if parent is null

Properties

Parent

Gets the parent element

public TParent Parent { get; }

Property Value

TParent

Methods

Add(TCollected)

Adds an element to the current set and returns a value to indicate if the element was successfully added.

public override bool Add(TCollected item)

Parameters

item TCollected

The element to add to the set.

Returns

bool

true if the element is added to the set; false if the element is already in the set.

Clear()

Removes all items from the ICollection<T>.

public override void Clear()

Exceptions

NotSupportedException

The ICollection<T> is read-only.

Remove(TCollected, int)

Removes the given item at the given arrayIndex

protected override bool Remove(TCollected item, int index)

Parameters

item TCollected

The item to remove

index int

The arrayIndex of the item

Returns

bool

True, if the removal was successful, otherwise false

Replace(int, TCollected, TCollected)

Replaces the item at the given arrayIndex

protected override void Replace(int index, TCollected oldValue, TCollected newValue)

Parameters

index int

The arrayIndex on which the item is replaced

oldValue TCollected

The old value

newValue TCollected

The new value

SetOpposite(TCollected, TParent)

Sets the opposite of the given item

protected abstract void SetOpposite(TCollected item, TParent newParent)

Parameters

item TCollected

the item

newParent TParent

the new parent or null, if the item is removed from the collection