a few more generics
git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3124 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
04de4843ce
commit
f977bbc6aa
|
@ -24,13 +24,10 @@ import com.ibm.wala.util.debug.Assertions;
|
|||
import com.ibm.wala.util.graph.Graph;
|
||||
|
||||
/**
|
||||
* This class searches depth-first search for node that matches some
|
||||
* criteria.
|
||||
* If found, it reports a path to the first node found.
|
||||
* This class searches depth-first search for node that matches some criteria. If found, it reports a path to the first node found.
|
||||
*
|
||||
* This class follows the outNodes of the
|
||||
* graph nodes to define the graph, but this behavior can be changed
|
||||
* by overriding the getConnected method.
|
||||
* This class follows the outNodes of the graph nodes to define the graph, but this behavior can be changed by overriding the
|
||||
* getConnected method.
|
||||
*/
|
||||
public class DFSPathFinder<T> extends Stack<T> {
|
||||
public static final long serialVersionUID = 9939900773328288L;
|
||||
|
@ -61,8 +58,7 @@ public class DFSPathFinder<T> extends Stack<T> {
|
|||
private boolean initialized = false;
|
||||
|
||||
/**
|
||||
* Construct a depth-first enumerator starting with a particular node
|
||||
* in a directed graph.
|
||||
* Construct a depth-first enumerator starting with a particular node in a directed graph.
|
||||
*
|
||||
* @param G the graph whose nodes to enumerate
|
||||
* @throws IllegalArgumentException if G is null
|
||||
|
@ -80,8 +76,7 @@ public class DFSPathFinder<T> extends Stack<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* Construct a depth-first enumerator across the (possibly
|
||||
* improper) subset of nodes reachable from the nodes in the given
|
||||
* Construct a depth-first enumerator across the (possibly improper) subset of nodes reachable from the nodes in the given
|
||||
* enumeration.
|
||||
*
|
||||
* @param nodes the set of nodes from which to start searching
|
||||
|
@ -102,18 +97,17 @@ public class DFSPathFinder<T> extends Stack<T> {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return a List of nodes that specifies the first path found
|
||||
* from a root to a node accepted by the filter. Returns null if
|
||||
* no path found.
|
||||
* @return a List of nodes that specifies the first path found from a root to a node accepted by the filter. Returns null if no
|
||||
* path found.
|
||||
*/
|
||||
public List find() {
|
||||
public List<T> find() {
|
||||
if (!initialized) {
|
||||
init();
|
||||
}
|
||||
while (hasNext()) {
|
||||
T n = peek();
|
||||
if (filter.accepts(n)) {
|
||||
List path = currentPath();
|
||||
List<T> path = currentPath();
|
||||
advance();
|
||||
return path;
|
||||
}
|
||||
|
@ -141,13 +135,16 @@ public class DFSPathFinder<T> extends Stack<T> {
|
|||
|
||||
/**
|
||||
* Method getPendingChildren.
|
||||
*
|
||||
* @return Object
|
||||
*/
|
||||
private Iterator<? extends T> getPendingChildren(T n) {
|
||||
return pendingChildren.get(n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method setPendingChildren.
|
||||
*
|
||||
* @param v
|
||||
* @param iterator
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue