public class Searcher<N>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BREADTHFIRST
Constant representing a BREADTH-FIRST search.
|
static int |
DEPTHFIRST
Constant representing a DEPTH-FIRST search.
|
| Constructor and Description |
|---|
Searcher(int numberOfThreads,
org.processmining.framework.util.search.NodeExpander<N> expander,
org.processmining.framework.util.search.ExpandCollection<N> expandCollection)
Instantiates a searcher.
|
Searcher(int numberOfThreads,
org.processmining.framework.util.search.NodeExpander<N> expander,
int searchType)
Instantiates a searcher.
|
Searcher(org.processmining.framework.util.search.NodeExpander<N> expander,
org.processmining.framework.util.search.ExpandCollection<N> expandCollection)
Instantiates a searcher.
|
Searcher(org.processmining.framework.util.search.NodeExpander<N> expander,
int searchType)
Instantiates a searcher.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addInitialNodes(java.util.Collection<N> initialNodes)
Sets the initial nodes of the search tree.
|
void |
addInitialNodes(N... initialNodes)
Sets the initial nodes of the search tree.
|
void |
startSearch(java.util.concurrent.ExecutorService executor,
java.util.Collection<N> resultCollection)
A call to this method initiates the search.
|
public static final int DEPTHFIRST
public static final int BREADTHFIRST
public Searcher(int numberOfThreads,
org.processmining.framework.util.search.NodeExpander<N> expander,
int searchType)
numberOfThreads - specifies the number of threads to use. If unsure how to set
this value, use the other constructor without this parameterexpander - The expander that will be used to expand each search node and
process the leafs of the search treesearchType - the type of search, either DEPTHFIRST or BREADTHFIRSTpublic Searcher(org.processmining.framework.util.search.NodeExpander<N> expander, int searchType)
Runtime.getRuntime().availableProcessors()expander - The expander that will be used to expand each search node and
process the leafs of the search treesearchType - the type of search, either DEPTHFIRST or BREADTHFIRSTpublic Searcher(int numberOfThreads,
org.processmining.framework.util.search.NodeExpander<N> expander,
org.processmining.framework.util.search.ExpandCollection<N> expandCollection)
numberOfThreads - specifies the number of threads to use. If unsure how to set
this value, use the other constructor without this parameterexpander - The expander that will be used to expand each search node and
process the leafs of the search treeexpandCollection - the collection to store nodes that need to be expandedpublic Searcher(org.processmining.framework.util.search.NodeExpander<N> expander, org.processmining.framework.util.search.ExpandCollection<N> expandCollection)
Runtime.getRuntime().availableProcessors()expander - The expander that will be used to expand each search node and
process the leafs of the search treeexpandCollection - the collection to store nodes that need to be expandedpublic void addInitialNodes(java.util.Collection<N> initialNodes)
initialNodes - the collection of initial nodes.public void addInitialNodes(N... initialNodes)
initialNodes - zero or more initial nodes.public void startSearch(java.util.concurrent.ExecutorService executor,
java.util.Collection<N> resultCollection)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
executor - The executor in which the searcher can schedule it's threads.
If called from a plugin, use context.getExector() to pass to
this method.resultCollection - The collection in which the final result is stored by the
processLeaf method of the node expander. Note that the
searcher does not change this collection in any way, nor does
it handle any necessary synchronization.java.lang.InterruptedException - If one of the threads was interupted;java.util.concurrent.ExecutionException - If one of the threads threw an exception;