gr.spinellis.ckjm
Class ClassMetrics

java.lang.Object
  extended by gr.spinellis.ckjm.ClassMetrics

public class ClassMetrics
extends java.lang.Object

Store details needed for calculating a class's Chidamber-Kemerer metrics. Most fields in this class are set by ClassVisitor. This class also encapsulates some policy decision regarding metrics measurement.

Version:
$Revision: 1.12 $
Author:
Diomidis Spinellis
See Also:
ClassVisitor

Constructor Summary
ClassMetrics()
          Default constructor.
 
Method Summary
 void addAfferentCoupling(java.lang.String name)
          Add a class to the set of classes that depend on this class
 int getCa()
          Return the class's afferent couplings metric
 int getCbo()
          Return the coupling between object classes metric
 int getDit()
          Return the depth of the class's inheritance tree
 int getLcom()
          Return the class's lack of cohesion in methods metric
 int getNoc()
          Return the number of children
 int getNpm()
          Return the number of public methods metric
 int getRfc()
          Return the Response for a Class
 int getWmc()
          Return the weighted methods per class metric
 void incNoc()
          Increment the number of children
 void incNpm()
          Increment the number of public methods count
 void incWmc()
          Increment the weighted methods count
static boolean isJdkClass(java.lang.String s)
          Return true if the class name is part of the Java SDK
 boolean isPublic()
          Return true if the class is public
 boolean isVisited()
          Return true if the class has been visited by the metrics analyzer.
 void setCbo(int c)
          Set the coupling between object classes metric
 void setDit(int d)
          Set the depth of inheritence tree metric
 void setLcom(int l)
          Set the class's lack of cohesion in methods metric
 void setPublic()
          Call to set the class as public
 void setRfc(int r)
          Increment the Response for a Class
 void setVisited()
          Mark the instance as visited by the metrics analyzer
 java.lang.String toString()
          Return the 6 CK metrics plus Ce as a space-separated string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassMetrics

ClassMetrics()
Default constructor.

Method Detail

incWmc

public void incWmc()
Increment the weighted methods count


getWmc

public int getWmc()
Return the weighted methods per class metric


incNoc

public void incNoc()
Increment the number of children


getNoc

public int getNoc()
Return the number of children


setRfc

public void setRfc(int r)
Increment the Response for a Class


getRfc

public int getRfc()
Return the Response for a Class


setDit

public void setDit(int d)
Set the depth of inheritence tree metric


getDit

public int getDit()
Return the depth of the class's inheritance tree


setCbo

public void setCbo(int c)
Set the coupling between object classes metric


getCbo

public int getCbo()
Return the coupling between object classes metric


getLcom

public int getLcom()
Return the class's lack of cohesion in methods metric


setLcom

public void setLcom(int l)
Set the class's lack of cohesion in methods metric


getCa

public int getCa()
Return the class's afferent couplings metric


addAfferentCoupling

public void addAfferentCoupling(java.lang.String name)
Add a class to the set of classes that depend on this class


incNpm

public void incNpm()
Increment the number of public methods count


getNpm

public int getNpm()
Return the number of public methods metric


isPublic

public boolean isPublic()
Return true if the class is public


setPublic

public void setPublic()
Call to set the class as public


isJdkClass

public static boolean isJdkClass(java.lang.String s)
Return true if the class name is part of the Java SDK


toString

public java.lang.String toString()
Return the 6 CK metrics plus Ce as a space-separated string

Overrides:
toString in class java.lang.Object

setVisited

public void setVisited()
Mark the instance as visited by the metrics analyzer


isVisited

public boolean isVisited()
Return true if the class has been visited by the metrics analyzer. Classes may appear in the collection as a result of some kind of coupling. However, unless they are visited and analyzed, we do not want them to appear in the output results.