public void PushParent(GroupNode parent) { if (mParentStack.Count > 0) mParentStack.Peek().Add(parent); mParentStack.Push(parent); }
private void BuildOperators(GroupNode root) { for (int i = 0; i < root.Count; i++) { if (root[i] is OperatorNode) { if (i == root.Count - 1) throw new Exception(); if (!(root[i + 1] is TermNode)) throw new Exception(); var operatorNode = (OperatorNode)root[i]; var termNode = (TermNode)root[i + 1]; operatorNode.Argument = termNode.Term; if (!root.Remove(termNode)) throw new Exception(); } else if (root[i] is GroupNode) { var parenNode = (GroupNode)root[i]; BuildOperators(parenNode); } } }