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
TParentthe type of the parent element
TCollectedthe 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
parentTParentthe 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
itemTCollectedThe 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
itemTCollectedThe item to remove
indexintThe 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
indexintThe arrayIndex on which the item is replaced
oldValueTCollectedThe old value
newValueTCollectedThe new value
SetOpposite(TCollected, TParent)
Sets the opposite of the given item
protected abstract void SetOpposite(TCollected item, TParent newParent)
Parameters
itemTCollectedthe item
newParentTParentthe new parent or null, if the item is removed from the collection