Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #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);
        }
Пример #6
0
        public static Operator CreateOperate(string operate)
        {
            Operator oper = null;

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

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

            return(oper);
        }
Пример #7
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;
 }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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;
 }