Esempio n. 1
0
        public BoolStack Reverse()
        {
            BoolStack stack = new BoolStack();

            while (this.Count > 0)
            {
                stack.Push(this.Pop());
            }

            return(stack);
        }
Esempio n. 2
0
        public bool CheckResultWithBracket(DataRow row)
        {
            try
            {
                //12-17-2007@Scott
                BoolStack stack = new BoolStack();

                foreach (DBCondition condition in this)
                {
                    bool bResult = condition.CheckResult(row);

                    BoolResult br = new BoolResult(bResult, condition.Bracket, condition.FollowedOperand);

                    if (condition.Bracket == Bracket.End)
                    {
                        BoolStack Bstack = new BoolStack();

                        FilterOperands oper = br.Operands;

                        Bstack.Push(br);

                        br = stack.Pop() as BoolResult;

                        while (br.Bracket != Bracket.Start)
                        {
                            Bstack.Push(br);

                            if (stack.Count == 0)
                            {
                                System.Windows.Forms.MessageBox.Show("Bad Bracket Count!");

                                return(false);
                            }

                            br = stack.Pop() as BoolResult;
                        }
                        Bstack.Push(br);

                        br = Bstack.GetResultWithoutBracket();

                        br.Bracket = Bracket.NONE;

                        br.Operands = oper;
                    }

                    stack.Push(br);
                }

                stack = stack.Reverse();

                BoolResult result = stack.GetResultWithoutBracket();

                return(result.Result);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Check filter result error. Message:" + ex.Message);

                return(false);
            }
        }