Class ExecutionPlan
java.lang.Object
edu.umd.cs.findbugs.plan.ExecutionPlan
A plan for executing Detectors on an application. Automatically assigns
Detectors to passes and orders Detectors within each pass based on ordering
constraints specified in the plugin descriptor(s).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Set<DetectorFactory> static final booleanprivate DetectorFactoryChooserprivate Map<String, DetectorFactory> private List<DetectorOrderingConstraint> private List<DetectorOrderingConstraint> private LinkedList<AnalysisPass> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate DetectorNodeaddOrCreateDetectorNode(DetectorFactory factory, Map<String, DetectorNode> nodeMap, ConstraintGraph constraintGraph) private Set<DetectorNode> addOrCreateDetectorNodes(DetectorFactorySelector selector, Map<String, DetectorNode> nodeMap, Set<DetectorFactory> factorySet, ConstraintGraph constraintGraph) private voidaddPass(AnalysisPass pass) voidAdd a Plugin whose Detectors should be added to the execution plan.private voidappendDetectorsToPass(Collection<DetectorFactory> detectorSet, AnalysisPass pass) private voidappendToPass(DetectorFactory factory, AnalysisPass pass) Append a DetectorFactory to the end position in an AnalysisPass.private voidassignToPass(DetectorFactory factory, AnalysisPass pass) Make a DetectorFactory a member of an AnalysisPass.voidbuild()Build the execution plan.private ConstraintGraphbuildConstraintGraph(Map<String, DetectorNode> nodeMap, Set<DetectorFactory> factorySet, List<DetectorOrderingConstraint> constraintList) Build a constraint graph.private voidbuildPassList(ConstraintGraph constraintGraph) private static <T> voidcopyTo(Iterator<T> iter, Collection<T> dest) private voidcreateConstraintEdges(ConstraintGraph result, Set<DetectorNode> earlierSet, Set<DetectorNode> laterSet, DetectorOrderingConstraint constraint) voiddispose()private voiddumpGraph(ConstraintGraph graph) intGet the number of passes in the execution plan.private Set<DetectorFactory> booleanbooleanstatic voidGet an Iterator over the AnalysisPasses.private voidprint()private Set<DetectorFactory> selectDetectors(DetectorFactorySelector selector, Set<DetectorFactory> candidateSet) voidsetDetectorFactoryChooser(DetectorFactoryChooser factoryChooser) Set the DetectorFactoryChooser to use to select which detectors to enable.private voidsortPass(List<DetectorOrderingConstraint> constraintList, Map<String, DetectorFactory> factoryMap, AnalysisPass pass)
-
Field Details
-
DEBUG
public static final boolean DEBUG -
pluginList
-
factoryChooser
-
passList
-
factoryMap
-
interPassConstraintList
-
intraPassConstraintList
-
assignedToPassSet
-
-
Constructor Details
-
ExecutionPlan
public ExecutionPlan()Constructor. Creates an empty plan.
-
-
Method Details
-
dispose
public void dispose() -
setDetectorFactoryChooser
Set the DetectorFactoryChooser to use to select which detectors to enable. This must be called before any Plugins are added to the execution plan. -
isActive
-
isActive
-
addPlugin
Add a Plugin whose Detectors should be added to the execution plan.- Throws:
OrderingConstraintException
-
build
Build the execution plan. Using the ordering constraints specified in the plugin descriptor(s), assigns Detectors to passes and orders the Detectors within those passes.- Throws:
OrderingConstraintException
-
passIterator
Get an Iterator over the AnalysisPasses. -
getNumPasses
public int getNumPasses()Get the number of passes in the execution plan.- Returns:
- the number of passes in the execution plan
-
copyTo
-
buildConstraintGraph
private ConstraintGraph buildConstraintGraph(Map<String, DetectorNode> nodeMap, Set<DetectorFactory> factorySet, List<DetectorOrderingConstraint> constraintList) Build a constraint graph. This represents ordering constraints between Detectors. A topological sort of the constraint graph will yield a correct ordering of the detectors (which may mean either passes or an ordering within a single pass, depending on whether the constraints are inter-pass or intra-pass).- Parameters:
nodeMap- map to be populated with detector class names to constraint graph nodes for those detectorsfactorySet- build the graph using these DetectorFactories as nodesconstraintList- List of ordering constraints- Returns:
- the ConstraintGraph
-
selectDetectors
private Set<DetectorFactory> selectDetectors(DetectorFactorySelector selector, Set<DetectorFactory> candidateSet) -
addOrCreateDetectorNodes
private Set<DetectorNode> addOrCreateDetectorNodes(DetectorFactorySelector selector, Map<String, DetectorNode> nodeMap, Set<DetectorFactory> factorySet, ConstraintGraph constraintGraph) -
addOrCreateDetectorNode
private DetectorNode addOrCreateDetectorNode(DetectorFactory factory, Map<String, DetectorNode> nodeMap, ConstraintGraph constraintGraph) -
createConstraintEdges
private void createConstraintEdges(ConstraintGraph result, Set<DetectorNode> earlierSet, Set<DetectorNode> laterSet, DetectorOrderingConstraint constraint) -
buildPassList
- Throws:
OrderingConstraintException
-
addPass
-
sortPass
private void sortPass(List<DetectorOrderingConstraint> constraintList, Map<String, DetectorFactory> factoryMap, AnalysisPass pass) throws OrderingConstraintException - Throws:
OrderingConstraintException
-
getUnassignedSet
-
assignToPass
Make a DetectorFactory a member of an AnalysisPass. -
appendToPass
Append a DetectorFactory to the end position in an AnalysisPass. The DetectorFactory must be a member of the pass. -
appendDetectorsToPass
-
print
private void print() -
dumpGraph
-
main
-
getFactoryChooser
- Returns:
- Returns the factoryChooser used during analysis.
-