OperationResult opres = OperationResult.CONTINUE;
while (opres == OperationResult.CONTINUE) {
int ip = current.getNextInstructionAndIncrement();
Operation op = template.getOperation(ip);
try {
opres = op.execute(current);
} catch (RuntimeException ex) {
throw new RuntimeException("Cannot execute operation at template position:\n\t" + op.getTemplatePosition(), ex);
}
if (opres == null)
throw new RuntimeException(op.getClass().toString() + " returned invalid operation result");