Example #1
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (base.Equals(obj))
            {
                return(true);
            }

            MemoryIndex otherIndex = obj as MemoryIndex;

            if (otherIndex == null || otherIndex.Length != this.Length)
            {
                return(false);
            }

            if (otherIndex.GetType() != this.GetType() || otherIndex.CallLevel != this.CallLevel)
            {
                return(false);
            }

            for (int x = this.Length - 1; x >= 0; x--)
            {
                if (!this.MemoryPath[x].Equals(otherIndex.MemoryPath[x]))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// Determines whether this index is part of acces path of the other index.
        /// </summary>
        /// <param name="otherIndex">Index of the other.</param>
        /// <returns>True whether this index is prefix of the given one.</returns>
        internal virtual bool IsPrefixOf(MemoryIndex otherIndex)
        {
            if (otherIndex == null || otherIndex.Length < this.Length)
            {
                return(false);
            }

            if (otherIndex.GetType() != this.GetType() || otherIndex.CallLevel != this.CallLevel)
            {
                return(false);
            }

            for (int x = this.Length - 1; x >= 0; x--)
            {
                if (!this.MemoryPath[x].Equals(otherIndex.MemoryPath[x]))
                {
                    return(false);
                }
            }

            return(true);
        }