Fix checkstyle whitespace issues - WHITESPACE ONLY
Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
diff --git a/src/main/java/net/onrc/onos/core/intent/PathIntentMap.java b/src/main/java/net/onrc/onos/core/intent/PathIntentMap.java
index 6f66cb7..ad6b1a5 100644
--- a/src/main/java/net/onrc/onos/core/intent/PathIntentMap.java
+++ b/src/main/java/net/onrc/onos/core/intent/PathIntentMap.java
@@ -13,99 +13,100 @@
* @author Toshio Koide (t-koide@onlab.us)
*/
public class PathIntentMap extends IntentMap {
- private HashMap<Long, HashMap<Long, HashSet<PathIntent>>> intents;
+ private HashMap<Long, HashMap<Long, HashSet<PathIntent>>> intents;
- public PathIntentMap() {
- intents = new HashMap<>();
- }
+ public PathIntentMap() {
+ intents = new HashMap<>();
+ }
- private HashSet<PathIntent> get(SwitchPort swPort) {
- Long dpid = swPort.getDpid();
- Long port = swPort.getNumber();
- HashMap<Long, HashSet<PathIntent>> portToIntents = intents.get(dpid);
- if (portToIntents == null) {
- portToIntents = new HashMap<>();
- intents.put(dpid, portToIntents);
- }
- HashSet<PathIntent> targetIntents = portToIntents.get(port);
- if (targetIntents == null) {
- targetIntents = new HashSet<>();
- portToIntents.put(port, targetIntents);
- }
- return targetIntents;
- }
+ private HashSet<PathIntent> get(SwitchPort swPort) {
+ Long dpid = swPort.getDpid();
+ Long port = swPort.getNumber();
+ HashMap<Long, HashSet<PathIntent>> portToIntents = intents.get(dpid);
+ if (portToIntents == null) {
+ portToIntents = new HashMap<>();
+ intents.put(dpid, portToIntents);
+ }
+ HashSet<PathIntent> targetIntents = portToIntents.get(port);
+ if (targetIntents == null) {
+ targetIntents = new HashSet<>();
+ portToIntents.put(port, targetIntents);
+ }
+ return targetIntents;
+ }
- private void put(SwitchPort swPort, PathIntent intent) {
- get(swPort).add(intent);
- }
+ private void put(SwitchPort swPort, PathIntent intent) {
+ get(swPort).add(intent);
+ }
- @Override
- protected void putIntent(Intent intent) {
- if (!(intent instanceof PathIntent)) return; // TODO throw exception
- super.putIntent(intent);
+ @Override
+ protected void putIntent(Intent intent) {
+ if (!(intent instanceof PathIntent)) return; // TODO throw exception
+ super.putIntent(intent);
- PathIntent pathIntent = (PathIntent) intent;
- for (LinkEvent linkEvent: pathIntent.getPath()) {
- put(linkEvent.getSrc(), (PathIntent) intent);
- put(linkEvent.getDst(), (PathIntent) intent);
- }
- }
+ PathIntent pathIntent = (PathIntent) intent;
+ for (LinkEvent linkEvent : pathIntent.getPath()) {
+ put(linkEvent.getSrc(), (PathIntent) intent);
+ put(linkEvent.getDst(), (PathIntent) intent);
+ }
+ }
- @Override
- protected void removeIntent(String intentId) {
- PathIntent intent = (PathIntent) getIntent(intentId);
- for (LinkEvent linkEvent: intent.getPath()) {
- get(linkEvent.getSrc()).remove(intent);
- get(linkEvent.getDst()).remove(intent);
- }
- super.removeIntent(intentId);
- }
+ @Override
+ protected void removeIntent(String intentId) {
+ PathIntent intent = (PathIntent) getIntent(intentId);
+ for (LinkEvent linkEvent : intent.getPath()) {
+ get(linkEvent.getSrc()).remove(intent);
+ get(linkEvent.getDst()).remove(intent);
+ }
+ super.removeIntent(intentId);
+ }
- public Collection<PathIntent> getIntentsByLink(LinkEvent linkEvent) {
- return getIntentsByPort(
- linkEvent.getSrc().getDpid(),
- linkEvent.getSrc().getNumber());
- }
+ public Collection<PathIntent> getIntentsByLink(LinkEvent linkEvent) {
+ return getIntentsByPort(
+ linkEvent.getSrc().getDpid(),
+ linkEvent.getSrc().getNumber());
+ }
- public Collection<PathIntent> getIntentsByPort(Long dpid, Long port) {
- HashMap<Long, HashSet<PathIntent>> portToIntents = intents.get(dpid);
- if (portToIntents != null) {
- HashSet<PathIntent> targetIntents = portToIntents.get(port);
- if (targetIntents != null) {
- return Collections.unmodifiableCollection(targetIntents);
- }
- }
- return new HashSet<>();
- }
+ public Collection<PathIntent> getIntentsByPort(Long dpid, Long port) {
+ HashMap<Long, HashSet<PathIntent>> portToIntents = intents.get(dpid);
+ if (portToIntents != null) {
+ HashSet<PathIntent> targetIntents = portToIntents.get(port);
+ if (targetIntents != null) {
+ return Collections.unmodifiableCollection(targetIntents);
+ }
+ }
+ return new HashSet<>();
+ }
- public Collection<PathIntent> getIntentsByDpid(Long dpid) {
- HashSet<PathIntent> result = new HashSet<>();
- HashMap<Long, HashSet<PathIntent>> portToIntents = intents.get(dpid);
- if (portToIntents != null) {
- for (HashSet<PathIntent> targetIntents: portToIntents.values()) {
- result.addAll(targetIntents);
- }
- }
- return result;
- }
+ public Collection<PathIntent> getIntentsByDpid(Long dpid) {
+ HashSet<PathIntent> result = new HashSet<>();
+ HashMap<Long, HashSet<PathIntent>> portToIntents = intents.get(dpid);
+ if (portToIntents != null) {
+ for (HashSet<PathIntent> targetIntents : portToIntents.values()) {
+ result.addAll(targetIntents);
+ }
+ }
+ return result;
+ }
- /**
- * calculate available bandwidth of specified link
- * @param link
- * @return
- */
- public Double getAvailableBandwidth(Link link) {
- if (link == null) return null;
- Double bandwidth = link.getCapacity();
- LinkEvent linkEvent = new LinkEvent(link);
- if (!bandwidth.isInfinite()) {
- for (PathIntent intent: getIntentsByLink(linkEvent)) {
- Double intentBandwidth = intent.getBandwidth();
- if (intentBandwidth == null || intentBandwidth.isInfinite() || intentBandwidth.isNaN())
- continue;
- bandwidth -= intentBandwidth;
- }
- }
- return bandwidth;
- }
+ /**
+ * calculate available bandwidth of specified link
+ *
+ * @param link
+ * @return
+ */
+ public Double getAvailableBandwidth(Link link) {
+ if (link == null) return null;
+ Double bandwidth = link.getCapacity();
+ LinkEvent linkEvent = new LinkEvent(link);
+ if (!bandwidth.isInfinite()) {
+ for (PathIntent intent : getIntentsByLink(linkEvent)) {
+ Double intentBandwidth = intent.getBandwidth();
+ if (intentBandwidth == null || intentBandwidth.isInfinite() || intentBandwidth.isNaN())
+ continue;
+ bandwidth -= intentBandwidth;
+ }
+ }
+ return bandwidth;
+ }
}