Logical Operator Class providing evaluation services for && and || operators.
Inheritance: Operator
Esempio n. 1
0
        /// <summary>
        /// Factory method to create Operator objects.
        /// </summary>
        /// <param name="szOperator"></param>
        /// <returns></returns>
        static public IOperator CreateOperator(string szOperator)
        {
            IOperator oprtr = null;

            if (OperatorHelper.IsArithmeticOperator(szOperator))
            {
                oprtr = new ArithmeticOperator(szOperator);
                return(oprtr);
            }
            if (OperatorHelper.IsComparisonOperator(szOperator))
            {
                oprtr = new ComparisonOperator(szOperator);
                return(oprtr);
            }
            if (OperatorHelper.IsLogicalOperator(szOperator))
            {
                oprtr = new LogicalOperator(szOperator);
                return(oprtr);
            }
            throw new RPN_Exception("Unhandled Operator : " + szOperator);
        }
Esempio n. 2
0
 /// <summary>
 /// Factory method to create Operator objects.
 /// </summary>
 /// <param name="szOperator"></param>
 /// <returns></returns>
 public static IOperator CreateOperator( string szOperator )
 {
     IOperator oprtr = null;
     if( OperatorHelper.IsArithmeticOperator( szOperator ) )
     {
         oprtr = new ArithmeticOperator( szOperator );
         return oprtr;
     }
     if( OperatorHelper.IsComparisonOperator( szOperator ) )
     {
         oprtr = new ComparisonOperator( szOperator );
         return oprtr;
     }
     if( OperatorHelper.IsLogicalOperator( szOperator ) )
     {
         oprtr = new LogicalOperator( szOperator );
         return oprtr;
     }
     throw new RPN_Exception("Unhandled Operator : " + szOperator );
 }