示例#1
0
文件: LNode.cs 项目: jsbattig/nctrie
        public MainNode <K, V> removed(K k, ConcurrentTrieDictionary <K, V> ct)
        {
            ListMap <K, V> updmap = listmap.remove(k);

            if (updmap.size() > 1)
            {
                return(new LNode <K, V>(updmap));
            }
            else
            {
                updmap.iterator().MoveNext();
                KeyValuePair <K, V> kv = updmap.iterator().Current;
                // create it tombed so that it gets compressed on subsequent
                // accesses
                return(new TNode <K, V>(kv.Key, kv.Value, ct.computeHash(kv.Key)));
            }
        }
示例#2
0
            private ListMap <K, V> remove0(K key)
            {
                ListMap <K, V> n     = this;
                ListMap <K, V> newN  = null;
                ListMap <K, V> lastN = null;

                while (n != null)
                {
                    if (n is EmptyListMap)
                    {
                        newN._next = n;
                        break;
                    }
                    Node nn = (Node)n;
                    if (key.Equals(nn.k))
                    {
                        n = n._next;
                        continue;
                    }
                    else
                    {
                        if (newN != null)
                        {
                            lastN._next = map(nn.k, nn.v, null);
                            lastN       = lastN._next;
                        }
                        else
                        {
                            newN  = map(nn.k, nn.v, null);
                            lastN = newN;
                        }
                    }
                    n = n._next;
                }
                return(newN);
            }
示例#3
0
文件: LNode.cs 项目: jsbattig/nctrie
 public LNode(K k1, V v1, K k2, V v2) : this(ListMap <K, V> .map(k1, v1, k2, v2))
 {
 }
示例#4
0
文件: LNode.cs 项目: jsbattig/nctrie
 public LNode(K k, V v) : this(ListMap <K, V> .map(k, v))
 {
 }
示例#5
0
文件: LNode.cs 项目: jsbattig/nctrie
 public LNode(ListMap <K, V> listmap)
 {
     this.listmap = listmap;
 }
示例#6
0
 static public ListMap <K, V> map(K k, V v, ListMap <K, V> tail)
 {
     return(new Node(k, v, tail));
 }
示例#7
0
 public NodeIterator(Node n)
 {
     this.n = n;
 }
示例#8
0
 public Node(K k, V v, ListMap <K, V> next)
 {
     this.k = k;
     this.v = v;
     _next  = next;
 }