GP-21_emteere fix for slow performance when creating functions with

disjointed address sets
This commit is contained in:
emteere 2020-06-30 14:26:13 -04:00
parent 0bfcb5b8cd
commit fa31a01a10

View file

@ -204,13 +204,14 @@ public class NamespaceManager implements ManagerDB {
* @throws OverlappingNamespaceException if the address set to test overlaps a namespace body.
*/
public void overlapsNamespace(AddressSetView set) throws OverlappingNamespaceException {
AddressRangeIterator iter =
namespaceMap.getAddressRanges(set.getMinAddress(), set.getMaxAddress());
while (iter.hasNext()) {
AddressRange range = iter.next();
if (set.intersects(range.getMinAddress(), range.getMaxAddress())) {
throw new OverlappingNamespaceException(range.getMinAddress(),
range.getMaxAddress());
AddressRangeIterator addressRanges = set.getAddressRanges();
for (AddressRange addressRange : addressRanges) {
AddressRangeIterator namesSpaceRanges = namespaceMap.getAddressRanges(
addressRange.getMinAddress(), addressRange.getMaxAddress());
AddressRange existingRange = namesSpaceRanges.next();
if (existingRange != null) {
throw new OverlappingNamespaceException(existingRange.getMinAddress(),
existingRange.getMaxAddress());
}
}
}