Esempio n. 1
0
        public static Operation createOperate(string operate)
        {
            Operation oper = null;

            switch (operate)
            {
            case "+":
                oper = new OperationAdd();
                break;

            case "-":
                oper = new OperationSub();
                break;

            case "*":
                oper = new OperationMul();
                break;

            case "/":
                oper = new OperationDiv();
                break;

            default:
                break;
            }
            return(oper);
        }
Esempio n. 2
0
        public static Operation CreateOperate(string operate)
        {
            //根据传入的参数operate选择实例化的类
            Operation oper = null;

            switch (operate)
            {
            case "+":
                oper = new OperationAdd();
                break;

            case "-":
                oper = new OperationSub();
                break;

            case "*":
                oper = new OperationMul();
                break;

            case "/":
                oper = new OperationDiv();
                break;
            }
            return(oper);
        }
Esempio n. 3
0
        public static Operation CreateOperate(string operate)
        {
            Operation operation = null;

            switch (operate)
            {
            case "+": {
                operation = new OperationAdd();
                break;
            }

            case "-": {
                operation = new OperationSub();
                break;
            }

            case "*": {
                operation = new OperationMul();
                break;
            }

            case "/": {
                operation = new OperationDiv();
                break;
            }
            }
            return(operation);
        }
Esempio n. 4
0
        public static Operation CreatOperate(string operate)
        {
            Operation oper = null;

            switch (operate)
            {
            case "+":
                oper = new OperationAdd();
                break;

            case "-":
                oper = new OperationSub();
                break;

            case "*":
                oper = new OperationMul();
                break;

            case "/":
                oper = new OperationDiv();
                break;

            default:
                throw new Exception("input error");
            }

            return(oper);
        }
Esempio n. 5
0
        public static Operation CreateFactory(string operation)
        {
            Operation oper = null;

            switch (operation)
            {
            case "+":
            {
                oper = new OperationAdd();
                break;
            }

            case "-":
            {
                oper = new OperationSub();
                break;
            }

            case "*":
            {
                oper = new OperationMul();
                break;
            }

            case "/":
            {
                oper = new OperationDiv();
                break;
            }

            case "sqr":
            {
                oper = new OperationSqr();
                break;
            }

            case "sqrt":
            {
                oper = new OperationSqrt();
                break;
            }

            case "+/-":
            {
                oper = new OperationReverse();
                break;
            }
            }
            return(oper);
        }
Esempio n. 6
0
 public static Operation CreateOperation(string op)
 {
     Operation oper = null;
     switch (op)
     {
         case "+":
             oper = new OperationAdd();
             break;
         case "-":
             oper = new OperationSub();
             break;
         case "*":
             oper = new OperationMul();
             break;
         case "/":
             oper = new OperationDiv();
             break;
     }
     return oper;
 }
Esempio n. 7
0
        public static Operation createOperate(string operate)
        {
            Operation oper = null;

            switch (operate)
            {
            case "+":
                oper = new OperationAdd();
                break;

            case "-":
                oper = new OperationSub();
                break;

            case "*":
                oper = new OperationMul();
                break;

            case "/":
                oper = new OperationDiv();
                break;

            case "sqr":
                oper = new OperationSqr();
                break;

            case "sqrt":
                oper = new OperationSqrt();
                break;

            case "+/-":
                oper = new OperationReverse();
                break;
            }
            return(oper);
        }
Esempio n. 8
0
        public static Operation CreateOperation(String operation)
        {
            Operation o = null;

            switch (operation)
            {
            case "+":
                o = new OperationAdd();
                break;

            case "-":
                o = new OperationSub();
                break;

            case "*":
                o = new OperationMul();
                break;

            case "/":
                o = new OperationDiv();
                break;
            }
            return(o);
        }
Esempio n. 9
0
 public static Operation createOperate(string operate)
 {
     Operation oper = null;
     switch (operate)
     {
         case "+":
             oper = new OperationAdd();
             break;
         case "-":
             oper = new OperationSub();
             break;
         case "*":
             oper = new OperationMul();
             break;
         case "/":
             oper = new OperationDiv();
             break;
         case "sqr":
             oper = new OperationSqr();
             break;
         case "sqrt":
             oper = new OperationSqrt();
             break;
         case "+/-":
             oper = new OperationReverse();
             break;
     }
     return oper;
 }