MultiValueSortedDictionary<TKey, TValue> Class
Namespace: Stride.Core.CollectionsAssembly: Stride.Core.dll
Represents a priority queue, where keys are sorted and each key might have mlutiple values.
public class MultiValueSortedDictionary<TKey, TValue> : IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, ICollection, IEnumerable
Type Parameters
Name | Description |
---|---|
TKey | The type of the key. |
TValue | The type of the value. |
Remarks
Storage is based on a System.Collections.Generic.SortedDictionary`2.
Name | Description | |
---|---|---|
Constructors | ||
MultiValueSortedDictionary() | Initializes a new instance of the KoderHack.MultiValueSortedDictionary<TKey,TValue> class that is empty and uses the default System.Collections.Generic.IComparer<TKey> implementation to compare keys. |
|
MultiValueSortedDictionary(IComparer<TKey>) | Initializes a new instance of the KoderHack.MultiValueSortedDictionary<TKey,TValue> class that is empty and uses the specified System.Collections.Generic.IComparer<TKey> implementation to compare keys. |
|
MultiValueSortedDictionary(IDictionary<TKey, TValue>) | Initializes a new instance of the KoderHack.MultiValueSortedDictionary<TKey,TValue> class that contains elements copied from the specified System.Collections.Generic.IDictionary<TKey,TValue> and uses the default System.Collections.Generic.IComparer<T> implementation for the key type. |
|
MultiValueSortedDictionary(IDictionary<TKey, TValue>, IComparer<TKey>) | Initializes a new instance of the KoderHack.MultiValueSortedDictionary<TKey,TValue> class that contains elements copied from the specified System.Collections.Generic.IDictionary<TKey,TValue> and uses the specified System.Collections.Generic.IComparer<TKey> implementation to compare keys. |
|
Properties | ||
Comparer | Gets the System.Collections.Generic.IComparer<TKey> used to order the elements of the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
|
Count | Gets the number of key/value pairs contained in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
|
Item[TKey] | Gets or sets the value associated with the specified key. |
|
Keys | Gets a collection containing the keys in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
|
Values | Gets a collection containing the values in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
|
Methods | ||
Add(TKey, TValue) | Adds an element with the specified key and value into the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
|
Clear() | Removes all elements from the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
|
ContainsKey(TKey) | Determines whether the KoderHack.MultiValueSortedDictionary<TKey,TValue> contains an element with the specified key. |
|
ContainsValue(TValue) | Determines whether the KoderHack.MultiValueSortedDictionary<TKey,TValue> contains an element with the specified value. |
|
CopyTo(KeyValuePair<TKey, TValue>[], Int32) | ||
GetEnumerator() | Returns an enumerator that iterates through the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
|
Remove(TKey) | Removes the elements with the specified key from the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
|
Remove(KeyValuePair<TKey, TValue>) | Removes the element with the specified key from the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
|
TryGetValue(TKey, out TValue) | Gets the value associated with the specified key. |
|
TryGetValue(TKey, out IEnumerable<TValue>) | Gets the value associated with the specified key. |
|
TryToGetOnNotFound(TKey) | ||
Explicit Interface Implementations | ||
ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue>) | ||
ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue>) | ||
ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly | ||
ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue>) | ||
IDictionary<TKey, TValue>.Keys | ||
IDictionary<TKey, TValue>.Values | ||
IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator() | ||
ICollection.CopyTo(Array, Int32) | ||
ICollection.IsSynchronized | ||
ICollection.SyncRoot | ||
IDictionary.Add(Object, Object) | ||
IDictionary.Contains(Object) | ||
IDictionary.GetEnumerator() | ||
IDictionary.IsFixedSize | ||
IDictionary.IsReadOnly | ||
IDictionary.Item[Object] | ||
IDictionary.Keys | ||
IDictionary.Remove(Object) | ||
IDictionary.Values | ||
IEnumerable.GetEnumerator() |
Constructors
MultiValueSortedDictionary()
Initializes a new instance of the KoderHack.MultiValueSortedDictionary<TKey,TValue> class that is empty and uses the default System.Collections.Generic.IComparer<TKey> implementation to compare keys.
public MultiValueSortedDictionary()
MultiValueSortedDictionary(IComparer<TKey>)
Initializes a new instance of the KoderHack.MultiValueSortedDictionary<TKey,TValue> class that is empty and uses the specified System.Collections.Generic.IComparer<TKey> implementation to compare keys.
public MultiValueSortedDictionary(IComparer<TKey> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IComparer<TKey> | comparer | The System.Collections.Generic.IComparer<TKey> implementation to use when comparing keys, or null to use the default System.Collections.Generic.Comparer<TKey> for the type of the key. |
MultiValueSortedDictionary(IDictionary<TKey, TValue>)
Initializes a new instance of the KoderHack.MultiValueSortedDictionary<TKey,TValue> class that contains elements copied from the specified System.Collections.Generic.IDictionary<TKey,TValue> and uses the default System.Collections.Generic.IComparer<T> implementation for the key type.
public MultiValueSortedDictionary(IDictionary<TKey, TValue> dictionary)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TKey, TValue> | dictionary | The System.Collections.Generic.IDictionary<TKey,TValue> whose elements are copied to the new KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | dictionary is null |
MultiValueSortedDictionary(IDictionary<TKey, TValue>, IComparer<TKey>)
Initializes a new instance of the KoderHack.MultiValueSortedDictionary<TKey,TValue> class that contains elements copied from the specified System.Collections.Generic.IDictionary<TKey,TValue> and uses the specified System.Collections.Generic.IComparer<TKey> implementation to compare keys.
public MultiValueSortedDictionary(IDictionary<TKey, TValue> dictionary, IComparer<TKey> comparer)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TKey, TValue> | dictionary | The System.Collections.Generic.IDictionary<TKey,TValue> whose elements are copied to the new KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
System.Collections.Generic.IComparer<TKey> | comparer | The System.Collections.Generic.IComparer<T> implementation to use when comparing keys, or null to use the default System.Collections.Generic.Comparer<TKey> for the type of the key. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | dictionary is null |
Properties
Comparer
Gets the System.Collections.Generic.IComparer<TKey> used to order the elements of the KoderHack.MultiValueSortedDictionary<TKey,TValue>.
public IComparer<TKey> Comparer { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IComparer<TKey> | The System.Collections.Generic.IComparer<TKey> used to order the elements of the KoderHack.MultiValueSortedDictionary<TKey,TValue> |
Count
Gets the number of key/value pairs contained in the KoderHack.MultiValueSortedDictionary<TKey,TValue>.
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The number of key/value pairs contained in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
Item[TKey]
Gets or sets the value associated with the specified key.
public TValue this[TKey key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key of the value to get or set. |
Property Value
Type | Description |
---|---|
TValue | The value associated with the specified key. If the specified key is not found, a get operation throws a System.Collections.Generic.KeyNotFoundException, and a set operation creates a new element with the specified key. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | key is null. |
System.Collections.Generic.KeyNotFoundException | The property is retrieved and key does not exist in the collection. |
Keys
Gets a collection containing the keys in the KoderHack.MultiValueSortedDictionary<TKey,TValue>.
public SortedDictionary<TKey, List<TValue>>.KeyCollection Keys { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.SortedDictionary.KeyCollection<> | A KoderHack.MultiValueSortedDictionary<TKey,TValue>.KeyCollection containing the keys in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
Values
Gets a collection containing the values in the KoderHack.MultiValueSortedDictionary<TKey,TValue>.
public MultiValueSortedDictionary<TKey, TValue>.ValueCollection Values { get; }
Property Value
Type | Description |
---|---|
MultiValueSortedDictionary.ValueCollection<> | A KoderHack.MultiValueSortedDictionary<TKey,TValue>.ValueCollection containing the keys in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
Methods
Add(TKey, TValue)
Adds an element with the specified key and value into the KoderHack.MultiValueSortedDictionary<TKey,TValue>.
public void Add(TKey key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key of the element to add. |
TValue | value | The value of the element to add. The value can be null for reference types. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | key is null. |
Clear()
Removes all elements from the KoderHack.MultiValueSortedDictionary<TKey,TValue>.
public void Clear()
ContainsKey(TKey)
Determines whether the KoderHack.MultiValueSortedDictionary<TKey,TValue> contains an element with the specified key.
public bool ContainsKey(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key to locate in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
Returns
Type | Description |
---|---|
System.Boolean | true if the KoderHack.MultiValueSortedDictionary<TKey,TValue> contains an element with the specified key; otherwise, false. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | key is null. |
ContainsValue(TValue)
Determines whether the KoderHack.MultiValueSortedDictionary<TKey,TValue> contains an element with the specified value.
public bool ContainsValue(TValue value)
Parameters
Type | Name | Description |
---|---|---|
TValue | value | The value to locate in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. The value can be null for reference types. |
Returns
Type | Description |
---|---|
System.Boolean | true if the KoderHack.MultiValueSortedDictionary<TKey,TValue> contains an element with the specified value; otherwise, false. |
CopyTo(KeyValuePair<TKey, TValue>[], Int32)
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue>[] | array | |
System.Int32 | index |
GetEnumerator()
Returns an enumerator that iterates through the KoderHack.MultiValueSortedDictionary<TKey,TValue>.
public MultiValueSortedDictionary<TKey, TValue>.Enumerator GetEnumerator()
Returns
Type | Description |
---|---|
MultiValueSortedDictionary.Enumerator<> | A KoderHack.MultiValueSortedDictionary<TKey,TValue>.Enumerator for the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
Remove(TKey)
Removes the elements with the specified key from the KoderHack.MultiValueSortedDictionary<TKey,TValue>.
public bool Remove(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key of the element to remove. |
Returns
Type | Description |
---|---|
System.Boolean | true if the element is successfully removed; otherwise, false. This method also returns false if key is not found in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | key is null. |
Remove(KeyValuePair<TKey, TValue>)
Removes the element with the specified key from the KoderHack.MultiValueSortedDictionary<TKey,TValue>.
public bool Remove(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item | The key of the element to remove. |
Returns
Type | Description |
---|---|
System.Boolean | true if the element is successfully removed; otherwise, false. This method also returns false if key is not found in the KoderHack.MultiValueSortedDictionary<TKey,TValue>. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | key is null. |
TryGetValue(TKey, out TValue)
Gets the value associated with the specified key.
public bool TryGetValue(TKey key, out TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key of the value to get. |
TValue | value | When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. |
Returns
Type | Description |
---|---|
System.Boolean | true if the KoderHack.MultiValueSortedDictionary<TKey,TValue> contains an element with the specified key; otherwise, false. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | key is null. |
TryGetValue(TKey, out IEnumerable<TValue>)
Gets the value associated with the specified key.
public bool TryGetValue(TKey key, out IEnumerable<TValue> values)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key of the value to get. |
System.Collections.Generic.IEnumerable<TValue> | values | When this method returns, the values associated with the specified key, if the key is found; otherwise null. |
Returns
Type | Description |
---|---|
System.Boolean | true if the KoderHack.MultiValueSortedDictionary<TKey,TValue> contains an element with the specified key; otherwise, false. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | key is null. |
TryToGetOnNotFound(TKey)
protected virtual object TryToGetOnNotFound(TKey name)
Parameters
Type | Name | Description |
---|---|---|
TKey | name |
Returns
Type | Description |
---|---|
System.Object |
Explicit Interface Implementations
ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue>)
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item |
ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue>)
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item |
Returns
Type | Description |
---|---|
System.Boolean |
ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly { get; }
Returns
Type | Description |
---|---|
System.Boolean |
ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue>)
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.KeyValuePair<TKey, TValue> | item |
Returns
Type | Description |
---|---|
System.Boolean |
IDictionary<TKey, TValue>.Keys
ICollection<TKey> IDictionary<TKey, TValue>.Keys { get; }
Returns
Type | Description |
---|---|
System.Collections.Generic.ICollection<TKey> |
IDictionary<TKey, TValue>.Values
ICollection<TValue> IDictionary<TKey, TValue>.Values { get; }
Returns
Type | Description |
---|---|
System.Collections.Generic.ICollection<TValue> |
IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<TKey, TValue>> |
ICollection.CopyTo(Array, Int32)
void ICollection.CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Array | array | |
System.Int32 | index |
ICollection.IsSynchronized
bool ICollection.IsSynchronized { get; }
Returns
Type | Description |
---|---|
System.Boolean |
ICollection.SyncRoot
object ICollection.SyncRoot { get; }
Returns
Type | Description |
---|---|
System.Object |
IDictionary.Add(Object, Object)
void IDictionary.Add(object key, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key | |
System.Object | value |
IDictionary.Contains(Object)
bool IDictionary.Contains(object key)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key |
Returns
Type | Description |
---|---|
System.Boolean |
IDictionary.GetEnumerator()
IDictionaryEnumerator IDictionary.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IDictionaryEnumerator |
IDictionary.IsFixedSize
bool IDictionary.IsFixedSize { get; }
Returns
Type | Description |
---|---|
System.Boolean |
IDictionary.IsReadOnly
bool IDictionary.IsReadOnly { get; }
Returns
Type | Description |
---|---|
System.Boolean |
IDictionary.Item[Object]
object IDictionary.this[object key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Object | key |
Returns
Type | Description |
---|---|
System.Object |
IDictionary.Keys
ICollection IDictionary.Keys { get; }
Returns
Type | Description |
---|---|
System.Collections.ICollection |
IDictionary.Remove(Object)
void IDictionary.Remove(object key)
Parameters
Type | Name | Description |
---|---|---|
System.Object | key |
IDictionary.Values
ICollection IDictionary.Values { get; }
Returns
Type | Description |
---|---|
System.Collections.ICollection |
IEnumerable.GetEnumerator()
IEnumerator IEnumerable.GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator |