Example #1
0
 internal RBNodeBase <TKey> this[int direction]
 {
     get
     {
         if (direction == 0)
         {
             throw new ArgumentException(EMDataStructures.RBTree_InvalidNodeDirection, "direction");
         }
         if (direction < 0)
         {
             return(this.Left);
         }
         return(this.Right);
     }
     set
     {
         if (direction == 0)
         {
             throw new ArgumentException(EMDataStructures.RBTree_InvalidNodeDirection, "direction");
         }
         if (direction < 0)
         {
             this.Left = value;
         }
         else
         {
             this.Right = value;
         }
     }
 }
Example #2
0
        public RBNodeBase <TKey> SingleRotation(bool direction)
        {
            RBNodeBase <TKey> base2 = this[!direction];

            this[!direction] = base2[direction];
            base2[direction] = (RBNodeBase <TKey>) this;
            this.Color       = NodeColor.Red;
            base2.Color      = NodeColor.Black;
            return(base2);
        }
Example #3
0
        internal RBNodeBase <TKey> Find(TKey key, IComparer <TKey> keyComparer)
        {
            int num;

            for (RBNodeBase <TKey> base2 = (RBNodeBase <TKey>) this; base2 != null; base2 = base2[num])
            {
                num = keyComparer.Compare(key, base2.Key);
                if (num == 0)
                {
                    return(base2);
                }
            }
            return(null);
        }
Example #4
0
 internal RBNodeBase <TKey> this[bool direction]
 {
     get
     {
         if (direction)
         {
             return(this.Right);
         }
         return(this.Left);
     }
     set
     {
         if (direction)
         {
             this.Right = value;
         }
         else
         {
             this.Left = value;
         }
     }
 }
Example #5
0
 public virtual void CopyFrom(RBNodeBase <TKey> otherNode)
 {
     this.Key = otherNode.Key;
 }