Class FlowScanningUtils

java.lang.Object
org.jenkinsci.plugins.workflow.graphanalysis.FlowScanningUtils

public final class FlowScanningUtils extends Object
Library of common functionality when analyzing/walking flow graphs
Author:
Sam Van Oort
  • Field Details

    • MATCH_BLOCK_START

      public static final com.google.common.base.Predicate<FlowNode> MATCH_BLOCK_START
    • TIME_ORDER_COMPARATOR

      public static final Comparator<FlowNode> TIME_ORDER_COMPARATOR
      Sorts flownodes putting the one begun last (oldest startTime) at the end, with null times last because likely they represent the newest nodes with a TimingAction not attached yet.
    • ID_ORDER_COMPARATOR

      public static final Comparator<FlowNode> ID_ORDER_COMPARATOR
  • Method Details

    • hasActionPredicate

      @NonNull public static com.google.common.base.Predicate<FlowNode> hasActionPredicate(@NonNull Class<? extends Action> actionClass)
      Create a predicate that will match on all FlowNodes having a specific action present
      Parameters:
      actionClass - Action class to look for
      Returns:
      Predicate that will match when FlowNode has the action given
    • fetchEnclosingBlocks

      @NonNull @Deprecated public static Filterator<FlowNode> fetchEnclosingBlocks(@NonNull FlowNode f)
      Deprecated.
      Returns all BlockStartNodes enclosing the given FlowNode, starting from the inside out. This is useful if we want to obtain information about its scope, such as the workspace, parallel branch, or label. Warning: while this is efficient for one node, batch operations are far more efficient when handling many nodes.

      Deprecated, prefer FlowNode.iterateEnclosingBlocks() instead, possibly using FilteratorImpl(Iterator, Predicate) or Guava or Java 8 APIs if filtering needed.

      Parameters:
      f - FlowNode to start from.
      Returns:
      Iterator that returns all enclosing BlockStartNodes from the inside out.