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); }
protected void GetOrCreateChild(StringPartition key, TValue value) { PatriciaTrieNode <TValue> child; if (!mChildren.TryGetValue(key[0], out child)) { child = new PatriciaTrieNode <TValue>(key, value); mChildren.Add(key[0], child); } else { child.Add(key, value); } }
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); }