Class DepthFirstScanner

  • All Implemented Interfaces:
    Iterable<FlowNode>, Iterator<FlowNode>, Filterator<FlowNode>

    public class DepthFirstScanner
    extends AbstractFlowScanner
    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.

    Sam Van Oort
    • Constructor Detail

      • DepthFirstScanner

        public DepthFirstScanner()
    • Method Detail

      • reset

        protected void reset()
        Description copied from class: AbstractFlowScanner
        Reset internal state so that we can begin walking a new flow graph Public APIs need to invoke this before searches
        Specified by:
        reset in class AbstractFlowScanner
      • possibleParallelStart

        protected boolean possibleParallelStart​(FlowNode f)
      • next

        protected FlowNode next​(@NonNull
                                FlowNode current,
                                Collection<FlowNode> blackList)
        Description copied from class: AbstractFlowScanner
        Actual meat of the iteration, get the next node to visit, using and updating state as needed
        Specified by:
        next in class AbstractFlowScanner
        current - Current node to use in generating next value
        blackList - Nodes that are not eligible for visiting
        Next node to visit, or null if we've exhausted the node list