public String Statistic(String cmdType, String arg1, String arg2) { ICommand cmd; if (cmdType == "Sum") { ISum sum = SumFactory.GetCommand(arg1, arg2); cmd = new SumCommand(sum); } else if (cmdType == "Average") { IAverage average = AverageFactory.GetCommand(arg1, arg2); cmd = new AverageCommand(average); } else if (cmdType == "Max") { IMax max = MaxFactory.GetCommand(arg1, arg2); cmd = new MaxCommand(max); } else { IMin min = MinFactory.GetCommand(arg1, arg2); cmd = new MinCommand(min); } String res = CommandInvoker.DoCommand(cmd); return(res); }
public MinCommand(IMin cmd) { this.cmd = cmd; }