Class 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 Detail

      • ProjectStats

        public ProjectStats()
        Constructor. Creates an empty object.
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasClassStats

        public boolean hasClassStats()
      • hasPackageStats

        public boolean hasPackageStats()
      • clone

        public ProjectStats clone()
        Overrides:
        clone in class java.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 class
        sourceFile - TODO
        isInterface - true if the class is an interface
        size - 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 class
        sourceFile - TODO
        isInterface - true if the class is an interface
        size - 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 interface XMLWriteable
        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)