Ejemplo n.º 1
0
        private void SplitOne(ZipResult zipResult, TValue value)
        {
            var leftChild = new PatriciaTrieNode <TValue>(zipResult.ThisRest, this.m_Values, this.m_Children);

            this.m_Children = new Dictionary <char, PatriciaTrieNode <TValue> >();
            this.m_Values   = new Queue <TValue>();
            this.AddValue(value);
            this.m_Key = zipResult.CommonHead;

            this.m_Children.Add(zipResult.ThisRest[0], leftChild);
        }
Ejemplo n.º 2
0
        protected void GetOrCreateChild(StringPartition key, TValue value)
        {
            PatriciaTrieNode <TValue> child;

            if (!this.m_Children.TryGetValue(key[0], out child))
            {
                child = new PatriciaTrieNode <TValue>(key, value);
                this.m_Children.Add(key[0], child);
            }
            else
            {
                child.Add(key, value);
            }
        }
Ejemplo n.º 3
0
        private void SplitTwo(ZipResult zipResult, TValue value)
        {
            var leftChild  = new PatriciaTrieNode <TValue>(zipResult.ThisRest, this.m_Values, this.m_Children);
            var rightChild = new PatriciaTrieNode <TValue>(zipResult.OtherRest, value);

            this.m_Children = new Dictionary <char, PatriciaTrieNode <TValue> >();
            this.m_Values   = new Queue <TValue>();
            this.m_Key      = zipResult.CommonHead;

            char leftKey = zipResult.ThisRest[0];

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

            this.m_Children.Add(rightKey, rightChild);
        }