Class EngineGraphUtilities

java.lang.Object
repast.simphony.engine.graph.EngineGraphUtilities

public class EngineGraphUtilities extends Object
Author:
milesparker
  • Constructor Details

    • EngineGraphUtilities

      public EngineGraphUtilities()
  • Method Details

    • breadthFirstMap

      public static <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. 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 the Traverser.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 returning RuleResult#INVALID_CONTINUE.

      Parameters:
      visitor - the executor which receives the objects from the traverser
      traverser - the object handles gathering and returning the objects that will be passed to the Executor
      root - 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 the Traverser.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 Executor
      root - the object to begin the traversal with