I present for your consideration:
for (int i = 0; i < args.length; i += 2) {
String optionName = args[i];
String optionValue = args[i + 1];
if (optionName.equals("--depthLimited"))
trainer.setDepthLimited(Boolean.parseBoolean(optionValue));
else if (optionName.equals("--doPruning"))
trainer.setDoPruning(Boolean.parseBoolean(optionValue));
else if (optionName.equals("--maxDepth"))
trainer.setMaxDepth(Integer.parseInt(optionValue));
else if (optionName.equals("--minNumInsts"))
trainer.setMinNumInsts(Integer.parseInt(optionValue));
else
throw new IllegalArgumentException(String.format(
"the argument %1$s is invalid. ",
optionName) + getUsageMessage());
}
Need I say more?
P.S. We should document these options somewhere at the same time.
Original issue reported on code.google.com by steven.b...@gmail.com on 12 Feb 2012 at 5:29
Original issue reported on code.google.com by
steven.b...@gmail.com
on 12 Feb 2012 at 5:29