}
public void addRequirements(Collection<? extends Requirement> requirements) throws BundleException, InvalidSyntaxException {
for (int i = 0; i < MAX_ATTEMPTS_DEFAULT; i++) {
RegionDigraph copy = copyDigraph();
Region tail = copyTail(copy);
Region head = copyHead(copy);
Set<Long> bundleIds = copyBundleIds(tail);
Map<String, RegionFilterBuilder> heads = copyHeadRegions(tail, copy);
Map<String, RegionFilterBuilder> tails = copyTailRegions(tail, copy);
copy.removeRegion(tail);
tail = copy.createRegion(tail.getName());
addBundleIds(bundleIds, tail);
addRequirements(requirements, heads.get(head.getName()));
addHeadRegions(heads, tail, copy);
addTailRegions(tails, tail, copy);
// Replace the current digraph.
try {
digraph.replace(copy);