Change PathIntent class to be self-contained class
Change-Id: I67e768bd6be8430bb83b48963cf3c7cc4c592790
diff --git a/src/main/java/net/onrc/onos/intent/PathIntents.java b/src/main/java/net/onrc/onos/intent/PathIntents.java
index 9371fd5..8d712e3 100644
--- a/src/main/java/net/onrc/onos/intent/PathIntents.java
+++ b/src/main/java/net/onrc/onos/intent/PathIntents.java
@@ -7,6 +7,7 @@
import java.util.LinkedList;
import net.onrc.onos.ofcontroller.networkgraph.Link;
+import net.onrc.onos.ofcontroller.networkgraph.NetworkGraph;
/**
* @author Toshio Koide (t-koide@onlab.us)
@@ -14,10 +15,15 @@
public class PathIntents {
protected LinkedList<PathIntent> intents = new LinkedList<PathIntent>();
protected HashMap<Link, HashSet<PathIntent>> linkToIntents = new HashMap<Link, HashSet<PathIntent>>();
+ protected NetworkGraph graph;
+
+ public PathIntents(NetworkGraph graph) {
+ this.graph = graph;
+ }
public void addIntent(PathIntent intent) {
intents.add(intent);
- for (Link link: intent.getPath()) {
+ for (Link link: intent.getPath(graph)) {
HashSet<PathIntent> value = linkToIntents.get(link);
if (value == null) {
value = new HashSet<PathIntent>();
@@ -26,10 +32,10 @@
value.add(intent);
}
}
-
+
public void removeIntent(PathIntent intent) {
intents.remove(intent);
- for (Link link: intent.getPath()) {
+ for (Link link: intent.getPath(graph)) {
HashSet<PathIntent> value = linkToIntents.get(link);
value.remove(intent);
}