/// <summary> push into the current execution stack the execution stack that we get as parameter, but in reverse order</summary> /// <param name="inExecStack">- the execution stack to be pushed </param> internal void pushUpSideDown(ExecutionStack inExecStack) { var tmpStack = new ExecutionStack(inExecStack); ExecutionStackEntry tmpStackEntry; while (!tmpStack.empty()) { tmpStackEntry = tmpStack.pop(); _execStack.Push(tmpStackEntry); } }
/// <summary> reverse the order of the entries in the current execution stack</summary> internal void reverse() { var tmpExecStack = new ExecutionStack(this); ExecutionStackEntry tmpExecStackEntry; clear(); while (!tmpExecStack.empty()) { tmpExecStackEntry = tmpExecStack.pop(); push(tmpExecStackEntry); } }
/// <summary> checks if two execution stacks are equal</summary> /// <param name="execStackCmp">- execution stack to compare to the current </param> /// <returns>s an indication whether the two are equal or not </returns> public override bool Equals(Object execStackCmp) { var tmpExecStack = new ExecutionStack(this); var tmpExecStackCmp = new ExecutionStack((ExecutionStack)execStackCmp); bool equalStacks = false; if (tmpExecStack.size() == tmpExecStackCmp.size()) { equalStacks = true; while (!tmpExecStack.empty() && equalStacks) { if (!tmpExecStack.pop().Equals(tmpExecStackCmp.pop())) { equalStacks = false; } } } return(equalStacks); }
/// <summary> constructor which copies the parameter execution stack</summary> /// <param name="inExecStack">- the execution stack to copy </param> internal ExecutionStack(ExecutionStack inExecStack) { _execStack = (Stack)inExecStack.getStack().Clone(); }