Code Review
/
yangtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
BUG-7052: Move TopologicalSort to util package
[yangtools.git]
/
yang
/
yang-parser-impl
/
src
/
main
/
java
/
org
/
opendaylight
/
yangtools
/
yang
/
parser
/
util
/
TopologicalSort.java
diff --git
a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/TopologicalSort.java
b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/TopologicalSort.java
index 42db14607eed2e7b4d20dda9bd9156b99050a1e1..2f7377d178f18187cea60dba841266232c083764 100644
(file)
--- a/
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/TopologicalSort.java
+++ b/
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/TopologicalSort.java
@@
-15,8
+15,11
@@
import java.util.Objects;
import java.util.Set;
/**
import java.util.Set;
/**
- * Utility class that provides topological sort
+ * Utility class that provides topological sort.
+ *
+ * @deprecated Use {@link org.opendaylight.yangtools.util.TopologicalSort} instead.
*/
*/
+@Deprecated
public final class TopologicalSort {
/**
public final class TopologicalSort {
/**
@@
-34,7
+37,7
@@
public final class TopologicalSort {
* @throws IllegalStateException
* when cycle is present in the graph
*/
* @throws IllegalStateException
* when cycle is present in the graph
*/
- public static List<Node> sort(Set<Node> nodes) {
+ public static List<Node> sort(
final
Set<Node> nodes) {
List<Node> sortedNodes = Lists.newArrayList();
Set<Node> dependentNodes = getDependentNodes(nodes);
List<Node> sortedNodes = Lists.newArrayList();
Set<Node> dependentNodes = getDependentNodes(nodes);
@@
-60,7
+63,7
@@
public final class TopologicalSort {
return sortedNodes;
}
return sortedNodes;
}
- private static Set<Node> getDependentNodes(Set<Node> nodes) {
+ private static Set<Node> getDependentNodes(
final
Set<Node> nodes) {
Set<Node> dependentNodes = Sets.newHashSet();
for (Node n : nodes) {
if (n.getOutEdges().isEmpty()) {
Set<Node> dependentNodes = Sets.newHashSet();
for (Node n : nodes) {
if (n.getOutEdges().isEmpty()) {
@@
-70,7
+73,7
@@
public final class TopologicalSort {
return dependentNodes;
}
return dependentNodes;
}
- private static void detectCycles(Set<Node> nodes) {
+ private static void detectCycles(
final
Set<Node> nodes) {
// Detect cycles
boolean cycle = false;
Node cycledNode = null;
// Detect cycles
boolean cycle = false;
Node cycledNode = null;
@@
-125,7
+128,7
@@
public final class TopologicalSort {
return outEdges;
}
return outEdges;
}
- public void addEdge(Node to) {
+ public void addEdge(
final
Node to) {
Edge e = new EdgeImpl(this, to);
outEdges.add(e);
to.getInEdges().add(e);
Edge e = new EdgeImpl(this, to);
outEdges.add(e);
to.getInEdges().add(e);
@@
-139,7
+142,7
@@
public final class TopologicalSort {
private final Node from;
private final Node to;
private final Node from;
private final Node to;
- public EdgeImpl(
Node from,
Node to) {
+ public EdgeImpl(
final Node from, final
Node to) {
this.from = from;
this.to = to;
}
this.from = from;
this.to = to;
}
@@
-164,7
+167,7
@@
public final class TopologicalSort {
}
@Override
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(
final
Object obj) {
if (this == obj) {
return true;
}
if (this == obj) {
return true;
}