예제 #1
0
        public void SetValue(int hash, IKeyValuePair <TKey, TValue> pair)
        {
            int index = hash % Count;

            //Normally just add one more collision
            if (!_isSubNodesOn)
            {
                if (_innerArray[index] == null)
                {
                    _innerArray[index] = new ValueCell <TKey, TValue>();
                }
            }
            //But if node it too large - rebuild asked cell to NodeCell (and add one more node)
            else
            {
                if (_innerArray[index] == null)
                {
                    _innerArray[index] = new NodeCell <TKey, TValue>(new Node <TKey, TValue>(
                                                                         _balancer.GetNewNodeSize(_level + 1),
                                                                         _level + 1,
                                                                         _balancer));
                }
            }

            var cell = _innerArray[index];

            cell.Add(hash, pair);

            ElementCount++;
        }
예제 #2
0
 public BigDictionary()
 {
     _balancer      = new FastReducedBalancer();
     _rootNode      = new Node <TKey, TValue>(_balancer.GetNewNodeSize(0), 0, _balancer);
     _dictionaryMap = new StandardDictionaryMap <TKey, TValue>();
 }