cyvis.core.metrics
Class PackageMetric

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

public class PackageMetric
extends Object
implements Iterable<ClassMetric>

Holds a particular packages's metrics.


Field Summary
 String name
           
static cyvis.core.metrics.PackageMetric._ReverseSizeComparator REVERSE_SIZE_COMPARATOR
          A comparator for PackageMetric objects, ordering by number of classes, in reverse, then by name.
 
Constructor Summary
PackageMetric(String n)
          Constructs a new empty PackageMetric object
PackageMetric(String packageName, Collection<ClassMetric> classes)
          Constructs a PackageMetric instance.
 
Method Summary
 void add(ClassMetric classmetric)
          Adds a ClassMetric object to the package
 boolean contains(String name)
          returns true if the class is in this else returns false
 ClassMetric getClassMetric(String name)
          Returns a specified ClassMetric object, or returns null if the specified class is not in the package
 Iterator<ClassMetric> iterator()
          Returns an iterator across the classes in this package.
 int maxClassSize()
          Returns the size of the largest class in this package.
 int size()
          Returns the number of classes in this package.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVERSE_SIZE_COMPARATOR

public static final cyvis.core.metrics.PackageMetric._ReverseSizeComparator REVERSE_SIZE_COMPARATOR
A comparator for PackageMetric objects, ordering by number of classes, in reverse, then by name.


name

public final transient String name
Constructor Detail

PackageMetric

public PackageMetric(String packageName,
                     Collection<ClassMetric> classes)
Constructs a PackageMetric instance.

Parameters:
packageName - the name of the package
classes - the classes belonging to this package

PackageMetric

public PackageMetric(String n)
Constructs a new empty PackageMetric object

Method Detail

add

public void add(ClassMetric classmetric)
Adds a ClassMetric object to the package


getClassMetric

public ClassMetric getClassMetric(String name)
Returns a specified ClassMetric object, or returns null if the specified class is not in the package


contains

public boolean contains(String name)
returns true if the class is in this else returns false


iterator

public Iterator<ClassMetric> iterator()
Returns an iterator across the classes in this package.

Specified by:
iterator in interface Iterable<ClassMetric>

maxClassSize

public int maxClassSize()
Returns the size of the largest class in this package.


size

public int size()
Returns the number of classes in this package.


toString

public String toString()
Overrides:
toString in class Object