// 只创建带结果集的ReversePolishItem对象,并push到栈里 // parameter: // oResult 结果集 // return: // void public void PushResultSet(DpResultSet oResult) { ReversePolishItem oItem = new ReversePolishItem(null, oResult); Add(oItem); }
// 只创建带节点的ReversePolishItem对象,并push到栈里 // parameter: // node node节点 // return: // void public void PushNode(XmlNode node) { ReversePolishItem oItem = new ReversePolishItem(node, null); Add(oItem); }
// 创建同时带节点和结果集的ReversePolishItem对象,并push到栈里 // parameter: // node 节点 // oResult 结果集 // return: // void public void Push(XmlNode node, DpResultSet oResult) { ReversePolishItem oItem = new ReversePolishItem(node, oResult); Add(oItem); }
// 返回栈顶元素 // return: // 返回ReversePolishItem对象 public ReversePolishItem Peek() { if (this.Count == 0) { StackUnderflowException ex = new StackUnderflowException("Pop前,堆栈已经空"); throw (ex); } ReversePolishItem oTemp = (ReversePolishItem)this[this.Count - 1]; return(oTemp); }
// pop一个对象 // return: // ReversePolishItem对象 public ReversePolishItem Pop() { if (this.Count == 0) { StackUnderflowException ex = new StackUnderflowException("Pop前,堆栈已经空"); throw (ex); } ReversePolishItem oTemp = (ReversePolishItem)this[this.Count - 1]; this.RemoveAt(this.Count - 1); //可能返回空,调用者错用了类型,应在调用处做判断。 return(oTemp); }
// pop一个对象,只返回节点 // return: // node节点 public XmlNode PopNode() { //栈为空,抛出StackUnderflowException异常 if (this.Count == 0) { StackUnderflowException ex = new StackUnderflowException("Pop前,堆栈已经空"); throw (ex); } ReversePolishItem oTemp = (ReversePolishItem)this[this.Count - 1]; this.RemoveAt(this.Count - 1); //可能返回空,调用者错用了类型,应在调用处做判断。 return(oTemp.m_node); }
// 创建同时带节点和结果集的ReversePolishItem对象,并push到栈里 // parameter: // node 节点 // oResult 结果集 // return: // void public void Push(XmlElement node, DpResultSet oResult) { ReversePolishItem oItem = new ReversePolishItem(node, oResult); Add(oItem); }
// 只创建带节点的ReversePolishItem对象,并push到栈里 // parameter: // node node节点 // return: // void public void PushNode(XmlElement node) { ReversePolishItem oItem = new ReversePolishItem(node, null); Add(oItem); }