示例#1
0
 private bool GetCapitalChildren(char key, out WordTree wordTree)
 {
     if (key >= 'a' && key <= 'z')
     {
         key = (char)(key - 32);
     }
     return(CapitalChildren.TryGetValue(key, out wordTree));
 }
示例#2
0
 private void PushToChild(char key, string word, IDictionary <char, WordTree> tree)
 {
     if (tree.TryGetValue(key, out WordTree oldChild))
     {
         if (!HasChild())
         {
             return;
         }
         else
         {
             oldChild.PushIn(word.Substring(1));
         }
     }
     else
     {
         var child = new WordTree()
         {
             Key  = key,
             Papa = this
         };
         child.PushIn(word.Substring(1));
         tree.Add(key, child);
     }
 }
示例#3
0
 private bool GetAllChildren(char key, out WordTree wordTree)
 {
     return(GetCapitalChildren(key, out wordTree) || GetOriChildren(key, out wordTree));
 }
示例#4
0
 private bool GetOriChildren(char key, out WordTree wordTree)
 {
     return(OriginalChildren.TryGetValue(key, out wordTree));
 }