/// <summary> /// Constructor used when there is no parent node, i.e. the root of the tree /// </summary> /// <param name="subword">The enumeration of the word to populate the tree</param> /// <param name="depth">The depth of the node</param> /// <param name="parent">The node immediately above this node in the tree</param> public DictNode(CharEnumerator subword, int depth, TreeTraverse parent) : base(parent) { _depth = depth; Letter = subword.Current; LetterEnum = LetterUtil.GetLetter(Letter); if (subword.MoveNext()) { Children.Add(new DictNode(subword, _depth + 1, this)); _isWord = false; } else { _isWord = true; } }
/// <summary> /// Use this constructor to set the parent of the new node. Should be used for all nodes with a parent, /// i.e. all but the root. /// </summary> public TreeTraverse(TreeTraverse parent) : this() { Parent = parent; }