Esempio n. 1
0
        private void SplitOne(ZipResult zipResult, TValue value)
        {
            var leftChild = new PatriciaTrieNode <TValue>(zipResult.ThisRest, mValues, mChildren);

            mChildren = new Dictionary <char, PatriciaTrieNode <TValue> >();
            mValues   = new Queue <TValue>();
            AddValue(value);
            mKey = zipResult.CommonHead;

            mChildren.Add(zipResult.ThisRest[0], leftChild);
        }
Esempio n. 2
0
 protected void GetOrCreateChild(StringPartition key, TValue value)
 {
     if (!mChildren.TryGetValue(key[0], out var child))
     {
         child = new PatriciaTrieNode <TValue>(key, value);
         mChildren.Add(key[0], child);
     }
     else
     {
         child.Add(key, value);
     }
 }
Esempio n. 3
0
        private void SplitTwo(ZipResult zipResult, TValue value)
        {
            var leftChild  = new PatriciaTrieNode <TValue>(zipResult.ThisRest, mValues, mChildren);
            var rightChild = new PatriciaTrieNode <TValue>(zipResult.OtherRest, value);

            mChildren = new Dictionary <char, PatriciaTrieNode <TValue> >();
            mValues   = new Queue <TValue>();
            mKey      = zipResult.CommonHead;

            char leftKey = zipResult.ThisRest[0];

            mChildren.Add(leftKey, leftChild);
            char rightKey = zipResult.OtherRest[0];

            mChildren.Add(rightKey, rightChild);
        }