Package edu.umd.cs.findbugs.plan
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 boolean
private DetectorFactoryChooser
private Map
<String, DetectorFactory> private List
<DetectorOrderingConstraint> private List
<DetectorOrderingConstraint> private LinkedList
<AnalysisPass> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate DetectorNode
addOrCreateDetectorNode
(DetectorFactory factory, Map<String, DetectorNode> nodeMap, ConstraintGraph constraintGraph) private Set
<DetectorNode> addOrCreateDetectorNodes
(DetectorFactorySelector selector, Map<String, DetectorNode> nodeMap, Set<DetectorFactory> factorySet, ConstraintGraph constraintGraph) private void
addPass
(AnalysisPass pass) void
Add a Plugin whose Detectors should be added to the execution plan.private void
appendDetectorsToPass
(Collection<DetectorFactory> detectorSet, AnalysisPass pass) private void
appendToPass
(DetectorFactory factory, AnalysisPass pass) Append a DetectorFactory to the end position in an AnalysisPass.private void
assignToPass
(DetectorFactory factory, AnalysisPass pass) Make a DetectorFactory a member of an AnalysisPass.void
build()
Build the execution plan.private ConstraintGraph
buildConstraintGraph
(Map<String, DetectorNode> nodeMap, Set<DetectorFactory> factorySet, List<DetectorOrderingConstraint> constraintList) Build a constraint graph.private void
buildPassList
(ConstraintGraph constraintGraph) private static <T> void
copyTo
(Iterator<T> iter, Collection<T> dest) private void
createConstraintEdges
(ConstraintGraph result, Set<DetectorNode> earlierSet, Set<DetectorNode> laterSet, DetectorOrderingConstraint constraint) void
dispose()
private void
dumpGraph
(ConstraintGraph graph) int
Get the number of passes in the execution plan.private Set
<DetectorFactory> boolean
boolean
static void
Get an Iterator over the AnalysisPasses.private void
print()
private Set
<DetectorFactory> selectDetectors
(DetectorFactorySelector selector, Set<DetectorFactory> candidateSet) void
setDetectorFactoryChooser
(DetectorFactoryChooser factoryChooser) Set the DetectorFactoryChooser to use to select which detectors to enable.private void
sortPass
(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
- Throws:
Exception
-