public bool MoveNext() { HashtableEntry[] table = this.table; if (this.currentEntry != null) { this.currentEntry = this.currentEntry.next; if (this.currentEntry != null) { return(true); } } int index = ++this.index; int count = this.count; while (index < count) { if (table[index] != null) { this.index = index; this.currentEntry = table[index]; return(true); } index++; } return(false); }
public bool MoveNext() { HashtableEntry[] table = this.table; if (this.currentEntry != null) { this.currentEntry = this.currentEntry.next; if (this.currentEntry != null) { return true; } } int index = ++this.index; int count = this.count; while (index < count) { if (table[index] != null) { this.index = index; this.currentEntry = table[index]; return true; } index++; } return false; }
public void Remove(Object key) { uint hashCode = (uint)key.GetHashCode(); int index = (int)(hashCode % (uint)this.table.Length); HashtableEntry e = this.table[index]; Debug.Assert(e != null); this.count--; while (e != null && e.hashCode == hashCode && (e.key == key || e.key.Equals(key))) { e = e.next; } this.table[index] = e; do { if (e == null) { return; } HashtableEntry f = e.next; while (f != null && f.hashCode == hashCode && (f.key == key || f.key.Equals(key))) { f = f.next; } e.next = f; e = f; }while(true); }
private HashtableEntry GetHashtableEntry(object key, uint hashCode) { int index = (int)(hashCode % this.table.Length); HashtableEntry entry = this.table[index]; if (entry != null) { HashtableEntry entry2; if (entry.key == key) { return(entry); } for (entry2 = entry.next; entry2 != null; entry2 = entry2.next) { if (entry2.key == key) { return(entry2); } } if ((entry.hashCode == hashCode) && entry.key.Equals(key)) { entry.key = key; return(entry); } for (entry2 = entry.next; entry2 != null; entry2 = entry2.next) { if ((entry2.hashCode == hashCode) && entry2.key.Equals(key)) { entry2.key = key; return(entry2); } } } return(null); }
internal SimpleHashtableEnumerator(HashtableEntry[] table) { this.table = table; this.count = table.Length; this.index = -1; this.currentEntry = null; }
public object this[object key] { get { HashtableEntry hashtableEntry = this.GetHashtableEntry(key, (uint)key.GetHashCode()); if (hashtableEntry == null) { return(null); } return(hashtableEntry.value); } set { uint hashCode = (uint)key.GetHashCode(); HashtableEntry hashtableEntry = this.GetHashtableEntry(key, hashCode); if (hashtableEntry != null) { hashtableEntry.value = value; } else { if (++this.count >= this.threshold) { this.Rehash(); } int index = (int)(hashCode % this.table.Length); this.table[index] = new HashtableEntry(key, value, hashCode, this.table[index]); } } }
internal HashtableEntry(Object key, Object value, uint hashCode, HashtableEntry next) { this.key = key; this.value = value; this.hashCode = hashCode; this.next = next; }
internal Object IgnoreCaseGet(String name) { for (uint i = 0, n = (uint)this.table.Length; i < n; i++) { HashtableEntry e = this.table[i]; while (e != null) { if (String.Compare((String)e.key, name, true, CultureInfo.InvariantCulture) == 0) { return(e.value); } e = e.next; } } return(null); }
private void Rehash() { HashtableEntry[] oldTable = this.table; uint threshold = this.threshold = (uint)(oldTable.Length + 1); uint newCapacity = threshold * 2 - 1; HashtableEntry[] newTable = this.table = new HashtableEntry[newCapacity]; for (uint i = threshold - 1; i-- > 0;) { for (HashtableEntry old = oldTable[(int)i]; old != null;) { HashtableEntry e = old; old = old.next; int index = (int)(e.hashCode % newCapacity); e.next = newTable[index]; newTable[index] = e; } } }
internal object IgnoreCaseGet(string name) { uint index = 0; uint length = (uint)this.table.Length; while (index < length) { for (HashtableEntry entry = this.table[index]; entry != null; entry = entry.next) { if (string.Compare((string)entry.key, name, StringComparison.OrdinalIgnoreCase) == 0) { return(entry.value); } } index++; } return(null); }
private HashtableEntry GetHashtableEntry(Object key, uint hashCode) { int index = (int)(hashCode % (uint)this.table.Length); HashtableEntry e = this.table[index]; if (e == null) { return(null); } if (e.key == key) { return(e); } HashtableEntry prev = e; HashtableEntry curr = e.next; while (curr != null) { if (curr.key == key) { return(curr); } prev = curr; curr = curr.next; } if (e.hashCode == hashCode && e.key.Equals(key)) { e.key = key; return(e); } prev = e; curr = e.next; while (curr != null) { if (curr.hashCode == hashCode && curr.key.Equals(key)) { curr.key = key; return(curr); } prev = curr; curr = curr.next; } return(null); }
public bool MoveNext() { HashtableEntry[] table = this.table; if (this.currentEntry != null) { this.currentEntry = this.currentEntry.next; if (this.currentEntry != null) { return(true); } } for (int i = ++this.index, n = this.count; i < n; i++) { if (table[i] != null) { this.index = i; this.currentEntry = table[i]; return(true); } } return(false); }
private void Rehash() { HashtableEntry[] table = this.table; uint num = this.threshold = (uint)(table.Length + 1); uint num2 = (num * 2) - 1; HashtableEntry[] entryArray2 = this.table = new HashtableEntry[num2]; uint index = num - 1; while (index-- > 0) { HashtableEntry next = table[index]; while (next != null) { HashtableEntry entry2 = next; next = next.next; int num4 = (int)(entry2.hashCode % num2); entry2.next = entryArray2[num4]; entryArray2[num4] = entry2; } } }
public void Remove(object key) { uint hashCode = (uint)key.GetHashCode(); int index = (int)(hashCode % this.table.Length); HashtableEntry next = this.table[index]; this.count--; while (((next != null) && (next.hashCode == hashCode)) && ((next.key == key) || next.key.Equals(key))) { next = next.next; } this.table[index] = next; while (next != null) { HashtableEntry entry2 = next.next; while (((entry2 != null) && (entry2.hashCode == hashCode)) && ((entry2.key == key) || entry2.key.Equals(key))) { entry2 = entry2.next; } next.next = entry2; next = entry2; } }
public Object this[Object key] { get{ HashtableEntry e = this.GetHashtableEntry(key, (uint)key.GetHashCode()); if (e == null) { return(null); } return(e.value); } set{ uint hashCode = (uint)key.GetHashCode(); HashtableEntry e = this.GetHashtableEntry(key, hashCode); if (e != null) { e.value = value; return; } if (++this.count >= this.threshold) { this.Rehash(); } int index = (int)(hashCode % (uint)this.table.Length); this.table[index] = new HashtableEntry(key, value, hashCode, this.table[index]); } }
internal HashtableEntry(Object key, Object value, uint hashCode, HashtableEntry next){ this.key = key; this.value = value; this.hashCode = hashCode; this.next = next; }
public void Reset() { this.index = -1; this.currentEntry = null; }
public bool MoveNext(){ HashtableEntry[] table = this.table; if (this.currentEntry != null){ this.currentEntry = this.currentEntry.next; if (this.currentEntry != null) return true; } for (int i = ++this.index, n = this.count; i < n; i++) if (table[i] != null){ this.index = i; this.currentEntry = table[i]; return true; } return false; }
public void Reset(){ this.index = -1; this.currentEntry = null; }