日期:2014-05-20 浏览次数:20913 次
public OperatorIF buildOperator(String act)throws BadOperatorException{
if ("add".equalsIgnoreCase(act)) {
return new AddOperatorImpl();
}else if ("sub".equalsIgnoreCase(act)) {
return new SubOperatorImpl();
}else if ("div".equalsIgnoreCase(act)) {
return new DivOperatorImpl();
}else if ("mul".equalsIgnoreCase(act)) {
return new MulOperatorImpl();
}else {
throw new BadOperatorException("Bad Operator!!");
}
}