protected void updateLinks(Map<Link, Long> oldTraffic, Map<Link, Long> linkTraffic) { for (Map.Entry<Link, Long> linkDoubleEntry : linkTraffic.entrySet()) { Link link = linkDoubleEntry.getKey(); if (oldTraffic != null) { oldTraffic.put(link, link.getUsedCapacity()); } link.setUsedCapacity(linkDoubleEntry.getValue()); } }
protected boolean linkFails(Map<Link, Long> linkTraffic) { for (Map.Entry<Link, Long> linkUsedCapacityEntry : linkTraffic.entrySet()) { Link link = linkUsedCapacityEntry.getKey(); if (link.getCapacity() < linkTraffic.get(link)) { Util.logger.info( link.toString() + " failed. " + linkTraffic.get(link) + ">" + link.getCapacity()); return true; } } return false; }