Exemple #1
0
        /// <summary>
        /// Recursively pop operators and operands
        /// </summary>
        /// <param name="operands"></param>
        /// <param name="operators"></param>
        private void Pop(Stack operands, Stack operators)
        {
            operators.Pop();

            AndOrElement andOrChild = MyLeftChild as AndOrElement;

            if (andOrChild == null)
            {
                operands.Pop();
            }
            else
            {
                andOrChild.Pop(operands, operators);
            }

            andOrChild = (AndOrElement)MyRightChild;

            if (andOrChild == null)
            {
                operands.Pop();
            }
            else
            {
                andOrChild.Pop(operands, operators);
            }
        }
Exemple #2
0
        private void PopRightChild(Stack operands, Stack operators)
        {
            AndOrElement andOrChild = MyRightChild as AndOrElement;

            // What kind of child do we have?
            if ((andOrChild != null))
            {
                // Another and/or expression so recurse
                andOrChild.Pop(operands, operators);
            }
            else
            {
                // A terminal so pop it off the operands stack
                operands.Pop();
            }
        }