GetHashCode() public method

Return this information atom's hash code, previously computed for performance.
public GetHashCode ( ) : int
return int
Ejemplo n.º 1
0
        /// <summary>
        /// Return true if this InfoAtom has the same values as another InfoAtom.
        /// </summary>
        public override bool Equals(object other)
        {
            XPathNodeInfoAtom that = other as XPathNodeInfoAtom;

            Debug.Assert(that != null);
            Debug.Assert((object)this.doc == (object)that.doc);
            Debug.Assert(this.pageInfo == null);

            // Assume that name parts are atomized
            if (this.GetHashCode() == that.GetHashCode())
            {
                if ((object)this.localName == (object)that.localName &&
                    (object)this.pageSibling == (object)that.pageSibling &&
                    (object)this.namespaceUri == (object)that.namespaceUri &&
                    (object)this.pageParent == (object)that.pageParent &&
                    (object)this.pageSimilar == (object)that.pageSimilar &&
                    (object)this.prefix == (object)that.prefix &&
                    (object)this.baseUri == (object)that.baseUri &&
                    this.lineNumBase == that.lineNumBase &&
                    this.linePosBase == that.linePosBase)
                {
                    return(true);
                }
            }
            return(false);
        }
 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 void AddInfo(XPathNodeInfoAtom info)
 {
     int index = info.GetHashCode() & (this.hashTable.Length - 1);
     info.Next = this.hashTable[index];
     this.hashTable[index] = info;
     this.sizeTable++;
 }
        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);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Add a previously constructed InfoAtom to the table.  If a collision occurs, then insert "info"
        /// as the head of a linked list.
        /// </summary>
        private void AddInfo(XPathNodeInfoAtom info)
        {
            int idx = info.GetHashCode() & (this.hashTable.Length - 1);

            info.Next           = this.hashTable[idx];
            this.hashTable[idx] = info;
            this.sizeTable++;
        }
Ejemplo n.º 6
0
        /// <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;
        }
        public override bool Equals(object other)
        {
            XPathNodeInfoAtom atom = other as XPathNodeInfoAtom;

            return(((((this.GetHashCode() == atom.GetHashCode()) && (this.localName == atom.localName)) && ((this.pageSibling == atom.pageSibling) && (this.namespaceUri == atom.namespaceUri))) && (((this.pageParent == atom.pageParent) && (this.pageSimilar == atom.pageSimilar)) && ((this.prefix == atom.prefix) && (this.baseUri == atom.baseUri)))) && ((this.lineNumBase == atom.lineNumBase) && (this.linePosBase == atom.linePosBase)));
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Add a previously constructed InfoAtom to the table.  If a collision occurs, then insert "info"
 /// as the head of a linked list.
 /// </summary>
 private void AddInfo(XPathNodeInfoAtom info)
 {
     int idx = info.GetHashCode() & (_hashTable.Length - 1);
     info.Next = _hashTable[idx];
     _hashTable[idx] = info;
     _sizeTable++;
 }