public MathTree(InnerNode root, MathNode child) { this.nodeStack = new Stack(); this.root = root; ((InnerNode) this.root).AddNode(child); }
public MathTree(InnerNode root, MathNode left, MathNode right) { this.nodeStack = new Stack(); this.root = root; ((InnerNode)this.root).AddNode(left); ((InnerNode)this.root).AddNode(right); }
public MathNode getCurrentNode() { try { return (MathNode)nodeStack.Peek(); } catch { // empty stack, create empty root node this.root = new InnerNode(); this.nodeStack.Push(this.root); return this.root; } }