/** * Add a split * * @param descriptor The split descriptor to add * @throws IllegalArgumentException if the descriptor's ID already exists in the workflow */ public void addSplit(SplitDescriptor descriptor) { if (getSplit(descriptor.getId()) != null) { throw new IllegalArgumentException("Split with id " + descriptor.getId() + " already exists"); } splits.add(descriptor); }
public SplitDescriptor getSplit(int id) { for (Iterator iterator = splits.iterator(); iterator.hasNext(); ) { SplitDescriptor splitDescriptor = (SplitDescriptor) iterator.next(); if (splitDescriptor.getId() == id) { return splitDescriptor; } } return null; }