Esempio n. 1
0
        // Increment the value of x with the value d
        public void increment(ulong key, IIncrementable <T> v)
        {
            ulong    hash = h(key);
            Node <T> head = nodeList[hash];

            if (head == null)
            {
                nodeList[hash] = new Node <T>(key, v);
                count++;
                return;
            }

            while (head.Key != key && head.Next != null)
            {
                head = head.Next;
            }

            if (head.Key == key)
            {
                head.Data.Increment(v.GetValue());
            }
            else
            {
                head.Next = new Node <T>(key, v);
                count++;
            }
        }