1235 lines
56 KiB
C#
1235 lines
56 KiB
C#
using System;
|
|
|
|
namespace System.Collections.Generic
|
|
{
|
|
/// <summary>Represents a collection of key/value pairs that are sorted on the key.</summary>
|
|
/// <typeparam name="TKey">The type of the keys in the dictionary.</typeparam>
|
|
/// <typeparam name="TValue">The type of the values in the dictionary.</typeparam>
|
|
/// <filterpriority>1</filterpriority>
|
|
// Token: 0x02000014 RID: 20
|
|
[Serializable]
|
|
public class SortedDictionary<TKey, TValue> : ICollection, IEnumerable<KeyValuePair<TKey, TValue>>, IDictionary, IEnumerable, IDictionary<TKey, TValue>, ICollection<KeyValuePair<TKey, TValue>>
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> class that is empty and uses the default <see cref="T:System.Collections.Generic.IComparer`1" /> implementation for the key type.</summary>
|
|
// Token: 0x06000083 RID: 131 RVA: 0x00004094 File Offset: 0x00002294
|
|
public SortedDictionary()
|
|
: this(null)
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> class that is empty and uses the specified <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to compare keys.</summary>
|
|
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys, or null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
|
|
// Token: 0x06000084 RID: 132 RVA: 0x000040A0 File Offset: 0x000022A0
|
|
public SortedDictionary(IComparer<TKey> comparer)
|
|
{
|
|
this.hlp = SortedDictionary<TKey, TValue>.NodeHelper.GetHelper(comparer);
|
|
this.tree = new RBTree(this.hlp);
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" /> and uses the default <see cref="T:System.Collections.Generic.IComparer`1" /> implementation for the key type.</summary>
|
|
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.IDictionary`2" /> whose elements are copied to the new <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="dictionary" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentException">
|
|
/// <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
|
|
// Token: 0x06000085 RID: 133 RVA: 0x000040C8 File Offset: 0x000022C8
|
|
public SortedDictionary(IDictionary<TKey, TValue> dic)
|
|
: this(dic, null)
|
|
{
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> class that contains elements copied from the specified <see cref="T:System.Collections.Generic.IDictionary`2" /> and uses the specified <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to compare keys.</summary>
|
|
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.IDictionary`2" /> whose elements are copied to the new <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</param>
|
|
/// <param name="comparer">The <see cref="T:System.Collections.Generic.IComparer`1" /> implementation to use when comparing keys, or null to use the default <see cref="T:System.Collections.Generic.Comparer`1" /> for the type of the key.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="dictionary" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentException">
|
|
/// <paramref name="dictionary" /> contains one or more duplicate keys.</exception>
|
|
// Token: 0x06000086 RID: 134 RVA: 0x000040D4 File Offset: 0x000022D4
|
|
public SortedDictionary(IDictionary<TKey, TValue> dic, IComparer<TKey> comparer)
|
|
: this(comparer)
|
|
{
|
|
if (dic == null)
|
|
{
|
|
throw new ArgumentNullException();
|
|
}
|
|
foreach (KeyValuePair<TKey, TValue> keyValuePair in dic)
|
|
{
|
|
this.Add(keyValuePair.Key, keyValuePair.Value);
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700001B RID: 27
|
|
// (get) Token: 0x06000087 RID: 135 RVA: 0x00004154 File Offset: 0x00002354
|
|
ICollection<TKey> IDictionary<TKey, TValue>.Keys
|
|
{
|
|
get
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.KeyCollection(this);
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700001C RID: 28
|
|
// (get) Token: 0x06000088 RID: 136 RVA: 0x0000415C File Offset: 0x0000235C
|
|
ICollection<TValue> IDictionary<TKey, TValue>.Values
|
|
{
|
|
get
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.ValueCollection(this);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000089 RID: 137 RVA: 0x00004164 File Offset: 0x00002364
|
|
void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
|
|
{
|
|
this.Add(item.Key, item.Value);
|
|
}
|
|
|
|
// Token: 0x0600008A RID: 138 RVA: 0x0000417C File Offset: 0x0000237C
|
|
bool ICollection<KeyValuePair<TKey, TValue>>.Contains(KeyValuePair<TKey, TValue> item)
|
|
{
|
|
TValue tvalue;
|
|
return this.TryGetValue(item.Key, out tvalue) && EqualityComparer<TValue>.Default.Equals(item.Value, tvalue);
|
|
}
|
|
|
|
// Token: 0x1700001D RID: 29
|
|
// (get) Token: 0x0600008B RID: 139 RVA: 0x000041B4 File Offset: 0x000023B4
|
|
bool ICollection<KeyValuePair<TKey, TValue>>.IsReadOnly
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600008C RID: 140 RVA: 0x000041B8 File Offset: 0x000023B8
|
|
bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
|
|
{
|
|
TValue tvalue;
|
|
return this.TryGetValue(item.Key, out tvalue) && EqualityComparer<TValue>.Default.Equals(item.Value, tvalue) && this.Remove(item.Key);
|
|
}
|
|
|
|
/// <summary>Adds an element with the provided key and value to the <see cref="T:System.Collections.IDictionary" />.</summary>
|
|
/// <param name="key">The object to use as the key of the element to add.</param>
|
|
/// <param name="value">The object to use as the value of the element to add.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentException">
|
|
/// <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.IDictionary" />.-or-<paramref name="value" /> is of a type that is not assignable to the value type <paramref name="TValue" /> of the <see cref="T:System.Collections.IDictionary" />.-or-An element with the same key already exists in the <see cref="T:System.Collections.IDictionary" />.</exception>
|
|
// Token: 0x0600008D RID: 141 RVA: 0x00004200 File Offset: 0x00002400
|
|
void IDictionary.Add(object key, object value)
|
|
{
|
|
this.Add(this.ToKey(key), this.ToValue(value));
|
|
}
|
|
|
|
/// <summary>Determines whether the <see cref="T:System.Collections.IDictionary" /> contains an element with the specified key.</summary>
|
|
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> contains an element with the key; otherwise, false.</returns>
|
|
/// <param name="key">The key to locate in the <see cref="T:System.Collections.IDictionary" />.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
// Token: 0x0600008E RID: 142 RVA: 0x00004218 File Offset: 0x00002418
|
|
bool IDictionary.Contains(object key)
|
|
{
|
|
return this.ContainsKey(this.ToKey(key));
|
|
}
|
|
|
|
/// <summary>Returns an <see cref="T:System.Collections.IDictionaryEnumerator" /> for the <see cref="T:System.Collections.IDictionary" />.</summary>
|
|
/// <returns>An <see cref="T:System.Collections.IDictionaryEnumerator" /> for the <see cref="T:System.Collections.IDictionary" />.</returns>
|
|
// Token: 0x0600008F RID: 143 RVA: 0x00004228 File Offset: 0x00002428
|
|
IDictionaryEnumerator IDictionary.GetEnumerator()
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.Enumerator(this);
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> has a fixed size.</summary>
|
|
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> has a fixed size; otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2" />, this property always returns false.</returns>
|
|
// Token: 0x1700001E RID: 30
|
|
// (get) Token: 0x06000090 RID: 144 RVA: 0x00004238 File Offset: 0x00002438
|
|
bool IDictionary.IsFixedSize
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether the <see cref="T:System.Collections.IDictionary" /> is read-only.</summary>
|
|
/// <returns>true if the <see cref="T:System.Collections.IDictionary" /> is read-only; otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2" />, this property always returns false.</returns>
|
|
// Token: 0x1700001F RID: 31
|
|
// (get) Token: 0x06000091 RID: 145 RVA: 0x0000423C File Offset: 0x0000243C
|
|
bool IDictionary.IsReadOnly
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets an <see cref="T:System.Collections.ICollection" /> containing the keys of the <see cref="T:System.Collections.IDictionary" />.</summary>
|
|
/// <returns>An <see cref="T:System.Collections.ICollection" /> containing the keys of the <see cref="T:System.Collections.IDictionary" />.</returns>
|
|
// Token: 0x17000020 RID: 32
|
|
// (get) Token: 0x06000092 RID: 146 RVA: 0x00004240 File Offset: 0x00002440
|
|
ICollection IDictionary.Keys
|
|
{
|
|
get
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.KeyCollection(this);
|
|
}
|
|
}
|
|
|
|
/// <summary>Removes the element with the specified key from the <see cref="T:System.Collections.IDictionary" />.</summary>
|
|
/// <param name="key">The key of the element to remove.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
// Token: 0x06000093 RID: 147 RVA: 0x00004248 File Offset: 0x00002448
|
|
void IDictionary.Remove(object key)
|
|
{
|
|
this.Remove(this.ToKey(key));
|
|
}
|
|
|
|
/// <summary>Gets an <see cref="T:System.Collections.ICollection" /> containing the values in the <see cref="T:System.Collections.IDictionary" />.</summary>
|
|
/// <returns>An <see cref="T:System.Collections.ICollection" /> containing the values in the <see cref="T:System.Collections.IDictionary" />.</returns>
|
|
// Token: 0x17000021 RID: 33
|
|
// (get) Token: 0x06000094 RID: 148 RVA: 0x00004258 File Offset: 0x00002458
|
|
ICollection IDictionary.Values
|
|
{
|
|
get
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.ValueCollection(this);
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the element with the specified key.</summary>
|
|
/// <returns>The element with the specified key, or null if <paramref name="key" /> is not in the dictionary or <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
|
|
/// <param name="key">The key of the element to get.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentException">A value is being assigned, and <paramref name="key" /> is of a type that is not assignable to the key type <paramref name="TKey" /> of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.-or-A value is being assigned, and <paramref name="value" /> is of a type that is not assignable to the value type <paramref name="TValue" /> of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</exception>
|
|
// Token: 0x17000022 RID: 34
|
|
object IDictionary.this[object key]
|
|
{
|
|
get
|
|
{
|
|
return this[this.ToKey(key)];
|
|
}
|
|
set
|
|
{
|
|
this[this.ToKey(key)] = this.ToValue(value);
|
|
}
|
|
}
|
|
|
|
/// <summary>Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1" /> to an array, starting at the specified array index.</summary>
|
|
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.Generic.ICollection`1" />. The array must have zero-based indexing.</param>
|
|
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="array" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="index" /> is less than 0.</exception>
|
|
/// <exception cref="T:System.ArgumentException">
|
|
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.Generic.ICollection`1" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.Generic.ICollection`1" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
|
|
// Token: 0x06000097 RID: 151 RVA: 0x0000428C File Offset: 0x0000248C
|
|
void ICollection.CopyTo(Array array, int index)
|
|
{
|
|
if (this.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (array == null)
|
|
{
|
|
throw new ArgumentNullException();
|
|
}
|
|
if (index < 0 || array.Length <= index)
|
|
{
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
if (array.Length - index < this.Count)
|
|
{
|
|
throw new ArgumentException();
|
|
}
|
|
foreach (RBTree.Node node in this.tree)
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
|
|
array.SetValue(node2.AsDE(), index++);
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
|
|
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2" />, this property always returns false.</returns>
|
|
// Token: 0x17000023 RID: 35
|
|
// (get) Token: 0x06000098 RID: 152 RVA: 0x00004354 File Offset: 0x00002554
|
|
bool ICollection.IsSynchronized
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
|
|
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. </returns>
|
|
// Token: 0x17000024 RID: 36
|
|
// (get) Token: 0x06000099 RID: 153 RVA: 0x00004358 File Offset: 0x00002558
|
|
object ICollection.SyncRoot
|
|
{
|
|
get
|
|
{
|
|
return this;
|
|
}
|
|
}
|
|
|
|
/// <summary>Returns an enumerator that iterates through the collection.</summary>
|
|
/// <returns>An <see cref="T:System.Collections.Generic.IEnumerator`1" /> that can be used to iterate through the collection.</returns>
|
|
// Token: 0x0600009A RID: 154 RVA: 0x0000435C File Offset: 0x0000255C
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.Enumerator(this);
|
|
}
|
|
|
|
// Token: 0x0600009B RID: 155 RVA: 0x0000436C File Offset: 0x0000256C
|
|
IEnumerator<KeyValuePair<TKey, TValue>> IEnumerable<KeyValuePair<TKey, TValue>>.GetEnumerator()
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.Enumerator(this);
|
|
}
|
|
|
|
/// <summary>Gets the <see cref="T:System.Collections.Generic.IComparer`1" /> used to order the elements of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <returns>The <see cref="T:System.Collections.Generic.IComparer`1" /> used to order the elements of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /></returns>
|
|
// Token: 0x17000025 RID: 37
|
|
// (get) Token: 0x0600009C RID: 156 RVA: 0x0000437C File Offset: 0x0000257C
|
|
public IComparer<TKey> Comparer
|
|
{
|
|
get
|
|
{
|
|
return this.hlp.cmp;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the number of key/value pairs contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <returns>The number of key/value pairs contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
|
|
// Token: 0x17000026 RID: 38
|
|
// (get) Token: 0x0600009D RID: 157 RVA: 0x0000438C File Offset: 0x0000258C
|
|
public int Count
|
|
{
|
|
get
|
|
{
|
|
return this.tree.Count;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the value associated with the specified key.</summary>
|
|
/// <returns>The value associated with the specified key. If the specified key is not found, a get operation throws a <see cref="T:System.Collections.Generic.KeyNotFoundException" />, and a set operation creates a new element with the specified key.</returns>
|
|
/// <param name="key">The key of the value to get or set.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
/// <exception cref="T:System.Collections.Generic.KeyNotFoundException">The property is retrieved and <paramref name="key" /> does not exist in the collection.</exception>
|
|
// Token: 0x17000027 RID: 39
|
|
public TValue this[TKey key]
|
|
{
|
|
get
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node = (SortedDictionary<TKey, TValue>.Node)this.tree.Lookup<TKey>(key);
|
|
if (node == null)
|
|
{
|
|
throw new KeyNotFoundException();
|
|
}
|
|
return node.value;
|
|
}
|
|
set
|
|
{
|
|
if (key == null)
|
|
{
|
|
throw new ArgumentNullException("key");
|
|
}
|
|
SortedDictionary<TKey, TValue>.Node node = (SortedDictionary<TKey, TValue>.Node)this.tree.Intern<TKey>(key, null);
|
|
node.value = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a collection containing the keys in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> containing the keys in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
|
|
// Token: 0x17000028 RID: 40
|
|
// (get) Token: 0x060000A0 RID: 160 RVA: 0x00004410 File Offset: 0x00002610
|
|
public SortedDictionary<TKey, TValue>.KeyCollection Keys
|
|
{
|
|
get
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.KeyCollection(this);
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a collection containing the values in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> containing the values in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
|
|
// Token: 0x17000029 RID: 41
|
|
// (get) Token: 0x060000A1 RID: 161 RVA: 0x00004418 File Offset: 0x00002618
|
|
public SortedDictionary<TKey, TValue>.ValueCollection Values
|
|
{
|
|
get
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.ValueCollection(this);
|
|
}
|
|
}
|
|
|
|
/// <summary>Adds an element with the specified key and value into the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <param name="key">The key of the element to add.</param>
|
|
/// <param name="value">The value of the element to add. The value can be null for reference types.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentException">An element with the same key already exists in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</exception>
|
|
// Token: 0x060000A2 RID: 162 RVA: 0x00004420 File Offset: 0x00002620
|
|
public void Add(TKey key, TValue value)
|
|
{
|
|
if (key == null)
|
|
{
|
|
throw new ArgumentNullException("key");
|
|
}
|
|
RBTree.Node node = new SortedDictionary<TKey, TValue>.Node(key, value);
|
|
if (this.tree.Intern<TKey>(key, node) != node)
|
|
{
|
|
throw new ArgumentException("key already present in dictionary", "key");
|
|
}
|
|
}
|
|
|
|
/// <summary>Removes all elements from the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
// Token: 0x060000A3 RID: 163 RVA: 0x00004470 File Offset: 0x00002670
|
|
public void Clear()
|
|
{
|
|
this.tree.Clear();
|
|
}
|
|
|
|
/// <summary>Determines whether the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified key.</summary>
|
|
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified key; otherwise, false.</returns>
|
|
/// <param name="key">The key to locate in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
// Token: 0x060000A4 RID: 164 RVA: 0x00004480 File Offset: 0x00002680
|
|
public bool ContainsKey(TKey key)
|
|
{
|
|
return this.tree.Lookup<TKey>(key) != null;
|
|
}
|
|
|
|
/// <summary>Determines whether the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified value.</summary>
|
|
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified value; otherwise, false.</returns>
|
|
/// <param name="value">The value to locate in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />. The value can be null for reference types.</param>
|
|
// Token: 0x060000A5 RID: 165 RVA: 0x00004494 File Offset: 0x00002694
|
|
public bool ContainsValue(TValue value)
|
|
{
|
|
IEqualityComparer<TValue> @default = EqualityComparer<TValue>.Default;
|
|
foreach (RBTree.Node node in this.tree)
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
|
|
if (@default.Equals(value, node2.value))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/// <summary>Copies the elements of the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> to the specified array of <see cref="T:System.Collections.Generic.KeyValuePair`2" /> structures, starting at the specified index.</summary>
|
|
/// <param name="array">The one-dimensional array of <see cref="T:System.Collections.Generic.KeyValuePair`2" /> structures that is the destination of the elements copied from the current <see cref="T:System.Collections.Generic.SortedDictionary`2" /> The array must have zero-based indexing.</param>
|
|
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="array" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="index" /> is less than 0.</exception>
|
|
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.SortedDictionary`2" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
|
|
// Token: 0x060000A6 RID: 166 RVA: 0x0000451C File Offset: 0x0000271C
|
|
public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
|
|
{
|
|
if (this.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (array == null)
|
|
{
|
|
throw new ArgumentNullException();
|
|
}
|
|
if (arrayIndex < 0 || array.Length <= arrayIndex)
|
|
{
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
if (array.Length - arrayIndex < this.Count)
|
|
{
|
|
throw new ArgumentException();
|
|
}
|
|
foreach (RBTree.Node node in this.tree)
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
|
|
array[arrayIndex++] = node2.AsKV();
|
|
}
|
|
}
|
|
|
|
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.Enumerator" /> for the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
|
|
// Token: 0x060000A7 RID: 167 RVA: 0x000045DC File Offset: 0x000027DC
|
|
public SortedDictionary<TKey, TValue>.Enumerator GetEnumerator()
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.Enumerator(this);
|
|
}
|
|
|
|
/// <summary>Removes the element with the specified key from the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <returns>true if the element is successfully removed; otherwise, false. This method also returns false if <paramref name="key" /> is not found in the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</returns>
|
|
/// <param name="key">The key of the element to remove.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
// Token: 0x060000A8 RID: 168 RVA: 0x000045E4 File Offset: 0x000027E4
|
|
public bool Remove(TKey key)
|
|
{
|
|
return this.tree.Remove<TKey>(key) != null;
|
|
}
|
|
|
|
/// <summary>Gets the value associated with the specified key.</summary>
|
|
/// <returns>true if the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> contains an element with the specified key; otherwise, false.</returns>
|
|
/// <param name="key">The key of the value to get.</param>
|
|
/// <param name="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 <paramref name="value" /> parameter. </param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="key" /> is null.</exception>
|
|
// Token: 0x060000A9 RID: 169 RVA: 0x000045F8 File Offset: 0x000027F8
|
|
public bool TryGetValue(TKey key, out TValue value)
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node = (SortedDictionary<TKey, TValue>.Node)this.tree.Lookup<TKey>(key);
|
|
value = ((node != null) ? node.value : default(TValue));
|
|
return node != null;
|
|
}
|
|
|
|
// Token: 0x060000AA RID: 170 RVA: 0x00004640 File Offset: 0x00002840
|
|
private TKey ToKey(object key)
|
|
{
|
|
if (key == null)
|
|
{
|
|
throw new ArgumentNullException("key");
|
|
}
|
|
if (!(key is TKey))
|
|
{
|
|
throw new ArgumentException(string.Format("Key \"{0}\" cannot be converted to the key type {1}.", key, typeof(TKey)));
|
|
}
|
|
return (TKey)((object)key);
|
|
}
|
|
|
|
// Token: 0x060000AB RID: 171 RVA: 0x00004680 File Offset: 0x00002880
|
|
private TValue ToValue(object value)
|
|
{
|
|
if (!(value is TValue) && (value != null || typeof(TValue).IsValueType))
|
|
{
|
|
throw new ArgumentException(string.Format("Value \"{0}\" cannot be converted to the value type {1}.", value, typeof(TValue)));
|
|
}
|
|
return (TValue)((object)value);
|
|
}
|
|
|
|
// Token: 0x04000049 RID: 73
|
|
private RBTree tree;
|
|
|
|
// Token: 0x0400004A RID: 74
|
|
private SortedDictionary<TKey, TValue>.NodeHelper hlp;
|
|
|
|
// Token: 0x02000015 RID: 21
|
|
private class Node : RBTree.Node
|
|
{
|
|
// Token: 0x060000AC RID: 172 RVA: 0x000046D4 File Offset: 0x000028D4
|
|
public Node(TKey key)
|
|
{
|
|
this.key = key;
|
|
}
|
|
|
|
// Token: 0x060000AD RID: 173 RVA: 0x000046E4 File Offset: 0x000028E4
|
|
public Node(TKey key, TValue value)
|
|
{
|
|
this.key = key;
|
|
this.value = value;
|
|
}
|
|
|
|
// Token: 0x060000AE RID: 174 RVA: 0x000046FC File Offset: 0x000028FC
|
|
public override void SwapValue(RBTree.Node other)
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node = (SortedDictionary<TKey, TValue>.Node)other;
|
|
TKey tkey = this.key;
|
|
this.key = node.key;
|
|
node.key = tkey;
|
|
TValue tvalue = this.value;
|
|
this.value = node.value;
|
|
node.value = tvalue;
|
|
}
|
|
|
|
// Token: 0x060000AF RID: 175 RVA: 0x00004744 File Offset: 0x00002944
|
|
public KeyValuePair<TKey, TValue> AsKV()
|
|
{
|
|
return new KeyValuePair<TKey, TValue>(this.key, this.value);
|
|
}
|
|
|
|
// Token: 0x060000B0 RID: 176 RVA: 0x00004758 File Offset: 0x00002958
|
|
public DictionaryEntry AsDE()
|
|
{
|
|
return new DictionaryEntry(this.key, this.value);
|
|
}
|
|
|
|
// Token: 0x0400004B RID: 75
|
|
public TKey key;
|
|
|
|
// Token: 0x0400004C RID: 76
|
|
public TValue value;
|
|
}
|
|
|
|
// Token: 0x02000016 RID: 22
|
|
private class NodeHelper : RBTree.INodeHelper<TKey>
|
|
{
|
|
// Token: 0x060000B1 RID: 177 RVA: 0x00004778 File Offset: 0x00002978
|
|
private NodeHelper(IComparer<TKey> cmp)
|
|
{
|
|
this.cmp = cmp;
|
|
}
|
|
|
|
// Token: 0x060000B3 RID: 179 RVA: 0x0000479C File Offset: 0x0000299C
|
|
public int Compare(TKey key, RBTree.Node node)
|
|
{
|
|
return this.cmp.Compare(key, ((SortedDictionary<TKey, TValue>.Node)node).key);
|
|
}
|
|
|
|
// Token: 0x060000B4 RID: 180 RVA: 0x000047B8 File Offset: 0x000029B8
|
|
public RBTree.Node CreateNode(TKey key)
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.Node(key);
|
|
}
|
|
|
|
// Token: 0x060000B5 RID: 181 RVA: 0x000047C0 File Offset: 0x000029C0
|
|
public static SortedDictionary<TKey, TValue>.NodeHelper GetHelper(IComparer<TKey> cmp)
|
|
{
|
|
if (cmp == null || cmp == Comparer<TKey>.Default)
|
|
{
|
|
return SortedDictionary<TKey, TValue>.NodeHelper.Default;
|
|
}
|
|
return new SortedDictionary<TKey, TValue>.NodeHelper(cmp);
|
|
}
|
|
|
|
// Token: 0x0400004D RID: 77
|
|
public IComparer<TKey> cmp;
|
|
|
|
// Token: 0x0400004E RID: 78
|
|
private static SortedDictionary<TKey, TValue>.NodeHelper Default = new SortedDictionary<TKey, TValue>.NodeHelper(Comparer<TKey>.Default);
|
|
}
|
|
|
|
/// <summary>Represents the collection of values in a <see cref="T:System.Collections.Generic.SortedDictionary`2" />. This class cannot be inherited.</summary>
|
|
// Token: 0x02000017 RID: 23
|
|
[Serializable]
|
|
public sealed class ValueCollection : ICollection, IEnumerable, ICollection<TValue>, IEnumerable<TValue>
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> class that reflects the values in the specified <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.SortedDictionary`2" /> whose values are reflected in the new <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="dictionary" /> is null.</exception>
|
|
// Token: 0x060000B6 RID: 182 RVA: 0x000047E0 File Offset: 0x000029E0
|
|
public ValueCollection(SortedDictionary<TKey, TValue> dic)
|
|
{
|
|
this._dic = dic;
|
|
}
|
|
|
|
// Token: 0x060000B7 RID: 183 RVA: 0x000047F0 File Offset: 0x000029F0
|
|
void ICollection<TValue>.Add(TValue item)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x060000B8 RID: 184 RVA: 0x000047F8 File Offset: 0x000029F8
|
|
void ICollection<TValue>.Clear()
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x060000B9 RID: 185 RVA: 0x00004800 File Offset: 0x00002A00
|
|
bool ICollection<TValue>.Contains(TValue item)
|
|
{
|
|
return this._dic.ContainsValue(item);
|
|
}
|
|
|
|
// Token: 0x1700002A RID: 42
|
|
// (get) Token: 0x060000BA RID: 186 RVA: 0x00004810 File Offset: 0x00002A10
|
|
bool ICollection<TValue>.IsReadOnly
|
|
{
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000BB RID: 187 RVA: 0x00004814 File Offset: 0x00002A14
|
|
bool ICollection<TValue>.Remove(TValue item)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x060000BC RID: 188 RVA: 0x0000481C File Offset: 0x00002A1C
|
|
IEnumerator<TValue> IEnumerable<TValue>.GetEnumerator()
|
|
{
|
|
return this.GetEnumerator();
|
|
}
|
|
|
|
/// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an array, starting at a particular array index.</summary>
|
|
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.ICollection" />. The array must have zero-based indexing.</param>
|
|
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="array" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="index" /> is less than 0.</exception>
|
|
/// <exception cref="T:System.ArgumentException">
|
|
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
|
|
// Token: 0x060000BD RID: 189 RVA: 0x0000482C File Offset: 0x00002A2C
|
|
void ICollection.CopyTo(Array array, int index)
|
|
{
|
|
if (this.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (array == null)
|
|
{
|
|
throw new ArgumentNullException();
|
|
}
|
|
if (index < 0 || array.Length <= index)
|
|
{
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
if (array.Length - index < this.Count)
|
|
{
|
|
throw new ArgumentException();
|
|
}
|
|
foreach (RBTree.Node node in this._dic.tree)
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
|
|
array.SetValue(node2.value, index++);
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
|
|
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />, this property always returns false.</returns>
|
|
// Token: 0x1700002B RID: 43
|
|
// (get) Token: 0x060000BE RID: 190 RVA: 0x000048F8 File Offset: 0x00002AF8
|
|
bool ICollection.IsSynchronized
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
|
|
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />, this property always returns the current instance.</returns>
|
|
// Token: 0x1700002C RID: 44
|
|
// (get) Token: 0x060000BF RID: 191 RVA: 0x000048FC File Offset: 0x00002AFC
|
|
object ICollection.SyncRoot
|
|
{
|
|
get
|
|
{
|
|
return this._dic;
|
|
}
|
|
}
|
|
|
|
/// <summary>Returns an enumerator that iterates through the collection.</summary>
|
|
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
|
|
// Token: 0x060000C0 RID: 192 RVA: 0x00004904 File Offset: 0x00002B04
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.ValueCollection.Enumerator(this._dic);
|
|
}
|
|
|
|
/// <summary>Copies the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> elements to an existing one-dimensional array, starting at the specified array index.</summary>
|
|
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />. The array must have zero-based indexing.</param>
|
|
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="array" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="index" /> is less than 0.</exception>
|
|
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
|
|
// Token: 0x060000C1 RID: 193 RVA: 0x00004918 File Offset: 0x00002B18
|
|
public void CopyTo(TValue[] array, int arrayIndex)
|
|
{
|
|
if (this.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (array == null)
|
|
{
|
|
throw new ArgumentNullException();
|
|
}
|
|
if (arrayIndex < 0 || array.Length <= arrayIndex)
|
|
{
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
if (array.Length - arrayIndex < this.Count)
|
|
{
|
|
throw new ArgumentException();
|
|
}
|
|
foreach (RBTree.Node node in this._dic.tree)
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
|
|
array[arrayIndex++] = node2.value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</summary>
|
|
/// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</returns>
|
|
// Token: 0x1700002D RID: 45
|
|
// (get) Token: 0x060000C2 RID: 194 RVA: 0x000049D8 File Offset: 0x00002BD8
|
|
public int Count
|
|
{
|
|
get
|
|
{
|
|
return this._dic.Count;
|
|
}
|
|
}
|
|
|
|
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</summary>
|
|
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection.Enumerator" /> structure for the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</returns>
|
|
// Token: 0x060000C3 RID: 195 RVA: 0x000049E8 File Offset: 0x00002BE8
|
|
public SortedDictionary<TKey, TValue>.ValueCollection.Enumerator GetEnumerator()
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.ValueCollection.Enumerator(this._dic);
|
|
}
|
|
|
|
// Token: 0x0400004F RID: 79
|
|
private SortedDictionary<TKey, TValue> _dic;
|
|
|
|
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</summary>
|
|
// Token: 0x02000018 RID: 24
|
|
public struct Enumerator : IEnumerator, IDisposable, IEnumerator<TValue>
|
|
{
|
|
// Token: 0x060000C4 RID: 196 RVA: 0x000049F8 File Offset: 0x00002BF8
|
|
internal Enumerator(SortedDictionary<TKey, TValue> dic)
|
|
{
|
|
this.host = dic.tree.GetEnumerator();
|
|
}
|
|
|
|
/// <summary>Gets the element at the current position of the enumerator.</summary>
|
|
/// <returns>The element in the collection at the current position of the enumerator.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
|
// Token: 0x1700002E RID: 46
|
|
// (get) Token: 0x060000C5 RID: 197 RVA: 0x00004A0C File Offset: 0x00002C0C
|
|
object IEnumerator.Current
|
|
{
|
|
get
|
|
{
|
|
this.host.check_current();
|
|
return this.current;
|
|
}
|
|
}
|
|
|
|
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
|
|
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
|
// Token: 0x060000C6 RID: 198 RVA: 0x00004A24 File Offset: 0x00002C24
|
|
void IEnumerator.Reset()
|
|
{
|
|
this.host.Reset();
|
|
}
|
|
|
|
/// <summary>Gets the element at the current position of the enumerator.</summary>
|
|
/// <returns>The element in the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" /> at the current position of the enumerator.</returns>
|
|
// Token: 0x1700002F RID: 47
|
|
// (get) Token: 0x060000C7 RID: 199 RVA: 0x00004A34 File Offset: 0x00002C34
|
|
public TValue Current
|
|
{
|
|
get
|
|
{
|
|
return this.current;
|
|
}
|
|
}
|
|
|
|
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection" />.</summary>
|
|
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
|
// Token: 0x060000C8 RID: 200 RVA: 0x00004A3C File Offset: 0x00002C3C
|
|
public bool MoveNext()
|
|
{
|
|
if (!this.host.MoveNext())
|
|
{
|
|
return false;
|
|
}
|
|
this.current = ((SortedDictionary<TKey, TValue>.Node)this.host.Current).value;
|
|
return true;
|
|
}
|
|
|
|
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.SortedDictionary`2.ValueCollection.Enumerator" />.</summary>
|
|
// Token: 0x060000C9 RID: 201 RVA: 0x00004A78 File Offset: 0x00002C78
|
|
public void Dispose()
|
|
{
|
|
this.host.Dispose();
|
|
}
|
|
|
|
// Token: 0x04000050 RID: 80
|
|
private RBTree.NodeEnumerator host;
|
|
|
|
// Token: 0x04000051 RID: 81
|
|
private TValue current;
|
|
}
|
|
}
|
|
|
|
/// <summary>Represents the collection of keys in a <see cref="T:System.Collections.Generic.SortedDictionary`2" />. This class cannot be inherited. </summary>
|
|
// Token: 0x02000019 RID: 25
|
|
[Serializable]
|
|
public sealed class KeyCollection : ICollection, IEnumerable, ICollection<TKey>, IEnumerable<TKey>
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> class that reflects the keys in the specified <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <param name="dictionary">The <see cref="T:System.Collections.Generic.SortedDictionary`2" /> whose keys are reflected in the new <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="dictionary" /> is null.</exception>
|
|
// Token: 0x060000CA RID: 202 RVA: 0x00004A88 File Offset: 0x00002C88
|
|
public KeyCollection(SortedDictionary<TKey, TValue> dic)
|
|
{
|
|
this._dic = dic;
|
|
}
|
|
|
|
// Token: 0x060000CB RID: 203 RVA: 0x00004A98 File Offset: 0x00002C98
|
|
void ICollection<TKey>.Add(TKey item)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x060000CC RID: 204 RVA: 0x00004AA0 File Offset: 0x00002CA0
|
|
void ICollection<TKey>.Clear()
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
// Token: 0x060000CD RID: 205 RVA: 0x00004AA8 File Offset: 0x00002CA8
|
|
bool ICollection<TKey>.Contains(TKey item)
|
|
{
|
|
return this._dic.ContainsKey(item);
|
|
}
|
|
|
|
// Token: 0x060000CE RID: 206 RVA: 0x00004AB8 File Offset: 0x00002CB8
|
|
IEnumerator<TKey> IEnumerable<TKey>.GetEnumerator()
|
|
{
|
|
return this.GetEnumerator();
|
|
}
|
|
|
|
// Token: 0x17000030 RID: 48
|
|
// (get) Token: 0x060000CF RID: 207 RVA: 0x00004AC8 File Offset: 0x00002CC8
|
|
bool ICollection<TKey>.IsReadOnly
|
|
{
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060000D0 RID: 208 RVA: 0x00004ACC File Offset: 0x00002CCC
|
|
bool ICollection<TKey>.Remove(TKey item)
|
|
{
|
|
throw new NotSupportedException();
|
|
}
|
|
|
|
/// <summary>Copies the elements of the <see cref="T:System.Collections.ICollection" /> to an array, starting at a particular array index.</summary>
|
|
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.ICollection" />. The array must have zero-based indexing.</param>
|
|
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="array" /> is null.</exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="index" /> is less than 0.</exception>
|
|
/// <exception cref="T:System.ArgumentException">
|
|
/// <paramref name="array" /> is multidimensional.-or-<paramref name="array" /> does not have zero-based indexing.-or-The number of elements in the source <see cref="T:System.Collections.ICollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.-or-The type of the source <see cref="T:System.Collections.ICollection" /> cannot be cast automatically to the type of the destination <paramref name="array" />.</exception>
|
|
// Token: 0x060000D1 RID: 209 RVA: 0x00004AD4 File Offset: 0x00002CD4
|
|
void ICollection.CopyTo(Array array, int index)
|
|
{
|
|
if (this.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (array == null)
|
|
{
|
|
throw new ArgumentNullException();
|
|
}
|
|
if (index < 0 || array.Length <= index)
|
|
{
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
if (array.Length - index < this.Count)
|
|
{
|
|
throw new ArgumentException();
|
|
}
|
|
foreach (RBTree.Node node in this._dic.tree)
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
|
|
array.SetValue(node2.key, index++);
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets a value indicating whether access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe).</summary>
|
|
/// <returns>true if access to the <see cref="T:System.Collections.ICollection" /> is synchronized (thread safe); otherwise, false. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />, this property always returns false.</returns>
|
|
// Token: 0x17000031 RID: 49
|
|
// (get) Token: 0x060000D2 RID: 210 RVA: 0x00004BA0 File Offset: 0x00002DA0
|
|
bool ICollection.IsSynchronized
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets an object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />.</summary>
|
|
/// <returns>An object that can be used to synchronize access to the <see cref="T:System.Collections.ICollection" />. In the default implementation of <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />, this property always returns the current instance.</returns>
|
|
// Token: 0x17000032 RID: 50
|
|
// (get) Token: 0x060000D3 RID: 211 RVA: 0x00004BA4 File Offset: 0x00002DA4
|
|
object ICollection.SyncRoot
|
|
{
|
|
get
|
|
{
|
|
return this._dic;
|
|
}
|
|
}
|
|
|
|
/// <summary>Returns an enumerator that iterates through the collection.</summary>
|
|
/// <returns>An <see cref="T:System.Collections.IEnumerator" /> that can be used to iterate through the collection.</returns>
|
|
// Token: 0x060000D4 RID: 212 RVA: 0x00004BAC File Offset: 0x00002DAC
|
|
IEnumerator IEnumerable.GetEnumerator()
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.KeyCollection.Enumerator(this._dic);
|
|
}
|
|
|
|
/// <summary>Copies the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> elements to an existing one-dimensional array, starting at the specified array index.</summary>
|
|
/// <param name="array">The one-dimensional array that is the destination of the elements copied from the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />. The array must have zero-based indexing.</param>
|
|
/// <param name="index">The zero-based index in <paramref name="array" /> at which copying begins.</param>
|
|
/// <exception cref="T:System.ArgumentNullException">
|
|
/// <paramref name="array" /> is null. </exception>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
|
/// <paramref name="index" /> is less than 0.</exception>
|
|
/// <exception cref="T:System.ArgumentException">The number of elements in the source <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> is greater than the available space from <paramref name="index" /> to the end of the destination <paramref name="array" />.</exception>
|
|
// Token: 0x060000D5 RID: 213 RVA: 0x00004BC0 File Offset: 0x00002DC0
|
|
public void CopyTo(TKey[] array, int arrayIndex)
|
|
{
|
|
if (this.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (array == null)
|
|
{
|
|
throw new ArgumentNullException();
|
|
}
|
|
if (arrayIndex < 0 || array.Length <= arrayIndex)
|
|
{
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
if (array.Length - arrayIndex < this.Count)
|
|
{
|
|
throw new ArgumentException();
|
|
}
|
|
foreach (RBTree.Node node in this._dic.tree)
|
|
{
|
|
SortedDictionary<TKey, TValue>.Node node2 = (SortedDictionary<TKey, TValue>.Node)node;
|
|
array[arrayIndex++] = node2.key;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the number of elements contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</summary>
|
|
/// <returns>The number of elements contained in the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</returns>
|
|
// Token: 0x17000033 RID: 51
|
|
// (get) Token: 0x060000D6 RID: 214 RVA: 0x00004C80 File Offset: 0x00002E80
|
|
public int Count
|
|
{
|
|
get
|
|
{
|
|
return this._dic.Count;
|
|
}
|
|
}
|
|
|
|
/// <summary>Returns an enumerator that iterates through the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</summary>
|
|
/// <returns>A <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection.Enumerator" /> structure for the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</returns>
|
|
// Token: 0x060000D7 RID: 215 RVA: 0x00004C90 File Offset: 0x00002E90
|
|
public SortedDictionary<TKey, TValue>.KeyCollection.Enumerator GetEnumerator()
|
|
{
|
|
return new SortedDictionary<TKey, TValue>.KeyCollection.Enumerator(this._dic);
|
|
}
|
|
|
|
// Token: 0x04000052 RID: 82
|
|
private SortedDictionary<TKey, TValue> _dic;
|
|
|
|
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</summary>
|
|
// Token: 0x0200001A RID: 26
|
|
public struct Enumerator : IEnumerator, IDisposable, IEnumerator<TKey>
|
|
{
|
|
// Token: 0x060000D8 RID: 216 RVA: 0x00004CA0 File Offset: 0x00002EA0
|
|
internal Enumerator(SortedDictionary<TKey, TValue> dic)
|
|
{
|
|
this.host = dic.tree.GetEnumerator();
|
|
}
|
|
|
|
/// <summary>Gets the element at the current position of the enumerator.</summary>
|
|
/// <returns>The element in the collection at the current position of the enumerator.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
|
// Token: 0x17000034 RID: 52
|
|
// (get) Token: 0x060000D9 RID: 217 RVA: 0x00004CB4 File Offset: 0x00002EB4
|
|
object IEnumerator.Current
|
|
{
|
|
get
|
|
{
|
|
this.host.check_current();
|
|
return this.current;
|
|
}
|
|
}
|
|
|
|
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
|
|
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
|
// Token: 0x060000DA RID: 218 RVA: 0x00004CCC File Offset: 0x00002ECC
|
|
void IEnumerator.Reset()
|
|
{
|
|
this.host.Reset();
|
|
}
|
|
|
|
/// <summary>Gets the element at the current position of the enumerator.</summary>
|
|
/// <returns>The element in the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" /> at the current position of the enumerator.</returns>
|
|
// Token: 0x17000035 RID: 53
|
|
// (get) Token: 0x060000DB RID: 219 RVA: 0x00004CDC File Offset: 0x00002EDC
|
|
public TKey Current
|
|
{
|
|
get
|
|
{
|
|
return this.current;
|
|
}
|
|
}
|
|
|
|
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection" />.</summary>
|
|
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
|
// Token: 0x060000DC RID: 220 RVA: 0x00004CE4 File Offset: 0x00002EE4
|
|
public bool MoveNext()
|
|
{
|
|
if (!this.host.MoveNext())
|
|
{
|
|
return false;
|
|
}
|
|
this.current = ((SortedDictionary<TKey, TValue>.Node)this.host.Current).key;
|
|
return true;
|
|
}
|
|
|
|
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.SortedDictionary`2.KeyCollection.Enumerator" />.</summary>
|
|
// Token: 0x060000DD RID: 221 RVA: 0x00004D20 File Offset: 0x00002F20
|
|
public void Dispose()
|
|
{
|
|
this.host.Dispose();
|
|
}
|
|
|
|
// Token: 0x04000053 RID: 83
|
|
private RBTree.NodeEnumerator host;
|
|
|
|
// Token: 0x04000054 RID: 84
|
|
private TKey current;
|
|
}
|
|
}
|
|
|
|
/// <summary>Enumerates the elements of a <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
// Token: 0x0200001B RID: 27
|
|
public struct Enumerator : IEnumerator, IDisposable, IEnumerator<KeyValuePair<TKey, TValue>>, IDictionaryEnumerator
|
|
{
|
|
// Token: 0x060000DE RID: 222 RVA: 0x00004D30 File Offset: 0x00002F30
|
|
internal Enumerator(SortedDictionary<TKey, TValue> dic)
|
|
{
|
|
this.host = dic.tree.GetEnumerator();
|
|
}
|
|
|
|
/// <summary>Gets the element at the current position of the enumerator as a <see cref="T:System.Collections.DictionaryEntry" /> structure.</summary>
|
|
/// <returns>The element in the collection at the current position of the dictionary, as a <see cref="T:System.Collections.DictionaryEntry" /> structure.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
|
// Token: 0x17000036 RID: 54
|
|
// (get) Token: 0x060000DF RID: 223 RVA: 0x00004D44 File Offset: 0x00002F44
|
|
DictionaryEntry IDictionaryEnumerator.Entry
|
|
{
|
|
get
|
|
{
|
|
return this.CurrentNode.AsDE();
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the key of the element at the current position of the enumerator.</summary>
|
|
/// <returns>The key of the element in the collection at the current position of the enumerator.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
|
// Token: 0x17000037 RID: 55
|
|
// (get) Token: 0x060000E0 RID: 224 RVA: 0x00004D54 File Offset: 0x00002F54
|
|
object IDictionaryEnumerator.Key
|
|
{
|
|
get
|
|
{
|
|
return this.CurrentNode.key;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the value of the element at the current position of the enumerator.</summary>
|
|
/// <returns>The value of the element in the collection at the current position of the enumerator.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
|
// Token: 0x17000038 RID: 56
|
|
// (get) Token: 0x060000E1 RID: 225 RVA: 0x00004D68 File Offset: 0x00002F68
|
|
object IDictionaryEnumerator.Value
|
|
{
|
|
get
|
|
{
|
|
return this.CurrentNode.value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the element at the current position of the enumerator.</summary>
|
|
/// <returns>The element in the collection at the current position of the enumerator.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The enumerator is positioned before the first element of the collection or after the last element. </exception>
|
|
// Token: 0x17000039 RID: 57
|
|
// (get) Token: 0x060000E2 RID: 226 RVA: 0x00004D7C File Offset: 0x00002F7C
|
|
object IEnumerator.Current
|
|
{
|
|
get
|
|
{
|
|
return this.CurrentNode.AsDE();
|
|
}
|
|
}
|
|
|
|
/// <summary>Sets the enumerator to its initial position, which is before the first element in the collection.</summary>
|
|
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
|
// Token: 0x060000E3 RID: 227 RVA: 0x00004D90 File Offset: 0x00002F90
|
|
void IEnumerator.Reset()
|
|
{
|
|
this.host.Reset();
|
|
}
|
|
|
|
/// <summary>Gets the element at the current position of the enumerator.</summary>
|
|
/// <returns>The element in the <see cref="T:System.Collections.Generic.SortedDictionary`2" /> at the current position of the enumerator.</returns>
|
|
// Token: 0x1700003A RID: 58
|
|
// (get) Token: 0x060000E4 RID: 228 RVA: 0x00004DA0 File Offset: 0x00002FA0
|
|
public KeyValuePair<TKey, TValue> Current
|
|
{
|
|
get
|
|
{
|
|
return this.current;
|
|
}
|
|
}
|
|
|
|
/// <summary>Advances the enumerator to the next element of the <see cref="T:System.Collections.Generic.SortedDictionary`2" />.</summary>
|
|
/// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns>
|
|
/// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception>
|
|
// Token: 0x060000E5 RID: 229 RVA: 0x00004DA8 File Offset: 0x00002FA8
|
|
public bool MoveNext()
|
|
{
|
|
if (!this.host.MoveNext())
|
|
{
|
|
return false;
|
|
}
|
|
this.current = ((SortedDictionary<TKey, TValue>.Node)this.host.Current).AsKV();
|
|
return true;
|
|
}
|
|
|
|
/// <summary>Releases all resources used by the <see cref="T:System.Collections.Generic.SortedDictionary`2.Enumerator" />.</summary>
|
|
// Token: 0x060000E6 RID: 230 RVA: 0x00004DE4 File Offset: 0x00002FE4
|
|
public void Dispose()
|
|
{
|
|
this.host.Dispose();
|
|
}
|
|
|
|
// Token: 0x1700003B RID: 59
|
|
// (get) Token: 0x060000E7 RID: 231 RVA: 0x00004DF4 File Offset: 0x00002FF4
|
|
private SortedDictionary<TKey, TValue>.Node CurrentNode
|
|
{
|
|
get
|
|
{
|
|
this.host.check_current();
|
|
return (SortedDictionary<TKey, TValue>.Node)this.host.Current;
|
|
}
|
|
}
|
|
|
|
// Token: 0x04000055 RID: 85
|
|
private RBTree.NodeEnumerator host;
|
|
|
|
// Token: 0x04000056 RID: 86
|
|
private KeyValuePair<TKey, TValue> current;
|
|
}
|
|
}
|
|
}
|