Exemplo n.º 1
0
        protected override ITransientMap DoAssoc(object key, object val)
        {
            var found = new Box(null);
            var t     = SortedMap.Add(this._comp, this._tree, key, val, found);

            if (t is null)
            {
                var foundNode = found.Value as RedBlackNode;
                if (foundNode.Value == val)
                {
                    return(this);
                }

                this._tree = SortedMap.Replace(this._comp, this._tree, key, val);
                return(this);
            }

            this._tree = t.Blacken();
            this._count++;
            return(this);
        }
Exemplo n.º 2
0
 public SortedMapSeq(RedBlackNode t, bool asc, int count) :
     this(Push(t, null, asc), asc, count)
 {
 }
Exemplo n.º 3
0
 protected internal virtual RedBlackNode BalanceRight(RedBlackNode parent) => SortedMap.MakeBlack(parent.Key, parent.Value, parent.Left, this);
Exemplo n.º 4
0
 protected internal abstract RedBlackNode Replace(object key, object val, RedBlackNode left, RedBlackNode right);
Exemplo n.º 5
0
 protected internal abstract RedBlackNode RemoveRight(RedBlackNode delete);
Exemplo n.º 6
0
 protected internal abstract RedBlackNode AddRight(RedBlackNode insert);
Exemplo n.º 7
0
 protected internal override RedBlackNode Replace(object key, object val, RedBlackNode left, RedBlackNode right) => SortedMap.MakeRed(key, val, left, right);
Exemplo n.º 8
0
 protected internal override RedBlackNode RemoveRight(RedBlackNode delete) => SortedMap.MakeRed(this._key, Value, Left, delete);
Exemplo n.º 9
0
 protected internal override RedBlackNode AddRight(RedBlackNode insert) => SortedMap.MakeRed(this._key, Value, Left, insert);
Exemplo n.º 10
0
 public TransientSortedMap(AtomicReference <Thread> edit, System.Collections.IComparer comp, RedBlackNode tree, int count)
 {
     this._edit  = edit;
     this._comp  = comp;
     this._tree  = tree;
     this._count = count;
 }