aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java')
-rw-r--r--framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java26
1 files changed, 11 insertions, 15 deletions
diff --git a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java
index cd28fcf9..2e2041c4 100644
--- a/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java
+++ b/framework/src/onos/apps/segmentrouting/src/main/java/org/onosproject/segmentrouting/ECMPShortestPathGraph.java
@@ -97,7 +97,7 @@ public class ECMPShortestPathGraph {
}
Integer distance = deviceSearched.get(reachedDevice);
- if ((distance != null) && (distance.intValue() < (currDistance + 1))) {
+ if ((distance != null) && (distance < (currDistance + 1))) {
continue;
}
if (distance == null) {
@@ -109,7 +109,7 @@ public class ECMPShortestPathGraph {
ArrayList<DeviceId> distanceSwArray = distanceDeviceMap
.get(currDistance + 1);
if (distanceSwArray == null) {
- distanceSwArray = new ArrayList<DeviceId>();
+ distanceSwArray = new ArrayList<>();
distanceSwArray.add(reachedDevice);
distanceDeviceMap.put(currDistance + 1, distanceSwArray);
} else {
@@ -120,7 +120,7 @@ public class ECMPShortestPathGraph {
ArrayList<Link> upstreamLinkArray =
upstreamLinks.get(reachedDevice);
if (upstreamLinkArray == null) {
- upstreamLinkArray = new ArrayList<Link>();
+ upstreamLinkArray = new ArrayList<>();
upstreamLinkArray.add(copyDefaultLink(link));
//upstreamLinkArray.add(link);
upstreamLinks.put(reachedDevice, upstreamLinkArray);
@@ -171,7 +171,7 @@ public class ECMPShortestPathGraph {
}
Integer distance = deviceSearched.get(reachedDevice);
- if ((distance != null) && (distance.intValue() < (currDistance + 1))) {
+ if ((distance != null) && (distance < (currDistance + 1))) {
continue;
}
if (distance == null) {
@@ -183,7 +183,7 @@ public class ECMPShortestPathGraph {
ArrayList<DeviceId> distanceSwArray = distanceDeviceMap
.get(currDistance + 1);
if (distanceSwArray == null) {
- distanceSwArray = new ArrayList<DeviceId>();
+ distanceSwArray = new ArrayList<>();
distanceSwArray.add(reachedDevice);
distanceDeviceMap.put(currDistance + 1, distanceSwArray);
} else {
@@ -194,7 +194,7 @@ public class ECMPShortestPathGraph {
ArrayList<Link> upstreamLinkArray =
upstreamLinks.get(reachedDevice);
if (upstreamLinkArray == null) {
- upstreamLinkArray = new ArrayList<Link>();
+ upstreamLinkArray = new ArrayList<>();
upstreamLinkArray.add(copyDefaultLink(link));
upstreamLinks.put(reachedDevice, upstreamLinkArray);
} else {
@@ -234,7 +234,7 @@ public class ECMPShortestPathGraph {
for (Link upstreamLink : upstreamLinks.get(dstDeviceDeviceId)) {
/* Deep clone the path object */
Path sofarPath;
- ArrayList<Link> sofarLinks = new ArrayList<Link>();
+ ArrayList<Link> sofarLinks = new ArrayList<>();
if (path != null && !path.links().isEmpty()) {
sofarLinks.addAll(path.links());
}
@@ -288,12 +288,10 @@ public class ECMPShortestPathGraph {
public HashMap<Integer, HashMap<DeviceId,
ArrayList<Path>>> getCompleteLearnedDeviceesAndPaths() {
- HashMap<Integer, HashMap<DeviceId, ArrayList<Path>>> pathGraph = new
- HashMap<Integer, HashMap<DeviceId, ArrayList<Path>>>();
+ HashMap<Integer, HashMap<DeviceId, ArrayList<Path>>> pathGraph = new HashMap<>();
for (Integer itrIndx : distanceDeviceMap.keySet()) {
- HashMap<DeviceId, ArrayList<Path>> swMap = new
- HashMap<DeviceId, ArrayList<Path>>();
+ HashMap<DeviceId, ArrayList<Path>> swMap = new HashMap<>();
for (DeviceId sw : distanceDeviceMap.get(itrIndx)) {
swMap.put(sw, getECMPPaths(sw));
}
@@ -314,12 +312,10 @@ public class ECMPShortestPathGraph {
public HashMap<Integer, HashMap<DeviceId,
ArrayList<ArrayList<DeviceId>>>> getAllLearnedSwitchesAndVia() {
- HashMap<Integer, HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>> deviceViaMap =
- new HashMap<Integer, HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>>();
+ HashMap<Integer, HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>> deviceViaMap = new HashMap<>();
for (Integer itrIndx : distanceDeviceMap.keySet()) {
- HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>> swMap =
- new HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>>();
+ HashMap<DeviceId, ArrayList<ArrayList<DeviceId>>> swMap = new HashMap<>();
for (DeviceId sw : distanceDeviceMap.get(itrIndx)) {
ArrayList<ArrayList<DeviceId>> swViaArray = new ArrayList<>();