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 Modifier and Type Method Description void
addBug(BugInstance bug)
Called when a bug is reported.void
addClass(java.lang.String className, java.lang.String sourceFile, boolean isInterface, int size)
Report that a class has been analyzed.void
addClass(java.lang.String className, java.lang.String sourceFile, boolean isInterface, int size, boolean updatePackageStats)
Report that a class has been analyzed.void
addStats(ProjectStats stats2)
void
clearBugCounts()
Clear bug countsProjectStats
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()
java.util.Map<java.lang.String,java.lang.String>
getFileHashes(BugCollection bugs)
int
getNumClasses()
Get the number of classes analyzed.java.util.Collection<PackageStats>
getPackageStats()
Profiler
getProfiler()
int
getReferencedClasses()
int
getTotalBugs()
boolean
hasClassStats()
boolean
hasPackageStats()
void
purgeClassesThatDontMatch(java.util.regex.Pattern classPattern)
void
purgeClassStats()
void
purgePackageStats()
void
putPackageStats(java.lang.String packageName, int numClasses, int size)
void
recomputeFromComponents()
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
setTotalClasses(int totalClasses)
void
setTotalSize(int totalSize)
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
-
hasClassStats
public boolean hasClassStats()
-
hasPackageStats
public boolean hasPackageStats()
-
clone
public ProjectStats 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
public void addClass(@DottedClassName 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.
-
addClass
public void addClass(@DottedClassName java.lang.String className, @CheckForNull java.lang.String sourceFile, boolean isInterface, int size, boolean updatePackageStats)
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.updatePackageStats
- TODO
-
getClassStats
@CheckForNull public PackageStats.ClassStats getClassStats(@DottedClassName 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)
-
purgeClassStats
public void purgeClassStats()
-
purgePackageStats
public void purgePackageStats()
-
recomputeFromComponents
public void recomputeFromComponents()
-
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
-
getFileHashes
public java.util.Map<java.lang.String,java.lang.String> getFileHashes(BugCollection bugs)
-
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()
-
putPackageStats
public void putPackageStats(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
-
setTotalClasses
public void setTotalClasses(int totalClasses)
-
setTotalSize
public void setTotalSize(int totalSize)
-
-