Metrics
Chidamber and Kemerer Object Oriented Metrics
Extends the Java 1.4 frontend
This is an example of how the Java 1.4 frontend in JastAddJ can be extended to perform additional analyses. This extension implements a set of object-oriented metrics proposed by CHidamber and Kemerer in: A Metrics Suite for Object Oriented Design. The implementation is heavily based on collection attributes to show case that functionality in JastAdd.
This project builds on the JastAdd Extensible Java Compiler. To run it, you need to download JastAddJ-src.jar and unpack Metrics.zip in the JastAddJ folder. Metrics can then be built by running ant in the Metrics folder. The modules defined in this project will make use of the abstract syntax and attributes defined in the Java1.4Frontend, and also refine the abstract syntax and add new attributes.
Metrics modules
ChidamberAndKemererJavaMetrics
This module contains the six proposed metrics. They are all implemented using collection attributes
ChidamberAndKemererJavaQueries
This module collects the types to be presented and contains the code to display the result.
Additional contents of this directory
- JavaMetrics.java is the main program taking the same command line arguments as a traditional java compiler.
- build.xml: Ant build file to be
used from a terminal window and from Eclipse. Makes use of tools and source files in the Java 1.4 Frontend
component.
- Use the targets build (default), and
clean, when working from a terminal window. For example,
type
ant
generate all java files and compile them
ant clean
remove all generated files and all the class files for both generated and handwritten java files
- Use the targets gen and cleanGen when working
from eclipse (see Running
JastAdd Under Eclipse):
ant gen
generate all java files
ant cleanGen
remove all generated files and their class files.
- Use the targets build (default), and
clean, when working from a terminal window. For example,
type