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