예제 #1
0
        public void Parse(string word)
        {
            NumberOfEntries += 1;

            var wordCharArray = word.ToCharArray();

            var result = Children.FirstOrDefault(f => f.IndexLetter == wordCharArray[0]);

            if (result == null)
            {
                result = new WordListTreeNode {
                    IndexLetter = wordCharArray[0]
                };
                Children.Add(result);
            }
            result.Parse(wordCharArray, word);
        }
예제 #2
0
 public void Parse(char[] wordArray, string rootWord)
 {
     if (wordArray.Length == 1)
     {
         ResolvedWord = rootWord;
     }
     else
     {
         var result = Children.FirstOrDefault(f => f.IndexLetter == wordArray[1]);
         if (result == null)
         {
             result = new WordListTreeNode {
                 IndexLetter = wordArray[1]
             };
             Children.Add(result);
         }
         result.Parse(wordArray.Skip(1).Take(wordArray.Length - 1).ToArray(), rootWord);
     }
 }