4 [global::__DynamicallyInvokable]
11 internal int hashCode;
15 internal Entry(
string str,
int hashCode, Entry next)
18 this.hashCode = hashCode;
23 private Entry[] entries;
29 private int hashCodeRandomizer;
32 [global::__DynamicallyInvokable]
36 entries =
new Entry[mask + 1];
45 [global::__DynamicallyInvokable]
46 public override string Add(
string key)
52 int length = key.Length;
57 int num = length + hashCodeRandomizer;
58 for (
int i = 0; i < key.Length; i++)
60 num += ((num << 7) ^ key[i]);
65 for (Entry entry = entries[num & mask]; entry !=
null; entry = entry.next)
67 if (entry.hashCode == num && entry.str.Equals(key))
72 return AddEntry(key, num);
85 [global::__DynamicallyInvokable]
86 public override string Add(
char[] key,
int start,
int len)
92 int num = len + hashCodeRandomizer;
93 num += ((num << 7) ^ key[start]);
94 int num2 = start + len;
95 for (
int i = start + 1; i < num2; i++)
97 num += ((num << 7) ^ key[i]);
102 for (Entry entry = entries[num & mask]; entry !=
null; entry = entry.next)
104 if (entry.hashCode == num && TextEquals(entry.str, key, start, len))
109 return AddEntry(
new string(key, start, len), num);
117 [global::__DynamicallyInvokable]
118 public override string Get(
string value)
124 if (value.Length == 0)
128 int num = value.Length + hashCodeRandomizer;
130 for (
int i = 0; i < value.Length; i++)
132 num2 += ((num2 << 7) ^ value[i]);
137 for (Entry entry = entries[num2 & mask]; entry !=
null; entry = entry.next)
139 if (entry.hashCode == num2 && entry.str.Equals(value))
157 [global::__DynamicallyInvokable]
158 public override string Get(
char[] key,
int start,
int len)
164 int num = len + hashCodeRandomizer;
165 num += ((num << 7) ^ key[start]);
166 int num2 = start + len;
167 for (
int i = start + 1; i < num2; i++)
169 num += ((num << 7) ^ key[i]);
174 for (Entry entry = entries[num & mask]; entry !=
null; entry = entry.next)
176 if (entry.hashCode == num && TextEquals(entry.str, key, start, len))
184 private string AddEntry(
string str,
int hashCode)
186 int num = hashCode & mask;
187 Entry entry =
new Entry(str, hashCode, entries[num]);
188 entries[num] = entry;
198 int num = mask * 2 + 1;
199 Entry[] array = entries;
200 Entry[] array2 =
new Entry[num + 1];
201 for (
int i = 0; i < array.Length; i++)
204 for (Entry entry = array[i]; entry !=
null; entry = next)
206 int num2 = entry.hashCode & num;
208 entry.next = array2[num2];
209 array2[num2] = entry;
216 private static bool TextEquals(
string str1,
char[] str2,
int str2Start,
int str2Length)
218 if (str1.Length != str2Length)
222 for (
int i = 0; i < str1.Length; i++)
224 if (str1[i] != str2[str2Start + i])
NameTable()
Initializes a new instance of the NameTable class.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
override string Get(char[] key, int start, int len)
Gets the atomized string containing the same characters as the specified range of characters in the g...
override string Add(string key)
Atomizes the specified string and adds it to the NameTable.
override string Add(char[] key, int start, int len)
Atomizes the specified string and adds it to the NameTable.
Provides information about, and means to manipulate, the current environment and platform....
Implements a single-threaded T:System.Xml.XmlNameTable.
static int TickCount
Gets the number of milliseconds elapsed since the system started.
Table of atomized string objects.
override string Get(string value)
Gets the atomized string with the specified value.