Interface IMultiSet<T>
- Namespace
- LfrlAnvil.Collections
- Assembly
- LfrlAnvil.Collections.dll
Represents a generic multi set.
public interface IMultiSet<T> : IReadOnlyMultiSet<T>, IReadOnlySet<Pair<T, int>>, IReadOnlyCollection<Pair<T, int>>, ISet<Pair<T, int>>, ICollection<Pair<T, int>>, IEnumerable<Pair<T, int>>, IEnumerable where T : notnull
Type Parameters
TElement type.
- Inherited Members
- Extension Methods
Properties
Count
Gets the number of elements contained in the ICollection<T>.
int Count { get; }
Property Value
- int
The number of elements contained in the ICollection<T>.
Methods
Add(T)
Adds the provided item to this set once.
int Add(T item)
Parameters
itemTElement to add.
Returns
- int
Current multiplicity of the added
item.
AddMany(T, int)
Adds the provided item to this set with specified number of repetitions.
int AddMany(T item, int count)
Parameters
itemTElement to add.
countintNumber of repetitions.
Returns
- int
Current multiplicity of the added
item.
Exceptions
- ArgumentOutOfRangeException
When
countis less than 1.
Contains(Pair<T, int>)
Determines whether the ICollection<T> contains a specific value.
[Pure]
bool Contains(Pair<T, int> item)
Parameters
itemPair<T, int>The object to locate in the ICollection<T>.
Returns
- bool
true if
itemis found in the ICollection<T>; otherwise, false.
IsProperSubsetOf(IEnumerable<Pair<T, int>>)
Determines whether the current set is a proper (strict) subset of a specified collection.
[Pure]
bool IsProperSubsetOf(IEnumerable<Pair<T, int>> other)
Parameters
otherIEnumerable<Pair<T, int>>The collection to compare to the current set.
Returns
Exceptions
- ArgumentNullException
otheris null.
IsProperSupersetOf(IEnumerable<Pair<T, int>>)
Determines whether the current set is a proper (strict) superset of a specified collection.
[Pure]
bool IsProperSupersetOf(IEnumerable<Pair<T, int>> other)
Parameters
otherIEnumerable<Pair<T, int>>The collection to compare to the current set.
Returns
Exceptions
- ArgumentNullException
otheris null.
IsSubsetOf(IEnumerable<Pair<T, int>>)
Determines whether a set is a subset of a specified collection.
[Pure]
bool IsSubsetOf(IEnumerable<Pair<T, int>> other)
Parameters
otherIEnumerable<Pair<T, int>>The collection to compare to the current set.
Returns
Exceptions
- ArgumentNullException
otheris null.
IsSupersetOf(IEnumerable<Pair<T, int>>)
Determines whether the current set is a superset of a specified collection.
[Pure]
bool IsSupersetOf(IEnumerable<Pair<T, int>> other)
Parameters
otherIEnumerable<Pair<T, int>>The collection to compare to the current set.
Returns
Exceptions
- ArgumentNullException
otheris null.
Overlaps(IEnumerable<Pair<T, int>>)
Determines whether the current set overlaps with the specified collection.
[Pure]
bool Overlaps(IEnumerable<Pair<T, int>> other)
Parameters
otherIEnumerable<Pair<T, int>>The collection to compare to the current set.
Returns
Exceptions
- ArgumentNullException
otheris null.
Remove(T)
Removes the provided item from this set once.
int Remove(T item)
Parameters
itemTElement to remove.
Returns
- int
Current multiplicity of the removed
itemor -1 if it did not exist.
RemoveAll(T)
Removes all occurrences of the provided item from this set.
int RemoveAll(T item)
Parameters
itemTElement to remove.
Returns
- int
Removed number of repetitions or 0 if
itemdid not exist.
RemoveMany(T, int)
Removes the provided item from this set with specified number of repetitions.
int RemoveMany(T item, int count)
Parameters
itemTElement to remove.
countintNumber of repetitions.
Returns
- int
Current multiplicity of the removed
itemor -1 if it did not exist.
Exceptions
- ArgumentOutOfRangeException
When
countis less than 1.
SetEquals(IEnumerable<Pair<T, int>>)
Determines whether the current set and the specified collection contain the same elements.
[Pure]
bool SetEquals(IEnumerable<Pair<T, int>> other)
Parameters
otherIEnumerable<Pair<T, int>>The collection to compare to the current set.
Returns
Exceptions
- ArgumentNullException
otheris null.
SetMultiplicity(T, int)
Sets the number of repetitions for the provided item in this set.
int SetMultiplicity(T item, int value)
Parameters
itemTElement to update.
valueintNumber of repetitions.
Returns
- int
Previous multiplicity of the updated
item.
Remarks
Setting multiplicity to 0 is equivalent to RemoveAll(T) invocation.
Exceptions
- ArgumentOutOfRangeException
When
valueis less than 0.