protected internal override RedBlackNode BalanceRight(RedBlackNode parent) { if (this._right is RedNode) { return(SortedMap.MakeRed(this._key, Value, SortedMap.MakeBlack(parent.Key, parent.Value, parent.Left, this._left), this._right.Blacken())); } else if (this._left is RedNode) { return(SortedMap.MakeRed(this._left.Key, this._left.Value, SortedMap.MakeBlack(parent.Key, parent.Value, parent.Left, this._left.Left), SortedMap.MakeBlack(this._key, Value, this._left.Right, this._right))); } else { return(base.BalanceRight(parent)); } }
protected internal override RedBlackNode RemoveRight(RedBlackNode delete) => SortedMap.MakeRed(this._key, Value, Left, delete);
protected internal override RedBlackNode Replace(object key, object val, RedBlackNode left, RedBlackNode right) => SortedMap.MakeRed(key, val, left, right);
protected internal override RedBlackNode AddRight(RedBlackNode insert) => SortedMap.MakeRed(this._key, Value, Left, insert);