/// <summary> /// Constructor for pre-order enumerator /// </summary> /// <param name="tree">Tree to enumerate through</param> public PreOrderEnumerator(LeftRightTree <TNode, TValue> tree) { _tree = tree ?? throw new ArgumentNullException(nameof(tree)); _stack.Push(tree.Root); }
public InOrderEnumerator(LeftRightTree <TNode, TValue> tree) { _tree = tree ?? throw new ArgumentNullException(nameof(tree)); _currentNode = tree.Root; Current = default(TValue); }
/// <summary> /// Constructor for Output class. /// </summary> /// <param name="tree">Tree instance to print.</param> /// <param name="textWriter"><seealso cref="TextWriter"/> to print to.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="tree"/> or <paramref name="textWriter"/> is null.</exception> public Output(LeftRightTree <TNode, TValue> tree, TextWriter textWriter) { _tree = tree ?? throw new ArgumentNullException(nameof(tree), "Tree cannot be null"); _textWriter = textWriter ?? throw new ArgumentNullException(nameof(textWriter), "Text writer cannot be null"); }