private bool GetCapitalChildren(char key, out WordTree wordTree) { if (key >= 'a' && key <= 'z') { key = (char)(key - 32); } return(CapitalChildren.TryGetValue(key, out wordTree)); }
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); } }
private bool GetAllChildren(char key, out WordTree wordTree) { return(GetCapitalChildren(key, out wordTree) || GetOriChildren(key, out wordTree)); }
private bool GetOriChildren(char key, out WordTree wordTree) { return(OriginalChildren.TryGetValue(key, out wordTree)); }