public IntHashMapEntry(int par1, int par2, object par3Obj, IntHashMapEntry par4IntHashMapEntry) { ValueEntry = par3Obj; NextEntry = par4IntHashMapEntry; HashEntry = par2; SlotHash = par1; }
/// <summary> /// Removes the specified entry from the map and returns it /// </summary> IntHashMapEntry RemoveEntry(int par1) { int i = ComputeHash(par1); int j = GetSlotIndex(i, Slots.Length); IntHashMapEntry inthashmapentry = Slots[j]; IntHashMapEntry inthashmapentry1; IntHashMapEntry inthashmapentry2; for (inthashmapentry1 = inthashmapentry; inthashmapentry1 != null; inthashmapentry1 = inthashmapentry2) { inthashmapentry2 = inthashmapentry1.NextEntry; if (inthashmapentry1.HashEntry == par1) { VersionStamp++; Count--; if (inthashmapentry == inthashmapentry1) { Slots[j] = inthashmapentry2; } else { inthashmapentry.NextEntry = inthashmapentry2; } return(inthashmapentry1); } inthashmapentry = inthashmapentry1; } return(inthashmapentry1); }
/// <summary> /// Removes the specified object from the map and returns it /// </summary> public virtual object RemoveObject(int par1) { KeySet.Remove(par1); IntHashMapEntry inthashmapentry = RemoveEntry(par1); return(inthashmapentry != null ? inthashmapentry.ValueEntry : null); }
/// <summary> /// Copies the hash slots to a new array /// </summary> private void CopyTo(IntHashMapEntry[] par1ArrayOfIntHashMapEntry) { IntHashMapEntry[] ainthashmapentry = Slots; int i = par1ArrayOfIntHashMapEntry.Length; for (int j = 0; j < ainthashmapentry.Length; j++) { IntHashMapEntry inthashmapentry = ainthashmapentry[j]; if (inthashmapentry == null) { continue; } ainthashmapentry[j] = null; do { IntHashMapEntry inthashmapentry1 = inthashmapentry.NextEntry; int k = GetSlotIndex(inthashmapentry.SlotHash, i); inthashmapentry.NextEntry = par1ArrayOfIntHashMapEntry[k]; par1ArrayOfIntHashMapEntry[k] = inthashmapentry; inthashmapentry = inthashmapentry1; }while (inthashmapentry != null); } }
/// <summary> /// Adds an object to a slot /// </summary> private void Insert(int par1, int par2, object par3Obj, int par4) { IntHashMapEntry inthashmapentry = Slots[par4]; Slots[par4] = new IntHashMapEntry(par1, par2, par3Obj, inthashmapentry); if (Count++ >= Threshold) { Grow(2 * Slots.Length); } }
/// <summary> /// Returns the key/object mapping for a given key as a MCHashEntry /// </summary> IntHashMapEntry LookupEntry(int par1) { int i = ComputeHash(par1); for (IntHashMapEntry inthashmapentry = Slots[GetSlotIndex(i, Slots.Length)]; inthashmapentry != null; inthashmapentry = inthashmapentry.NextEntry) { if (inthashmapentry.HashEntry == par1) { return(inthashmapentry); } } return(null); }
/// <summary> /// Adds a key and associated value to this map /// </summary> public virtual void AddKey(int par1, object par2Obj) { KeySet.Add(par1); int i = ComputeHash(par1); int j = GetSlotIndex(i, Slots.Length); for (IntHashMapEntry inthashmapentry = Slots[j]; inthashmapentry != null; inthashmapentry = inthashmapentry.NextEntry) { if (inthashmapentry.HashEntry == par1) { inthashmapentry.ValueEntry = par2Obj; } } VersionStamp++; Insert(i, par1, par2Obj, j); }
/// <summary> /// Increases the number of hash slots /// </summary> private void Grow(int par1) { IntHashMapEntry[] ainthashmapentry = Slots; int i = ainthashmapentry.Length; if (i == 0x40000000) { Threshold = 0x7fffffff; return; } else { IntHashMapEntry[] ainthashmapentry1 = new IntHashMapEntry[par1]; CopyTo(ainthashmapentry1); Slots = ainthashmapentry1; Threshold = (int)((float)par1 * GrowFactor); return; } }
public bool Equals(object par1Obj) { if (!(par1Obj is IntHashMapEntry)) { return(false); } IntHashMapEntry inthashmapentry = (IntHashMapEntry)par1Obj; int? integer = Convert.ToInt32(GetHash()); int? integer1 = Convert.ToInt32(inthashmapentry.GetHash()); if (integer == integer1 || integer != null && integer.Equals(integer1)) { object obj = GetValue(); object obj1 = inthashmapentry.GetValue(); if (obj == obj1 || obj != null && obj.Equals(obj1)) { return(true); } } return(false); }