Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## gr.spinellis.ckjm
Class ClassVisitor

    java.lang.Object
      org.apache.bcel.classfile.EmptyVisitor
          com.oometer.smdl.ClassVisitor

All Implemented Interfaces:
  org.apache.bcel.classfile.Visitor

    public class ClassVisitor

extends org.apache.bcel.classfile.EmptyVisitor

Visit a class updating its Chidamber-Kemerer metrics.

Version:
  $Revision: 1.19 $
Author:
  Diomidis Spinellis
See Also:
  `ClassMetrics`

Field Summary
`(package private) java.util.ArrayList<java.util.TreeSet<java.lang.String>>` | `mi` Use of fields in methods.

Constructor Summary
`ClassVisitor(org.apache.bcel.classfile.JavaClass jc, ClassMetricsContainer classMap)`

Method Summary
`(package private) static java.lang.String` | `className(org.apache.bcel.generic.Type t)` Return a class name associated with a type.
`void` | `end()` Do final accounting at the end of the visit.
`ClassMetrics` | `getMetrics()` Return the class's metrics container.
`void` | `registerCoupling(java.lang.String className)` Add a given class to the classes we are coupled to
`void` | `registerCoupling(org.apache.bcel.generic.Type t)`
`(package private) void` | `registerFieldAccess(java.lang.String className, java.lang.String fieldName)`
`(package private) void` | `registerMethodInvocation(java.lang.String className, java.lang.String methodName, org.apache.bcel.generic.Type[] args)`
`void` | `start()`
`void` | `visitField(org.apache.bcel.classfile.Field field)` Called when a field access is encountered.
`void` | `visitJavaClass(org.apache.bcel.classfile.JavaClass jc)` Calculate the class's metrics based on its elements.
`void` | `visitMethod(org.apache.bcel.classfile.Method method)` Called when a method invocation is encountered.

Methods inherited from class org.apache.bcel.classfile.EmptyVisitor
`visitCode, visitCodeException, visitConstantClass, visitConstantDouble, visitConstantFieldref, visitConstantFloat, visitConstantInteger, visitConstantInterfaceMethodref, visitConstantLong, visitConstantMethodref, visitConstantNameAndType, visitConstantPool, visitConstantString, visitConstantUtf8, visitConstantValue, visitDeprecated, visitExceptionTable, visitInnerClass, visitInnerClasses, visitLineNumber, visitLineNumberTable, visitLocalVariable, visitLocalVariableTable, visitSignature, visitSourceFile, visitStackMap, visitStackMapEntry, visitSynthetic, visitUnknown`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### mi

    java.util.ArrayList<java.util.TreeSet<java.lang.String>> mi

  Use of fields in methods. Its contents are used for calculating the LCOM. We use a Tree rather than a Hash to calculate the intersection in O(n) instead of O(n*n).

Constructor Detail

### ClassVisitor

    public ClassVisitor(org.apache.bcel.classfile.JavaClass jc,
                        ClassMetricsContainer classMap)

Method Detail

### getMetrics

    public ClassMetrics getMetrics()

  Return the class's metrics container.

### start

    public void start()

### visitJavaClass

    public void visitJavaClass(org.apache.bcel.classfile.JavaClass jc)

  Calculate the class's metrics based on its elements.

  Specified by:
    `visitJavaClass` in interface `org.apache.bcel.classfile.Visitor`
  Overrides:
    `visitJavaClass` in class `org.apache.bcel.classfile.EmptyVisitor`

### registerCoupling

    public void registerCoupling(java.lang.String className)

  Add a given class to the classes we are coupled to

### registerCoupling

    public void registerCoupling(org.apache.bcel.generic.Type t)

### registerFieldAccess

    void registerFieldAccess(java.lang.String className,
                             java.lang.String fieldName)

### registerMethodInvocation

    void registerMethodInvocation(java.lang.String className,
                                  java.lang.String methodName,
                                  org.apache.bcel.generic.Type[] args)

### visitField

    public void visitField(org.apache.bcel.classfile.Field field)

  Called when a field access is encountered.

  Specified by:
    `visitField` in interface `org.apache.bcel.classfile.Visitor`
  Overrides:
    `visitField` in class `org.apache.bcel.classfile.EmptyVisitor`

### visitMethod

    public void visitMethod(org.apache.bcel.classfile.Method method)

  Called when a method invocation is encountered.

  Specified by:
    `visitMethod` in interface `org.apache.bcel.classfile.Visitor`
  Overrides:
    `visitMethod` in class `org.apache.bcel.classfile.EmptyVisitor`

### className

    static java.lang.String className(org.apache.bcel.generic.Type t)

  Return a class name associated with a type.

### end

    public void end()

  Do final accounting at the end of the visit.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD