public bool Equals(ZipResult other) { return (m_CommonHead == other.m_CommonHead && m_OtherRest == other.m_OtherRest && m_ThisRest == other.m_ThisRest); }
public bool Equals(ZipResult other) { return m_CommonHead == other.m_CommonHead && m_OtherRest == other.m_OtherRest && m_ThisRest == other.m_ThisRest; }
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); }
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); }
internal virtual void Add(StringPartition keyRest, TValue value) { ZipResult zipResult = m_Key.ZipWith(keyRest); switch (zipResult.MatchKind) { case MatchKind.ExactMatch: AddValue(value); break; case MatchKind.IsContained: GetOrCreateChild(zipResult.OtherRest, value); break; case MatchKind.Contains: SplitOne(zipResult, value); break; case MatchKind.Partial: SplitTwo(zipResult, value); break; } }