コード例 #1
0
 private void GetChars(Node node, IList<char> chars)
 {
     foreach (var child in node.GetChildren())
     {
         if (node.Depth + 1 == child.Depth && !child.Value.Equals(' '))
         {
             chars.Add(child.Value);
         }
         else if(child.Depth > node.Depth + 1)
         {
             return;
         }
     }
 }
コード例 #2
0
        private void GetTerms(Node node, ICollection<string> words,
            StringBuilder buffer)
        {
            if (node.IsTerm())
            {
                words.Add(buffer.ToString());
            }

            foreach (var child in node.GetChildren())
            {
                buffer.Append(child.Value);
                GetTerms(child, words, buffer);
                buffer.Length--;
            }
        }