Beispiel #1
0
        ///<summary>
        ///Copy from other node
        ///</summary>
        internal virtual void CopyFrom(RBTreeNodeBase <T, P> z)
        {
            if (z.mLeft != null)
            {
                z.mLeft.mParent = this;
            }
            this.mLeft = z.mLeft;

            if (z.mRight != null)
            {
                z.mRight.mParent = this;
            }
            this.mRight = z.mRight;

            //2) replace z with this in the parent node
            if (z.mParent != null)
            {
                if (z.mParent.mLeft == z)
                {
                    z.mParent.SetLeft(this);
                }
                else
                {
                    z.mParent.SetRight(this);
                }
            }

            this.mColor = z.mColor;
            this.SetParent(z.mParent);
        }
Beispiel #2
0
 /// <summary>
 /// Used by AddTree before reinsertion of the node
 /// </summary>
 internal virtual void ClearRelations()
 {
     mColor  = RBTreeColor.Black;
     mLeft   = null;
     mRight  = null;
     mParent = null;
 }