if (optional) {
// jump around here to make sure every path has at least one unique
// operation
Label dummyEndLabel = new Label();
Label dummyContLabel = new Label();
template.appendOperation(new ForkOperation(template.getCurrentTemplatePosition(), dummyEndLabel, false));
template.appendOperation(new JumpOperation(template.getCurrentTemplatePosition(), dummyContLabel));
dummyEndLabel.setDestinationToNextCommand(template);
template.appendOperation(new JumpOperation(template.getCurrentTemplatePosition(), endLabel));
dummyContLabel.setDestinationToNextCommand(template);
}
int lastForkPoint = template.getNextOperationIndex();
template.appendOperation(new ForkOperation(template.getCurrentTemplatePosition(), forkLabel, false));
template.appendOperation(new JumpOperation(template.getCurrentTemplatePosition(), nextPartLabel));
forkLabel.setDestinationToNextCommand(template);
return new AlternativeCommandState(template, lastForkPoint, nextPartLabel, endLabel);
}