private XPathNodeInfoAtom Atomize(XPathNodeInfoAtom info) { XPathNodeInfoAtom next = this.hashTable[info.GetHashCode() & (this.hashTable.Length - 1)]; while (next != null) { if (info.Equals(next)) { info.Next = this.infoCached; this.infoCached = info; return next; } next = next.Next; } if (this.sizeTable >= this.hashTable.Length) { XPathNodeInfoAtom[] hashTable = this.hashTable; this.hashTable = new XPathNodeInfoAtom[hashTable.Length * 2]; for (int i = 0; i < hashTable.Length; i++) { XPathNodeInfoAtom atom2; for (next = hashTable[i]; next != null; next = atom2) { atom2 = next.Next; this.AddInfo(next); } } } this.AddInfo(info); return info; }
private XPathNodeInfoAtom Atomize(XPathNodeInfoAtom info) { XPathNodeInfoAtom next = this.hashTable[info.GetHashCode() & (this.hashTable.Length - 1)]; while (next != null) { if (info.Equals(next)) { info.Next = this.infoCached; this.infoCached = info; return(next); } next = next.Next; } if (this.sizeTable >= this.hashTable.Length) { XPathNodeInfoAtom[] hashTable = this.hashTable; this.hashTable = new XPathNodeInfoAtom[hashTable.Length * 2]; for (int i = 0; i < hashTable.Length; i++) { XPathNodeInfoAtom atom2; for (next = hashTable[i]; next != null; next = atom2) { atom2 = next.Next; this.AddInfo(next); } } } this.AddInfo(info); return(info); }
/// <summary> /// Add a shared information item to the atomization table. If a matching item already exists, then that /// instance is returned. Otherwise, a new item is created. Thus, if itemX and itemY have both been added /// to the same InfoTable: /// 1. itemX.Equals(itemY) != true /// 2. (object) itemX != (object) itemY /// </summary> private XPathNodeInfoAtom Atomize(XPathNodeInfoAtom info) { XPathNodeInfoAtom infoNew, infoNext; // Search for existing XNodeInfoAtom in the table infoNew = this.hashTable[info.GetHashCode() & (this.hashTable.Length - 1)]; while (infoNew != null) { if (info.Equals(infoNew)) { // Found existing atom, so return that. Reuse "info". info.Next = this.infoCached; this.infoCached = info; return(infoNew); } infoNew = infoNew.Next; } // Expand table and rehash if necessary if (this.sizeTable >= this.hashTable.Length) { XPathNodeInfoAtom[] oldTable = this.hashTable; this.hashTable = new XPathNodeInfoAtom[oldTable.Length * 2]; for (int i = 0; i < oldTable.Length; i++) { infoNew = oldTable[i]; while (infoNew != null) { infoNext = infoNew.Next; AddInfo(infoNew); infoNew = infoNext; } } } // Can't find an existing XNodeInfoAtom, so use the one that was passed in AddInfo(info); return(info); }
/// <summary> /// Add a shared information item to the atomization table. If a matching item already exists, then that /// instance is returned. Otherwise, a new item is created. Thus, if itemX and itemY have both been added /// to the same InfoTable: /// 1. itemX.Equals(itemY) != true /// 2. (object) itemX != (object) itemY /// </summary> private XPathNodeInfoAtom Atomize(XPathNodeInfoAtom info) { XPathNodeInfoAtom infoNew, infoNext; // Search for existing XNodeInfoAtom in the table infoNew = this.hashTable[info.GetHashCode() & (this.hashTable.Length - 1)]; while (infoNew != null) { if (info.Equals(infoNew)) { // Found existing atom, so return that. Reuse "info". info.Next = this.infoCached; this.infoCached = info; return infoNew; } infoNew = infoNew.Next; } // Expand table and rehash if necessary if (this.sizeTable >= this.hashTable.Length) { XPathNodeInfoAtom[] oldTable = this.hashTable; this.hashTable = new XPathNodeInfoAtom[oldTable.Length * 2]; for (int i = 0; i < oldTable.Length; i++) { infoNew = oldTable[i]; while (infoNew != null) { infoNext = infoNew.Next; AddInfo(infoNew); infoNew = infoNext; } } } // Can't find an existing XNodeInfoAtom, so use the one that was passed in AddInfo(info); return info; }