Package edu.umd.cs.findbugs
Class ProjectStats
- java.lang.Object
-
- edu.umd.cs.findbugs.ProjectStats
-
- All Implemented Interfaces:
XMLWriteable
,java.lang.Cloneable
public class ProjectStats extends java.lang.Object implements XMLWriteable, java.lang.Cloneable
Statistics resulting from analyzing a project.
-
-
Constructor Summary
Constructors Constructor Description ProjectStats()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addBug(BugInstance bug)
Called when a bug is reported.void
addClass(java.lang.String className, boolean isInterface, int size)
Deprecated.UseaddClass(String,String,boolean,int)
insteadvoid
addClass(java.lang.String className, java.lang.String sourceFile, boolean isInterface, int size)
Report that a class has been analyzed.void
addStats(ProjectStats stats2)
void
clearBugCounts()
Clear bug countsjava.lang.Object
clone()
void
computeFileStats(BugCollection bugs)
Footprint
getBaseFootprint()
int
getBugsOfPriority(int priority)
PackageStats.ClassStats
getClassStats(java.lang.String className)
Report that a class has been analyzed.int
getCodeSize()
int
getNumClasses()
Get the number of classes analyzed.java.util.Collection<PackageStats>
getPackageStats()
Profiler
getProfiler()
int
getReferencedClasses()
int
getTotalBugs()
void
purgeClassesThatDontMatch(java.util.regex.Pattern classPattern)
void
putIfAbsentPackageStats(java.lang.String packageName, int numClasses, int size)
void
recomputeFromClassStats()
void
reportSummary(java.io.OutputStream out)
Report statistics as an XML document to given output stream.void
setReferencedClasses(int size)
void
setTimestamp(long timestamp)
void
setTimestamp(java.lang.String timestamp)
Set the timestamp for this analysis run.void
setVMVersion(java.lang.String vm_version)
java.lang.String
toString()
void
transformSummaryToHTML(java.io.Writer htmlWriter)
Transform summary information to HTML.void
writeXML(XMLOutput xmlOutput)
Output as XML.void
writeXML(XMLOutput xmlOutput, boolean withMessages)
Output as XML.
-
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
getCodeSize
public int getCodeSize()
-
getTotalBugs
public int getTotalBugs()
-
getBugsOfPriority
public int getBugsOfPriority(int priority)
-
setTimestamp
public void setTimestamp(java.lang.String timestamp) throws java.text.ParseException
Set the timestamp for this analysis run.- Parameters:
timestamp
- the time of the analysis run this ProjectStats represents, as previously reported by writeXML.- Throws:
java.text.ParseException
-
setTimestamp
public void setTimestamp(long timestamp)
-
setVMVersion
public void setVMVersion(java.lang.String vm_version)
-
getNumClasses
public int getNumClasses()
Get the number of classes analyzed.
-
getBaseFootprint
public Footprint getBaseFootprint()
- Returns:
- Returns the baseFootprint.
-
addClass
@Deprecated public void addClass(java.lang.String className, boolean isInterface, int size)
Deprecated.UseaddClass(String,String,boolean,int)
insteadReport that a class has been analyzed.- Parameters:
className
- the full name of the classisInterface
- true if the class is an interfacesize
- a normalized class size value; see detect/FindBugsSummaryStats.
-
addClass
public void addClass(java.lang.String className, @CheckForNull java.lang.String sourceFile, boolean isInterface, int size)
Report that a class has been analyzed.- Parameters:
className
- the full name of the classsourceFile
- TODOisInterface
- true if the class is an interfacesize
- a normalized class size value; see detect/FindBugsSummaryStats.
-
getClassStats
@CheckForNull public PackageStats.ClassStats getClassStats(java.lang.String className)
Report that a class has been analyzed.- Parameters:
className
- the full name of the class
-
addBug
public void addBug(BugInstance bug)
Called when a bug is reported.
-
clearBugCounts
public void clearBugCounts()
Clear bug counts
-
purgeClassesThatDontMatch
public void purgeClassesThatDontMatch(java.util.regex.Pattern classPattern)
-
recomputeFromClassStats
public void recomputeFromClassStats()
-
computeFileStats
public void computeFileStats(BugCollection bugs)
-
writeXML
public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
Output as XML.- Specified by:
writeXML
in interfaceXMLWriteable
- Parameters:
xmlOutput
- the XMLOutput for the document- Throws:
java.io.IOException
-
writeXML
public void writeXML(XMLOutput xmlOutput, boolean withMessages) throws java.io.IOException
Output as XML.- Throws:
java.io.IOException
-
reportSummary
public void reportSummary(@WillClose java.io.OutputStream out) throws java.io.IOException
Report statistics as an XML document to given output stream.- Throws:
java.io.IOException
-
transformSummaryToHTML
public void transformSummaryToHTML(java.io.Writer htmlWriter) throws java.io.IOException, javax.xml.transform.TransformerException
Transform summary information to HTML.- Parameters:
htmlWriter
- the Writer to write the HTML output to- Throws:
java.io.IOException
javax.xml.transform.TransformerException
-
getPackageStats
public java.util.Collection<PackageStats> getPackageStats()
-
putIfAbsentPackageStats
public void putIfAbsentPackageStats(java.lang.String packageName, int numClasses, int size)
-
addStats
public void addStats(ProjectStats stats2)
- Parameters:
stats2
-
-
setReferencedClasses
public void setReferencedClasses(int size)
- Parameters:
size
-
-
getReferencedClasses
public int getReferencedClasses()
-
getProfiler
public Profiler getProfiler()
- Returns:
- Returns the project profiler instance, never null
-
-