List<Calculator> calculatorList = new ArrayList<Calculator>();
Iterator<String> calculatorStringIterator = calculatorStringList.iterator();
while (calculatorStringIterator.hasNext()) {
String calculatorString = calculatorStringIterator.next();
Calculator calculator;
if (calculatorString.equals("normal")) {
calculator = createNormalCalculator(commandLine);
} else if(calculatorString.equals("poisson")) {
calculator = createPoissonCalculator(commandLine, alignmentList);
} else if(calculatorString.equals("translation")) {
calculator = createTranslationCalculator(commandLine);
} else if(calculatorString.equals("oracle")) {
List<String> remainingCalculatorStringList =
new ArrayList<String>();
while (calculatorStringIterator.hasNext()) {
remainingCalculatorStringList.add(calculatorStringIterator.next());
}
Calculator remainingCalculator = createCalculator(
commandLine, alignmentList, remainingCalculatorStringList);
calculator = createOracleCalculator(commandLine, remainingCalculator);
} else {
throw new UnknownParameterException("calculator");
}
calculatorList.add(calculator);
}
Calculator calculator;
if (calculatorList.size() == 1) {
calculator = calculatorList.get(0);
} else {
calculator = new CompositeCalculator(calculatorList);
}