cyvis.core.metrics
Class ProjectMetric

java.lang.Object
  extended by cyvis.core.metrics.ProjectMetric

public class ProjectMetric
extends Object

This class stores a list of class's metrics. An instance of this class will hold the metrics for all the classes.


Constructor Summary
ProjectMetric()
           
 
Method Summary
 void add(ClassMetric classmetric)
          Adds a new Classmetric object to the project
 int classCount()
          Returns the number of classes in this project.
 boolean contains(String packageName)
          Checks if the project contains a particular package
 void generateHTML(Writer out, StreamSource xsl)
          Generates an HTML report of this project's metrics.
 void generateText(Writer out)
          Generates a plain-text report of this project's metrics.
 String generateXML()
          Generates an XML report of this project's metrics.
 ClassMetric getClassMetric(String packageName, String className)
          Finds and returns an ClassMetric Object given the package & class names.
 PackageMetric getPackageMetric(String packageName)
          returns a package with the given name
 List<PackageMetric> getPackages()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProjectMetric

public ProjectMetric()
Method Detail

add

public void add(ClassMetric classmetric)
Adds a new Classmetric object to the project

Parameters:
classmetric - the class to be added

getClassMetric

public ClassMetric getClassMetric(String packageName,
                                  String className)
Finds and returns an ClassMetric Object given the package & class names.

Parameters:
packageName - the name of the package in which to find.
className - the name of the class to find.
Returns:
ClassMetric object if a class is found, if there are no class found then returns a null

classCount

public int classCount()
Returns the number of classes in this project.


contains

public boolean contains(String packageName)
Checks if the project contains a particular package

Parameters:
packageName - the package name
Returns:
true if it contains a package by the given name

getPackages

public List<PackageMetric> getPackages()
Returns:
all the packages in the project

getPackageMetric

public PackageMetric getPackageMetric(String packageName)
returns a package with the given name

Parameters:
packageName - the package name
Returns:
packagemetric returns null if there is no package by the given name

generateText

public void generateText(Writer out)
                  throws IOException
Generates a plain-text report of this project's metrics.

Parameters:
out - Writer to which the report is written
Throws:
IOException

generateXML

public String generateXML()
Generates an XML report of this project's metrics.

Returns:
a String containing the generated XML

generateHTML

public void generateHTML(Writer out,
                         StreamSource xsl)
                  throws TransformerConfigurationException,
                         TransformerException
Generates an HTML report of this project's metrics. The report is generated from the XML report (see generateXML()) transformed by the given XML stylesheet.

Parameters:
out - Writer to which the generated HTML is written
xsl - XML stylesheet for transforming the XML to HTML
Throws:
TransformerConfigurationException
TransformerException

toString

public String toString()
Overrides:
toString in class Object