ValenceSet<T>
ReferencesProvides a hashset like type which also stores valences for entries. This collection is thread-safe for adding and removing, but not for enumerating.
Type parameters:
| T |
Constructors
ValenceSet
#Creates a valence set with custom comparisons.
ValenceSet
#Creates a valence set with a custom comparer.
Parameters:
| comparer (IEqualityComparer<T>) | Custom comparer. |
Properties
Count
#Gets the number of values in this set, including all duplicate ones. This property is not thread safe and should not be used while Add or Remove methods are liable to be invoked from different threads.
HighestValence
#Gets the highest valence in this set. This property is not thread safe and should not be used while Add or Remove methods are liable to be invoked from different threads.
Methods
Add
#Add a new value with a custom valence to this set.
Parameters:
| value (T) | Value to add. |
| valence (int) | Custom valence. |
Returns: New valence of value.
Contains
#Gets whether the given value is contained within this set.
Parameters:
| value (T) | Value to test. |
Returns: True if value occurs at least once.
GetEnumerator
#Enumerate over all values and their associated valences in this set. This method is not thread safe and should not be used while Add or Remove methods are liable to be invoked from different threads.
Remove
#Remove a value with a custom valence from this set.
Parameters:
| value (T) | Value to remove. |
| valence (int) | Valence to remove. If this set contains fewer than valence values, they will all be removed. |
Returns: New valence of value.
Remove
#Remove a single value from this set.
Parameters:
| value (T) | Value to remove. |
Returns: New valence of value.
RemoveAll
#Remove all values from this set.
Parameters:
| value (T) | Value to remove. |
Returns: True if any values were removed.
Operators
| Operation | Result | Description | ||
|---|---|---|---|---|
| ValenceSet<T> | + | ValenceSet<T> | ValenceSet<T> | Merge two sets. |