Class DepthFirstScanner
java.lang.Object
org.jenkinsci.plugins.workflow.graphanalysis.AbstractFlowScanner
org.jenkinsci.plugins.workflow.graphanalysis.DepthFirstScanner
Does a simple and somewhat efficient depth-first search of all FlowNodes in the DAG.
Iteration order: depth-first search, revisiting parallel branches once done.
The behavior is analogous to FlowGraphWalker but faster.
With parallel branches, the first branch is explored, then remaining branches are explored in order.
This keeps ordering compatibility with FlowGraphWalker - it can be a drop-in replacement.
- Author:
- Sam Van Oort
-
Field Summary
FieldsFields inherited from class org.jenkinsci.plugins.workflow.graphanalysis.AbstractFlowScanner
MAX_LIST_CHECK_SIZE, myBlackList, myCurrent, myNext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FlowNodenext(FlowNode current, Collection<FlowNode> blackList) Actual meat of the iteration, get the next node to visit, using and updating state as neededprotected booleanprotected voidreset()Reset internal state so that we can begin walking a new flow graph Public APIs need to invoke this before searchesprotected voidsetHeads(Collection<FlowNode> heads) Set up to begin flow scanning using the filteredHeads as starting points This method makes several assumptions: -AbstractFlowScanner.reset()has already been invoked to reset state - filteredHeads has already had any points inAbstractFlowScanner.myBlackListremoved - none of the filteredHeads are nullprotected booleantestCandidate(FlowNode f, Collection<FlowNode> blackList) Methods inherited from class org.jenkinsci.plugins.workflow.graphanalysis.AbstractFlowScanner
allNodes, allNodes, convertToFastCheckable, filter, filteredNodes, filteredNodes, filteredNodes, filteredNodes, findFirstMatch, findFirstMatch, findFirstMatch, findFirstMatch, hasNext, iterator, next, remove, setup, setup, setup, setup, visitAll, visitAllMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
queue
-
visited
-
-
Constructor Details
-
DepthFirstScanner
public DepthFirstScanner()
-
-
Method Details
-
reset
protected void reset()Description copied from class:AbstractFlowScannerReset internal state so that we can begin walking a new flow graph Public APIs need to invoke this before searches- Specified by:
resetin classAbstractFlowScanner
-
setHeads
Description copied from class:AbstractFlowScannerSet up to begin flow scanning using the filteredHeads as starting points This method makes several assumptions: -AbstractFlowScanner.reset()has already been invoked to reset state - filteredHeads has already had any points inAbstractFlowScanner.myBlackListremoved - none of the filteredHeads are null- Specified by:
setHeadsin classAbstractFlowScanner- Parameters:
heads- Head nodes that have been filtered against denyList
-
possibleParallelStart
-
testCandidate
-
next
Description copied from class:AbstractFlowScannerActual meat of the iteration, get the next node to visit, using and updating state as needed- Specified by:
nextin classAbstractFlowScanner- Parameters:
current- Current node to use in generating next valueblackList- Nodes that are not eligible for visiting- Returns:
- Next node to visit, or null if we've exhausted the node list
-