Class DepthFirstSearch

java.lang.Object
org.dbunit.util.search.DepthFirstSearch
All Implemented Interfaces:
ISearchAlgorithm

public class DepthFirstSearch extends Object implements ISearchAlgorithm
Search using depth-first algorithm.

An instance of this class must be used only once, as it maintains the internal state of the search.

Since:
2.4.0
Version:
$Revision$ $Date$
Author:
gommma (gommma AT users.sourceforge.net), Last changed by: $Author$
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
      Logger for this class.
  • Constructor Details

    • DepthFirstSearch

      public DepthFirstSearch()
      Creates a new depth-first algorithm using the maximum search depth for recursing over the nodes.
    • DepthFirstSearch

      public DepthFirstSearch(int searchDepth)
      Creates a new depth-first algorithm
      Parameters:
      searchDepth - The search depth to be used when traversing the nodes recursively. Must be > 0.
      Since:
      2.4
  • Method Details

    • search

      public Set search(Object[] nodesFrom, ISearchCallback callback) throws SearchException
      Alternative option to search() that takes an array of nodes as input (instead of a Set)
      Parameters:
      nodesFrom - the nodes to start the search from.
      callback - the callback used to help the search.
      Returns:
      the set of nodes found by the search, including the input nodes and their dependencies.
      Throws:
      SearchException - if an exception occurs while getting the edges.
      See Also:
    • search

      public Set search(Set nodesFrom, ISearchCallback callback) throws SearchException
      Description copied from interface: ISearchAlgorithm
      Search all nodes that originates from a set of nodes.
      Specified by:
      search in interface ISearchAlgorithm
      Parameters:
      nodesFrom - input nodes
      callback - helper callback
      Returns:
      all nodes, in the right dependent order (like a LinkedHashSet)
      Throws:
      SearchException - if the search fails.
      See Also: