cyvis.core.metrics
Class ClassMetric

java.lang.Object
  extended by cyvis.core.metrics.ClassMetric
All Implemented Interfaces:
Iterable<MethodMetric>

public class ClassMetric
extends Object
implements Iterable<MethodMetric>

Metrics extracted from a class. Contains some metadata about the class, and a collection of MethodMetric objects.


Field Summary
 String className
           
 String packageName
           
 int size
           
 
Constructor Summary
ClassMetric(InputStream classFile)
          Extracts metrics for the class (including the methods it contains) from the given class file.
 
Method Summary
 void generateText(Writer out)
          Generates a fragment of a plain-text report for this class's metrics.
 MethodMetric getMethodMetric(String methodName)
          Finds and returns an MethodMetric Object given the name of the method.
 Iterator<MethodMetric> iterator()
           
 int maxCC()
          returns the maximum cyclomatic complexity of the methods in this
 int methodCount()
          Returns the number of methods in this class.
 Iterable<MethodMetric> reversed()
          Allows iteration across this class's methods in reverse order.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

className

public final String className

packageName

public final String packageName

size

public final int size
Constructor Detail

ClassMetric

public ClassMetric(InputStream classFile)
            throws IOException
Extracts metrics for the class (including the methods it contains) from the given class file.

Throws:
IOException
Method Detail

getMethodMetric

public MethodMetric getMethodMetric(String methodName)
Finds and returns an MethodMetric Object given the name of the method.

Parameters:
methodName - the name of the method that has to be found.
Returns:
MethodMetric object if a method is found, if there are no methods found with that name returns a null

methodCount

public int methodCount()
Returns the number of methods in this class.


maxCC

public int maxCC()
returns the maximum cyclomatic complexity of the methods in this


iterator

public Iterator<MethodMetric> iterator()
Specified by:
iterator in interface Iterable<MethodMetric>

reversed

public Iterable<MethodMetric> reversed()
Allows iteration across this class's methods in reverse order.

Returns:
a reverse iterator

generateText

public void generateText(Writer out)
                  throws IOException
Generates a fragment of a plain-text report for this class's metrics. Used by ProjectMetric.generateText(Writer).

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

toString

public String toString()
Overrides:
toString in class Object