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
TParentthe 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
TCollectedThe element to add to the set.
Returns
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
TCollectedThe item to remove
index
intThe 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
intThe arrayIndex on which the item is replaced
oldValue
TCollectedThe old value
newValue
TCollectedThe new value
SetOpposite(TCollected, TParent)
Sets the opposite of the given item
protected abstract void SetOpposite(TCollected item, TParent newParent)
Parameters
item
TCollectedthe item
newParent
TParentthe new parent or null, if the item is removed from the collection