示例#1
0
        private static bool CheckPriority(NumericExpressionOperator topOfStack, NumericExpressionOperator newOperator)
        {
            int stackPriority       = GetPriority(topOfStack);
            int newOperatorPriority = GetPriority(newOperator);

            return(newOperatorPriority < stackPriority);
        }
示例#2
0
        private static int GetPriority(NumericExpressionOperator neo)
        {
            switch (neo.GetOperatorType())
            {
            case NumericExpressionOperatorType.Modulo:
                return(2);

            case NumericExpressionOperatorType.Multiply:
                return(2);

            case NumericExpressionOperatorType.Divide:
                return(2);

            case NumericExpressionOperatorType.Plus:
                return(1);

            case NumericExpressionOperatorType.Minus:
                return(1);
            }
            return(0);
        }