edu.umd.cs.findbugs.plan
Class ExecutionPlan

java.lang.Object
  extended by edu.umd.cs.findbugs.plan.ExecutionPlan

public class ExecutionPlan
extends java.lang.Object

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).

Author:
David Hovemeyer

Field Summary
private static boolean DEBUG
           
private  java.util.LinkedList<AnalysisPass> passList
           
private  java.util.List<Plugin> pluginList
           
 
Constructor Summary
ExecutionPlan()
          Constructor.
 
Method Summary
private  DetectorNode addOrCreateDetectorNode(java.lang.String className, java.util.Map<java.lang.String,DetectorNode> nodeMap, java.util.Map<java.lang.String,DetectorFactory> factoryMap, ConstraintGraph constraintGraph)
           
 void addPlugin(Plugin plugin)
          Add a Plugin whose Detectors should be added to the execution plan.
 void build()
          Build the execution plan.
private  ConstraintGraph buildConstraintGraph(java.util.Map<java.lang.String,DetectorNode> nodeMap, java.util.Map<java.lang.String,DetectorFactory> factoryMap, java.util.List<DetectorOrderingConstraint> constraintList)
          Build a constraint graph.
private  java.util.Map<java.lang.String,DetectorFactory> buildFactoryMap()
           
private  void buildPassList(ConstraintGraph constraintGraph)
           
private static
<T> void
copyTo(java.util.Iterator<T> iter, java.util.Collection<T> dest)
           
private  void dumpGraph(ConstraintGraph graph)
           
static void main(java.lang.String[] argv)
           
private  void print()
           
private  void sortPass(java.util.List<DetectorOrderingConstraint> constraintList, java.util.Map<java.lang.String,DetectorFactory> factoryMap, AnalysisPass pass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG

pluginList

private java.util.List<Plugin> pluginList

passList

private java.util.LinkedList<AnalysisPass> passList
Constructor Detail

ExecutionPlan

public ExecutionPlan()
Constructor. Creates an empty plan.

Method Detail

addPlugin

public void addPlugin(Plugin plugin)
Add a Plugin whose Detectors should be added to the execution plan.


build

public void build()
           throws OrderingConstraintException
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

copyTo

private static <T> void copyTo(java.util.Iterator<T> iter,
                               java.util.Collection<T> dest)

buildFactoryMap

private java.util.Map<java.lang.String,DetectorFactory> buildFactoryMap()

buildConstraintGraph

private ConstraintGraph buildConstraintGraph(java.util.Map<java.lang.String,DetectorNode> nodeMap,
                                             java.util.Map<java.lang.String,DetectorFactory> factoryMap,
                                             java.util.List<DetectorOrderingConstraint> constraintList)
                                      throws OrderingConstraintException
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 detectors
factoryMap - map of class names to DetectorFactory objects (needed to create graph nodes)
constraintList - List of ordering constraints
Returns:
the ConstraintGraph
Throws:
OrderingConstraintException

addOrCreateDetectorNode

private DetectorNode addOrCreateDetectorNode(java.lang.String className,
                                             java.util.Map<java.lang.String,DetectorNode> nodeMap,
                                             java.util.Map<java.lang.String,DetectorFactory> factoryMap,
                                             ConstraintGraph constraintGraph)
                                      throws OrderingConstraintException
Throws:
OrderingConstraintException

buildPassList

private void buildPassList(ConstraintGraph constraintGraph)
                    throws OrderingConstraintException
Throws:
OrderingConstraintException

sortPass

private void sortPass(java.util.List<DetectorOrderingConstraint> constraintList,
                      java.util.Map<java.lang.String,DetectorFactory> factoryMap,
                      AnalysisPass pass)
               throws OrderingConstraintException
Throws:
OrderingConstraintException

print

private void print()

dumpGraph

private void dumpGraph(ConstraintGraph graph)

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Throws:
java.lang.Exception