diff options
author | Janak Ramakrishnan <janakr@google.com> | 2015-08-19 01:48:59 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2015-08-20 14:47:20 +0000 |
commit | d34667f24a6f748677ee425ba37af28c57be193d (patch) | |
tree | 48fae87e8aab4834ec1e57c839e738d4edd07e98 /src/main/java | |
parent | d1ccf34c23bfa668e3e3367b61847e173219cbb4 (diff) |
Clean up some testing-only and single-call codepaths in Digraph code.
--
MOS_MIGRATED_REVID=100985124
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/graph/Digraph.java | 13 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/graph/DotOutputVisitor.java | 25 |
2 files changed, 4 insertions, 34 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/graph/Digraph.java b/src/main/java/com/google/devtools/build/lib/graph/Digraph.java index b1ff09a469..3371a3684b 100644 --- a/src/main/java/com/google/devtools/build/lib/graph/Digraph.java +++ b/src/main/java/com/google/devtools/build/lib/graph/Digraph.java @@ -1034,14 +1034,7 @@ public final class Digraph<T> implements Cloneable { visitor.endVisit(); } - /** - * A visitation over the graph that visits all nodes and edges in some order - * such that each node is visited before any edge coming out of that node; - * the order is otherwise unspecified. - * - * @param startNodes the set of nodes from which to begin the visitation. - */ - public void visitNodesBeforeEdges(GraphVisitor<T> visitor, + private void visitNodesBeforeEdges(GraphVisitor<T> visitor, Iterable<Node<T>> startNodes) { visitor.beginVisit(); for (Node<T> fromNode: startNodes) { @@ -1054,7 +1047,9 @@ public final class Digraph<T> implements Cloneable { } /** - * Equivalent to {@code visitNodesBeforeEdges(visitor, getNodes())}. + * A visitation over the graph that visits all nodes and edges in some order + * such that each node is visited before any edge coming out of that node; + * the order is otherwise unspecified. */ public void visitNodesBeforeEdges(GraphVisitor<T> visitor) { visitNodesBeforeEdges(visitor, nodes.values()); diff --git a/src/main/java/com/google/devtools/build/lib/graph/DotOutputVisitor.java b/src/main/java/com/google/devtools/build/lib/graph/DotOutputVisitor.java index 2d18ac2d2e..a99bcaf482 100644 --- a/src/main/java/com/google/devtools/build/lib/graph/DotOutputVisitor.java +++ b/src/main/java/com/google/devtools/build/lib/graph/DotOutputVisitor.java @@ -65,29 +65,4 @@ public class DotOutputVisitor<T> implements GraphVisitor<T> { public void visitNode(Node<T> node) { out.println("\"" + disp.serialize(node) + "\""); } - - /****************************************************************** - * * - * Factories * - * * - ******************************************************************/ - - /** - * Create a DotOutputVisitor for output to a writer; uses default - * LabelSerializer. - */ - public static <U> DotOutputVisitor<U> create(PrintWriter writer) { - return new DotOutputVisitor<U>(writer, new DefaultLabelSerializer<U>()); - } - - /** - * The default implementation of LabelSerializer simply serializes - * each node using its toString method. - */ - private static class DefaultLabelSerializer<T> implements LabelSerializer<T> { - @Override - public String serialize(Node<T> node) { - return node.getLabel().toString(); - } - } } |