Package repast.simphony.engine.graph
Class EngineGraphUtilities
java.lang.Object
repast.simphony.engine.graph.EngineGraphUtilities
- Author:
- milesparker
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> void
breadthFirstMap
(Executor<T> visitor, Traverser<T> traverser, T root) Performs a breadth-first traversal applying the given executor to the objects returned by the traverser.static <T> T
breadthFirstSearch
(org.apache.commons.collections15.Predicate<T> checker, Traverser<T> traverser, T root) Performs a breadth-first traversal, applying the given rule to the objects returned by the traverser.
-
Constructor Details
-
EngineGraphUtilities
public EngineGraphUtilities()
-
-
Method Details
-
breadthFirstMap
Performs a breadth-first traversal applying the given executor to the objects returned by the traverser. It is up to the traverser to handle how the objects are returned and to prevent repeated execution on the same nodes (if so desired). For example, it is up to the traverser to not return the same node in a graph multiple times, this method performs no checks for this type of situation. Note: This passes null to theTraverser.getSuccessors(E, E)
method for the value of the previous node. This is implemented as a call to#breadthFirstSearch(Rule, Traverser, T)
with the calling the Executor and always returningRuleResult#INVALID_CONTINUE
.- Parameters:
visitor
- the executor which receives the objects from the traversertraverser
- the object handles gathering and returning the objects that will be passed to the Executorroot
- the object to begin the traversal with
-
breadthFirstSearch
public static <T> T breadthFirstSearch(org.apache.commons.collections15.Predicate<T> checker, Traverser<T> traverser, T root) Performs a breadth-first traversal, applying the given rule to the objects returned by the traverser. It is up to the traverser to handle how the objects are returned and to prevent repeated execution on the same nodes (if so desired). For example, it is up to the traverser to not return the same node in a graph multiple times, this method performs no checks for this type of situation. Note: This passes null to theTraverser.getSuccessors(E, E)
method for the value of the previous node.- Parameters:
checker
-traverser
- the object handles gathering and returning the objects that will be passed to the Executorroot
- the object to begin the traversal with
-