private void SplitOne(ZipResult zipResult, TValue value) { var leftChild = new PatriciaTrieNode <TValue>(zipResult.ThisRest, m_Values, m_Children); m_Children = new Dictionary <char, PatriciaTrieNode <TValue> >(); m_Values = new Queue <TValue>(); AddValue(value); m_Key = zipResult.CommonHead; m_Children.Add(zipResult.ThisRest[0], leftChild); }
protected void GetOrCreateChild(StringPartition key, TValue value) { if (!m_Children.TryGetValue(key[0], out PatriciaTrieNode <TValue> child)) { child = new PatriciaTrieNode <TValue>(key, value); m_Children.Add(key[0], child); } else { child.Add(key, value); } }
private void SplitTwo(ZipResult zipResult, TValue value) { var leftChild = new PatriciaTrieNode <TValue>(zipResult.ThisRest, m_Values, m_Children); var rightChild = new PatriciaTrieNode <TValue>(zipResult.OtherRest, value); m_Children = new Dictionary <char, PatriciaTrieNode <TValue> >(); m_Values = new Queue <TValue>(); m_Key = zipResult.CommonHead; char leftKey = zipResult.ThisRest[0]; m_Children.Add(leftKey, leftChild); char rightKey = zipResult.OtherRest[0]; m_Children.Add(rightKey, rightChild); }