public static SortedLinkedList<VocabularyItem> Collect(TrieNode root)
 {
     _itemsCollectedInCurThread = new SortedLinkedList<VocabularyItem>
                                         (Configuration.Default.MaxWordsNumberToReturn);
     CollectFromNode(root);
     return _itemsCollectedInCurThread;
 }
        private static void CollectFromNode(TrieNode trieNode)
        {
            if (trieNode.VocabularyItem != null)
                _itemsCollectedInCurThread.Add(trieNode.VocabularyItem);

            foreach (TrieNode node in trieNode.NextSymbols)
            {
                if (node != null)
                    CollectFromNode(node);
            }
        }
        protected override void AddItemToVocabulary(VocabularyItem toAdd)
        {
            TrieNode curTrieNode = _root;

            foreach (char wordSymbol in toAdd.Word)
            {
                if (curTrieNode[wordSymbol] == null)
                {
                    curTrieNode[wordSymbol] = new TrieNode();
                }
                curTrieNode = curTrieNode[wordSymbol];
            }

            curTrieNode.VocabularyItem = new VocabularyItem(toAdd.Word, toAdd.WordOccurrence);
        }
 public TrieAutocompletter()
 {
     _root = new TrieNode();
 }