public abstract class AbstractBreadthFirstThrowingTraversal<Node,E extends Throwable> extends Object
In cases where the cost of allocating Iterable
s for node dependencies is
expensive/costly, ConsumingTraverser.breadthFirst(Iterable, ForEachSuccessorFunction)
provides a lighter-weight option.
TODO: Implement via ConsumingTraverser
.
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractBreadthFirstThrowingTraversal.StaticBreadthFirstTraversal<Node> |
static interface |
AbstractBreadthFirstThrowingTraversal.Visitor<Node,E extends Throwable>
This will typically be implemented as a lambda passed to
traverse(Object, Visitor) or
traverse(Iterable, Visitor) |
Constructor and Description |
---|
AbstractBreadthFirstThrowingTraversal(Iterable<? extends Node> initialNodes) |
AbstractBreadthFirstThrowingTraversal(Node initialNode) |
Modifier and Type | Method and Description |
---|---|
protected void |
onComplete()
Override this method with any logic that should be run when
start() completes. |
void |
start() |
static <Node> void |
traverse(Iterable<? extends Node> initialNodes,
AbstractBreadthFirstThrowingTraversal.Visitor<Node,RuntimeException> visitor)
Traverse a graph without explicitly creating a
new
AbstractBreadthFirstThrowingTraversal and overriding visit(Object) |
static <Node> void |
traverse(Node initialNode,
AbstractBreadthFirstThrowingTraversal.Visitor<Node,RuntimeException> visitor)
Traverse a graph without explicitly creating a
new
AbstractBreadthFirstThrowingTraversal and overriding visit(Object) |
abstract Iterable<? extends Node> |
visit(Node node)
To perform a full traversal of the the
initialNode 's transitive dependencies, this
function should return all of node 's direct dependencies. |
public AbstractBreadthFirstThrowingTraversal(Node initialNode)
protected void onComplete() throws E extends Throwable
start()
completes.public abstract Iterable<? extends Node> visit(Node node) throws E extends Throwable
initialNode
's transitive dependencies, this
function should return all of node
's direct dependencies.public static <Node> void traverse(Node initialNode, AbstractBreadthFirstThrowingTraversal.Visitor<Node,RuntimeException> visitor)
new
AbstractBreadthFirstThrowingTraversal
and overriding visit(Object)
visitor
- Typically a lambda expressionpublic static <Node> void traverse(Iterable<? extends Node> initialNodes, AbstractBreadthFirstThrowingTraversal.Visitor<Node,RuntimeException> visitor)
new
AbstractBreadthFirstThrowingTraversal
and overriding visit(Object)
visitor
- Typically a lambda expression