Latest bnd code
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1350613 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/aQute/libg/tarjan/Tarjan.java b/bundleplugin/src/main/java/aQute/libg/tarjan/Tarjan.java
index 3d05b76..cef8b23 100644
--- a/bundleplugin/src/main/java/aQute/libg/tarjan/Tarjan.java
+++ b/bundleplugin/src/main/java/aQute/libg/tarjan/Tarjan.java
@@ -15,43 +15,42 @@
public Node(T name) {
this.name = name;
}
-
+
public String toString() {
return name + "{" + index + "," + low + "}";
}
}
- private int index = 0;
- private List<Node> stack = new ArrayList<Node>();
+ private int index = 0;
+ private List<Node> stack = new ArrayList<Node>();
private Set<Set<T>> scc = new HashSet<Set<T>>();
- private Node root = new Node(null);
+ private Node root = new Node(null);
-
-// public ArrayList<ArrayList<Node>> tarjan(Node v, AdjacencyList list){
-// v.index = index;
-// v.lowlink = index;
-// index++;
-// stack.add(0, v);
-// for(Edge e : list.getAdjacent(v)){
-// Node n = e.to;
-// if(n.index == -1){
-// tarjan(n, list);
-// v.lowlink = Math.min(v.lowlink, n.lowlink);
-// }else if(stack.contains(n)){
-// v.lowlink = Math.min(v.lowlink, n.index);
-// }
-// }
-// if(v.lowlink == v.index){
-// Node n;
-// ArrayList<Node> component = new ArrayList<Node>();
-// do{
-// n = stack.remove(0);
-// component.add(n);
-// }while(n != v);
-// SCC.add(component);
-// }
-// return SCC;
-// }
+ // public ArrayList<ArrayList<Node>> tarjan(Node v, AdjacencyList list){
+ // v.index = index;
+ // v.lowlink = index;
+ // index++;
+ // stack.add(0, v);
+ // for(Edge e : list.getAdjacent(v)){
+ // Node n = e.to;
+ // if(n.index == -1){
+ // tarjan(n, list);
+ // v.lowlink = Math.min(v.lowlink, n.lowlink);
+ // }else if(stack.contains(n)){
+ // v.lowlink = Math.min(v.lowlink, n.index);
+ // }
+ // }
+ // if(v.lowlink == v.index){
+ // Node n;
+ // ArrayList<Node> component = new ArrayList<Node>();
+ // do{
+ // n = stack.remove(0);
+ // component.add(n);
+ // }while(n != v);
+ // SCC.add(component);
+ // }
+ // return SCC;
+ // }
void tarjan(Node v) {
v.index = index;
@@ -68,7 +67,7 @@
}
}
- if (v!=root && v.low == v.index) {
+ if (v != root && v.low == v.index) {
Set<T> component = new HashSet<T>();
Node n;
do {
@@ -80,7 +79,7 @@
}
Set<Set<T>> getResult(Map<T, ? extends Collection<T>> graph) {
- Map<T, Node> index = new HashMap<T, Node>();
+ Map<T,Node> index = new HashMap<T,Node>();
for (Map.Entry<T, ? extends Collection<T>> entry : graph.entrySet()) {
Node node = getNode(index, entry.getKey());
@@ -92,7 +91,7 @@
return scc;
}
- private Node getNode(Map<T, Node> index, T key) {
+ private Node getNode(Map<T,Node> index, T key) {
Node node = index.get(key);
if (node == null) {
node = new Node(key);
@@ -101,7 +100,7 @@
return node;
}
- public static <T> Collection<? extends Collection<T>> tarjan(Map<T, ? extends Collection<T>> graph) {
+ public static <T> Collection< ? extends Collection<T>> tarjan(Map<T, ? extends Collection<T>> graph) {
Tarjan<T> tarjan = new Tarjan<T>();
return tarjan.getResult(graph);
}