5713N/A<?xml version="1.0"?>
0N/A<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
0N/A xmlns:lxslt="http://xml.apache.org/xslt"
0N/A xmlns:xalan="http://xml.apache.org/xalan"
0N/A xmlns:redirect="org.apache.xalan.lib.Redirect"
0N/A exclude-result-prefixes="xalan"
0N/A extension-element-prefixes="redirect">
0N/A<xsl:output method="html" indent="yes" encoding="US-ASCII"/>
0N/A<xsl:decimal-format decimal-separator="." grouping-separator="," />
0N/A<!--
809N/A Licensed to the Apache Software Foundation (ASF) under one or more
809N/A contributor license agreements. See the NOTICE file distributed with
809N/A this work for additional information regarding copyright ownership.
809N/A The ASF licenses this file to You under the Apache License, Version 2.0
809N/A (the "License"); you may not use this file except in compliance with
809N/A the License. You may obtain a copy of the License at
809N/A
809N/A http://www.apache.org/licenses/LICENSE-2.0
809N/A
809N/A Unless required by applicable law or agreed to in writing, software
809N/A distributed under the License is distributed on an "AS IS" BASIS,
809N/A WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
809N/A See the License for the specific language governing permissions and
809N/A limitations under the License.
0N/A-->
0N/A<!--
0N/A @author Stephane Bailliez <a href="mailto:sbailliez@apache.org"/>
0N/A -->
0N/A<xsl:param name="output.dir" select="'.'"/>
0N/A
0N/A<!-- default max value for the metrics -->
0N/A<xsl:param name="vg.max" select="10"/>
0N/A<xsl:param name="loc.max" select="1000"/>
0N/A<xsl:param name="dit.max" select="10"/>
0N/A<xsl:param name="noa.max" select="250"/>
0N/A<xsl:param name="nrm.max" select="50"/>
0N/A<xsl:param name="nlm.max" select="250"/>
0N/A<xsl:param name="wmc.max" select="250"/>
0N/A<xsl:param name="rfc.max" select="50"/>
0N/A<xsl:param name="dac.max" select="10"/>
0N/A<xsl:param name="fanout.max" select="10"/>
0N/A<xsl:param name="cbo.max" select="15"/>
0N/A<xsl:param name="lcom.max" select="10"/>
0N/A<xsl:param name="nocl.max" select="10"/>
0N/A
0N/A
0N/A<!-- create a tree fragment to speed up processing -->
0N/A<xsl:variable name="doctree.var">
0N/A <xsl:element name="classes">
0N/A <xsl:for-each select=".//class">
0N/A <xsl:element name="class">
0N/A <xsl:attribute name="package">
0N/A <xsl:value-of select="(ancestor::package)[last()]/@name"/>
0N/A </xsl:attribute>
0N/A <xsl:copy-of select="@*"/>
0N/A <xsl:attribute name="name">
0N/A <xsl:apply-templates select="." mode="class.name"/>
0N/A </xsl:attribute>
0N/A <xsl:copy-of select="method"/>
0N/A </xsl:element>
0N/A </xsl:for-each>
0N/A </xsl:element>
0N/A</xsl:variable>
0N/A
0N/A<xsl:variable name="doctree" select="xalan:nodeset($doctree.var)"/>
0N/A
0N/A<xsl:template match="metrics">
0N/A
0N/A <!-- create the index.html -->
0N/A <redirect:write file="{$output.dir}/index.html">
0N/A <xsl:call-template name="index.html"/>
0N/A </redirect:write>
0N/A
0N/A <!-- create the stylesheet.css -->
0N/A <redirect:write file="{$output.dir}/stylesheet.css">
0N/A <xsl:call-template name="stylesheet.css"/>
0N/A </redirect:write>
0N/A
0N/A <redirect:write file="{$output.dir}/metrics-reference.html">
0N/A <xsl:call-template name="metrics-reference.html"/>
0N/A </redirect:write>
0N/A
0N/A <!-- create the overview-packages.html at the root -->
0N/A <redirect:write file="{$output.dir}/overview-summary.html">
0N/A <xsl:apply-templates select="." mode="overview.packages"/>
0N/A </redirect:write>
0N/A
0N/A <!-- create the all-packages.html at the root -->
0N/A <redirect:write file="{$output.dir}/overview-frame.html">
0N/A <xsl:apply-templates select="." mode="all.packages"/>
0N/A </redirect:write>
0N/A
0N/A <!-- create the all-classes.html at the root -->
0N/A <redirect:write file="{$output.dir}/allclasses-frame.html">
0N/A <xsl:apply-templates select="." mode="all.classes"/>
0N/A </redirect:write>
0N/A
0N/A <!-- process all packages -->
0N/A <xsl:apply-templates select=".//package"/>
0N/A</xsl:template>
0N/A
0N/A
0N/A<xsl:template match="package">
0N/A <xsl:variable name="package.name" select="@name"/>
0N/A <xsl:variable name="package.dir">
0N/A <xsl:if test="not($package.name = 'unnamed package')"><xsl:value-of select="translate($package.name,'.','/')"/></xsl:if>
0N/A <xsl:if test="$package.name = 'unnamed package'">.</xsl:if>
0N/A </xsl:variable>
0N/A <!-- create a classes-list.html in the package directory -->
0N/A <redirect:write file="{$output.dir}/{$package.dir}/package-frame.html">
0N/A <xsl:apply-templates select="." mode="classes.list"/>
0N/A </redirect:write>
0N/A
0N/A <!-- create a package-summary.html in the package directory -->
0N/A <redirect:write file="{$output.dir}/{$package.dir}/package-summary.html">
0N/A <xsl:apply-templates select="." mode="package.summary"/>
0N/A </redirect:write>
0N/A
0N/A <!-- for each class, creates a @name.html -->
0N/A <!-- @bug there will be a problem with inner classes having the same name, it will be overwritten -->
0N/A <xsl:for-each select="$doctree/classes/class[@package = current()/@name]">
0N/A <!--Processing <xsl:value-of select="$class.name"/><xsl:text>&#10;</xsl:text> -->
0N/A <redirect:write file="{$output.dir}/{$package.dir}/{@name}.html">
0N/A <xsl:apply-templates select="." mode="class.details"/>
0N/A </redirect:write>
0N/A </xsl:for-each>
0N/A</xsl:template>
0N/A
0N/A<!-- little trick to compute the classname for inner and non inner classes -->
0N/A<!-- this is all in one line to avoid CRLF in the name -->
0N/A<xsl:template match="class" mode="class.name">
0N/A <xsl:if test="parent::class"><xsl:apply-templates select="parent::class" mode="class.name"/>.<xsl:value-of select="@name"/></xsl:if><xsl:if test="not(parent::class)"><xsl:value-of select="@name"/></xsl:if>
0N/A</xsl:template>
0N/A
0N/A
0N/A<xsl:template name="index.html">
0N/A<HTML>
0N/A <HEAD><TITLE>Metrics Results.</TITLE></HEAD>
0N/A <FRAMESET cols="20%,80%">
0N/A <FRAMESET rows="30%,70%">
0N/A <FRAME src="overview-frame.html" name="packageListFrame"/>
0N/A <FRAME src="allclasses-frame.html" name="classListFrame"/>
0N/A </FRAMESET>
0N/A <FRAME src="overview-summary.html" name="classFrame"/>
0N/A </FRAMESET>
0N/A <noframes>
0N/A <H2>Frame Alert</H2>
0N/A <P>
0N/A This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
0N/A </P>
0N/A </noframes>
0N/A</HTML>
0N/A</xsl:template>
0N/A
0N/A<!-- this is the stylesheet css to use for nearly everything -->
0N/A<xsl:template name="metrics-reference.html">
0N/A<html>
0N/A<head>
0N/A<link title="Style" type="text/css" rel="stylesheet" href="stylesheet.css"/>
0N/A</head>
0N/A<body style="text-align:justify;">
0N/A<h2>Metrics Reference</h2>
0N/A<a href="#V(G)">V(G)</a> |
0N/A<a href="#LOC">LOC</a> |
0N/A<a href="#DIT">DIT</a> |
0N/A<a href="#NOA">NOA</a> |
0N/A<a href="#NRM">NRM</a> |
0N/A<a href="#NLM">NLM</a> |
0N/A<a href="#WMC">WMC</a> |
0N/A<a href="#RFC">RFC</a> |
0N/A<a href="#DAC">DAC</a> |
0N/A<a href="#FANOUT">FANOUT</a> |
0N/A<a href="#CBO">CBO</a> |
0N/A<a href="#LCOM">LCOM</a> |
0N/A<a href="#NOC">NOC</a>
0N/A
0N/A<a name="V(G)"/>
0N/A<h3>Cyclomatic Complexity - V(G)</h3>
0N/AThis metric was introduced in the 1970s to measure the amount of control
0N/Aflow complexity or branching complexity in a module such as a
0N/Asubroutine. It gives the number of paths that may be taken through the
0N/Acode, and was initially developed to give some measure of the cost of
0N/Aproducing a test case for the module by executing each path.
0N/A<p/>
0N/AMethods with a high cyclomatic complexity tend to be more difficult to
0N/Aunderstand and maintain. In general the more complex the methods of an
0N/Aapplication, the more difficult it will be to test it, and this will adversely
0N/Aaffect its reliability.
0N/A<p/>
0N/AV(G) is a measure of the control flow complexity of a method or
0N/Aconstructor. It counts the number of branches in the body of the method,
0N/Adefined as:
0N/A<ul>
0N/A<li>while statements;</li>
0N/A<li>if statements;</li>
0N/A<li>for statements.</li>
0N/A</ul>
0N/A
0N/AThe metric can also be configured to count each case of a switch
0N/Astatement as well.
0N/A
0N/A<a name="LOC"/>
0N/A<h3>Lines of Code - LOC</h3>
0N/A
0N/AThis is perhaps the simplest of all the metrics to define and compute.
0N/ACounting lines has a long history as a software metric dating from before
0N/Athe rise of structured programming, and it is still in widespread use today.
0N/AThe size of a method affects the ease with which it can be understood, its
0N/Areusability and its maintainability. There are a variety of ways that the size
0N/Acan be calculated. These include counting all the lines of code, the number
0N/Aof statements, the blank lines of code, the lines of commentary, and the
0N/Alines consisting only of syntax such as block delimiters.
0N/A<p/>
0N/AThis metric can also be used for sizing other constructs as well, for
0N/Aexample, the overall size of a Java class or package can be measured by
0N/Acounting the number of source lines it consists of.
0N/A<p/>
0N/ALOC can be used to determine the size of a compilation unit (source file),
0N/Aclass or interface, method, constructor, or field. It can be configured to
0N/Aignore:
0N/A<ul>
0N/A<li>blank lines;</li>
0N/A<li>lines consisting only of comments;</li>
0N/A<li>lines consisting only of opening and closing braces.</li>
0N/A</ul>
0N/A
0N/A<a name="DIT"/>
0N/A<h3>Depth of Inheritance Hierarchy - DIT</h3>
0N/A
0N/AThis metric calculates how far down the inheritance hierarchy a class is
0N/Adeclared. In Java all classes have java.lang.Object as their ultimate
0N/Asuperclass, which is defined to have a depth of 1. So a class that
0N/Aimmediately extends java.lang.Object has a metric value of 2; any of its
0N/Asubclasses will have a value of 3, and so on.
0N/A<p/>
0N/AA class that is deep within the tree inherits more methods and state
0N/Avariables, thereby increasing its complexity and making it difficult to
0N/Apredict its behavior. It can be harder to understand a system with many
0N/Ainheritance layers.
0N/A<p/>
0N/ADIT is defined for classes and interfaces:
0N/A<ul>
0N/A<li>all interface types have a depth of 1;</li>
0N/A<li>the class java.lang.Object has a depth of 1;</li>
0N/A<li>all other classes have a depth of 1 + the depth of their super class.</li>
0N/A</ul>
0N/A
0N/A<a name="NOA"/>
0N/A<h3>Number of Attributes - NOA</h3>
0N/A
0N/AThe number of distinct state variables in a class serves as one measure of
0N/Aits complexity. The more state a class represents the more difficult it is to
0N/Amaintain invariants for it. It also hinders comprehensibility and reuse.
0N/A<p/>
0N/AIn Java, state can be exposed to subclasses through protected fields, which
0N/Aentails that the subclass also be aware of and maintain any invariants. This
0N/Ainterference with the class's data encapsulation can be a source of defects
0N/Aand hidden dependencies between the state variables.
0N/A<p/>
0N/ANOA is defined for classes and interfaces. It counts the number of fields
0N/Adeclared in the class or interface.
0N/A
0N/A<a name="NRM"/>
0N/A<h3>Number of Remote Methods - NRM</h3>
0N/A
0N/ANRM is defined for classes. A remote method call is defined as an
0N/Ainvocation of a method that is not declared in any of:
0N/A<ul>
0N/A<li>the class itself;</li>
0N/A<li>a class or interface that the class extends or implements;</li>
0N/A<li>a class or method that extends the class.</li>
0N/A</ul>
0N/A
0N/AThe value is the count of all the remote method calls in all of the methods
0N/Aand constructors of the class.
0N/A
0N/A<a name="NLM"/>
0N/A<h3>Number of Local Methods - NLM</h3>
0N/A
0N/ANLM is defined for classes and interfaces. A local method is defined as a
0N/Amethod that is declared in the class or interface. NLM can be configured to
0N/Ainclude the local methods of all of the class's superclasses. Methods with
0N/Apublic, protected, package and private visibility can be independently
0N/Acounted by setting configuration parameters.
0N/A
0N/A<a name="WMC"/>
0N/A<h3>Weighted Methods per Class - WMC</h3>
0N/A
0N/AIf the number of methods in a class can be determined during the design
0N/Aand modeling phase of a project, it can be used as a predictor of how
0N/Amuch time and effort is needed to develop, debug and maintain it. This
0N/Ametric can be further refined by incorporating a weighting for the
0N/Acomplexity of each method. The usual weighting is given by the cyclomatic
0N/Acomplexity of the method.
0N/A<p/>
0N/AThe subclasses of a class inherit all of its public and protected methods,
0N/Aand possibly its package methods as well, so the number of methods a
0N/Aclass has directly impacts the complexity of its subclasses. Classes with
0N/Alarge numbers of methods are often specific to a particular application,
0N/Areducing the ability to reuse them.
0N/A<p/>
0N/AThe definition of WMC is based upon NLM, and it provides the same
0N/Aconfiguration parameters for counting inherited methods and of varying
0N/Avisibility. The main difference is that NLM always counts each method as 1,
0N/Awhereas WMC will weight each method. There are two weighting schemes:
0N/A<ul>
0N/A<li>V(G) the cyclomatic complexity of the method is used as its weight.
0N/A Methods from class files are given a V(G) of 1.</li>
0N/A<li>the arity, or the number of parameters of the method are used to
0N/A determine the weight.</li>
0N/A</ul>
0N/A
0N/A<a name="RFC"/>
0N/A<h3>Response For Class - RFC</h3>
0N/A
0N/AThe response set of a class is the set of all methods that can be invoked as
0N/Aa result of a message sent to an object of the class. This includes methods
0N/Ain the class's inheritance hierarchy and methods that can be invoked on
0N/Aother objects. The Response For Class metric is defined to be size of the
0N/Aresponse set for the class. A class which provides a larger response set is
0N/Aconsidered to be more complex than one with a smaller response set.
0N/A<p/>
0N/AOne reason for this is that if a method call on a class can result in a large
0N/Anumber of different method calls on the target and other classes, then it
0N/Acan be harder to test the behavior of the class and debug problems. It will
0N/Atypically require a deeper understanding of the potential interactions that
0N/Aobjects of the class can have with the rest of the system.
0N/A<p/>
0N/ARFC is defined as the sum of NLM and NRM for the class. The local methods
0N/Ainclude all of the public, protected, package and private methods, but not
0N/Amethods declared only in a superclass.
0N/A
0N/A<a name="DAC"/>
0N/A<h3>Data Abstraction Coupling - DAC</h3>
0N/A
0N/ADAC is defined for classes and interfaces. It counts the number of reference
0N/Atypes that are used in the field declarations of the class or interface. The
0N/Acomponent types of arrays are also counted. Any field with a type that is
0N/Aeither a supertype or a subtype of the class is not counted.
0N/A
0N/A<a name="FANOUT"/>
0N/A<h3>Fan Out - FANOUT</h3>
0N/A
0N/AFANOUT is defined for classes and interfaces, constructors and methods. It
0N/Acounts the number of reference types that are used in:
0N/A<ul>
0N/A<li>field declarations;</li>
0N/A<li>formal parameters and return types;</li>
0N/A<li>throws declarations;</li>
0N/A<li>local variables.</li>
0N/A</ul>
0N/A
0N/AThe component types of arrays are also counted. Any type that is either a
0N/Asupertype or a subtype of the class is not counted.
0N/A
0N/A<a name="CBO"/>
0N/A<h3>Coupling Between Objects - CBO</h3>
0N/A
0N/AWhen one object or class uses another object or class they are said to be
0N/Acoupled. One major source of coupling is that between a superclass and a
0N/Asubclass. A coupling is also introduced when a method or field in another
0N/Aclass is accessed, or when an object of another class is passed into or out
0N/Aof a method invocation. Coupling Between Objects is a measure of the
0N/Anon-inheritance coupling between two objects.
0N/A<p/>
0N/AA high value of coupling reduces the modularity of the class and makes
0N/Areuse more difficult. The more independent a class is the more likely it is
0N/Athat it will be possible to reuse it in another part of the system. When a
0N/Aclass is coupled to another class it becomes sensitive to changes in that
0N/Aclass, thereby making maintenance for difficult. In addition, a class that is
0N/Aoverly dependent on other classes can be difficult to understand and test in
0N/Aisolation.
0N/A<p/>
0N/ACBO is defined for classes and interfaces, constructors and methods. It
0N/Acounts the number of reference types that are used in:
0N/A<ul>
0N/A<li>field declarations</li>
0N/A<li>formal parameters and return types</li>
0N/A<li>throws declarations</li>
0N/A<li>local variables</li>
0N/A</ul>
0N/A
0N/AIt also counts:
0N/A<ul>
0N/A<li>types from which field and method selections are made</li>
0N/A</ul>
0N/A
0N/AThe component types of arrays are also counted. Any type that is either a
0N/Asupertype or a subtype of the class is not counted.
0N/A
0N/A<a name="LCOM"/>
0N/A<h3>Lack of Cohesion Of Methods - LCOM</h3>
0N/A
0N/AThe cohesion of a class is the degree to which its methods are related to
0N/Aeach other. It is determined by examining the pattern of state variable
0N/Aaccesses within the set of methods. If all the methods access the same state
0N/Avariables then they have high cohesion; if they access disjoint sets of
0N/Avariables then the cohesion is low. An extreme example of low cohesion
0N/Awould be if none of the methods accessed any of the state variables.
0N/A
0N/AIf a class exhibits low method cohesion it indicates that the design of the
0N/Aclass has probably been partitioned incorrectly, and could benefit by being
0N/Asplit into more classes with individually higher cohesion. On the other
0N/Ahand, a high value of cohesion (a low lack of cohesion) implies that the
0N/Aclass is well designed. A cohesive class will tend to provide a high degree
0N/Aof encapsulation, whereas a lack of cohesion decreases encapsulation and
0N/Aincreases complexity.
0N/A<p/>
0N/AAnother form of cohesion that is useful for Java programs is cohesion
0N/Abetween nested and enclosing classes. A nested class that has very low
0N/Acohesion with its enclosing class would probably better designed as a peer
0N/Aclass rather than a nested class.
0N/A<p/>
0N/ALCOM is defined for classes. Operationally, LCOM takes each pair of
0N/Amethods in the class and determines the set of fields they each access. If
0N/Athey have disjoint sets of field accesses increase the count P by one. If they
0N/Ashare at least one field access then increase Q by one. After considering
0N/Aeach pair of methods,
0N/ALCOM = (P > Q) ? (P - Q) : 0
0N/A<p/>
0N/AIndirect access to fields via local methods can be considered by setting a
0N/Ametric configuration parameter.
0N/A
0N/A<a name="NOC"/>
0N/A<h3>Number Of Classes - NOC</h3>
0N/A
0N/AThe overall size of the system can be estimated by calculating the number
0N/Aof classes it contains. A large system with more classes is more complex
0N/Athan a smaller one because the number of potential interactions between
0N/Aobjects is higher. This reduces the comprehensibility of the system which
0N/Ain turn makes it harder to test, debug and maintain.
0N/A<p/>
0N/AIf the number of classes in the system can be projected during the initial
0N/Adesign phase of the project it can serve as a base for estimating the total
0N/Aeffort and cost of developing, debugging and maintaining the system.
0N/A<p/>
0N/AThe NOC metric can also usefully be applied at the package and class level
0N/Aas well as the total system.
0N/A<p/>
0N/ANOCL is defined for class and interfaces. It counts the number of classes or
0N/Ainterfaces that are declared. This is usually 1, but nested class declarations
0N/Awill increase this number.
0N/A</body>
0N/A</html>
0N/A</xsl:template>
0N/A
0N/A<!-- this is the stylesheet css to use for nearly everything -->
0N/A<xsl:template name="stylesheet.css">
0N/A .bannercell {
0N/A border: 0px;
0N/A padding: 0px;
0N/A }
0N/A body {
0N/A margin-left: 10;
0N/A margin-right: 10;
0N/A font:normal 80% arial,helvetica,sanserif;
0N/A background-color:#FFFFFF;
0N/A color:#000000;
0N/A }
0N/A .a td {
0N/A background: #efefef;
0N/A }
0N/A .b td {
0N/A background: #fff;
0N/A }
0N/A th, td {
0N/A text-align: left;
0N/A vertical-align: top;
0N/A }
0N/A th {
0N/A font-weight:bold;
0N/A background: #ccc;
0N/A color: black;
0N/A }
0N/A table, th, td {
0N/A font-size:100%;
0N/A border: none
0N/A }
0N/A table.log tr td, tr th {
0N/A
0N/A }
0N/A h2 {
0N/A font-weight:bold;
0N/A font-size:140%;
0N/A margin-bottom: 5;
0N/A }
0N/A h3 {
0N/A font-size:100%;
0N/A font-weight:bold;
0N/A background: #525D76;
0N/A color: white;
0N/A text-decoration: none;
0N/A padding: 5px;
0N/A margin-right: 2px;
0N/A margin-left: 2px;
0N/A margin-bottom: 0;
0N/A }
0N/A .Error {
0N/A font-weight:bold; color:red;
0N/A }
0N/A
0N/A</xsl:template>
0N/A
0N/A<!-- print the metrics of the class -->
0N/A<xsl:template match="class" mode="class.details">
0N/A <!--xsl:variable name="package.name" select="(ancestor::package)[last()]/@name"/-->
0N/A <xsl:variable name="package.name" select="@package"/>
0N/A <HTML>
0N/A <HEAD>
0N/A <xsl:call-template name="create.stylesheet.link">
0N/A <xsl:with-param name="package.name" select="$package.name"/>
0N/A </xsl:call-template>
0N/A </HEAD>
0N/A <BODY>
0N/A <xsl:call-template name="pageHeader"/>
0N/A
0N/A <H3>Class <xsl:if test="not($package.name = 'unnamed package')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></H3>
0N/A <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
0N/A <xsl:call-template name="all.metrics.header"/>
0N/A <xsl:apply-templates select="." mode="print.metrics"/>
0N/A </table>
0N/A
0N/A <H3>Methods</H3>
0N/A <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
0N/A <xsl:call-template name="method.metrics.header"/>
0N/A <xsl:apply-templates select="method" mode="print.metrics"/>
0N/A </table>
0N/A
0N/A <xsl:call-template name="pageFooter"/>
0N/A </BODY>
0N/A </HTML>
0N/A</xsl:template>
0N/A
0N/A
0N/A<!-- list of classes in a package -->
0N/A<xsl:template match="package" mode="classes.list">
0N/A <HTML>
0N/A <HEAD>
0N/A <xsl:call-template name="create.stylesheet.link">
0N/A <xsl:with-param name="package.name" select="@name"/>
0N/A </xsl:call-template>
0N/A </HEAD>
0N/A <BODY>
0N/A <table width="100%">
0N/A <tr>
0N/A <td nowrap="nowrap">
0N/A <H2><a href="package-summary.html" target="classFrame"><xsl:value-of select="@name"/></a></H2>
0N/A </td>
0N/A </tr>
0N/A </table>
0N/A
0N/A <H2>Classes</H2>
0N/A <TABLE WIDTH="100%">
0N/A <!-- xalan-nodeset:nodeset for Xalan 1.2.2 -->
0N/A <xsl:for-each select="$doctree/classes/class[@package = current()/@name]">
0N/A <xsl:sort select="@name"/>
0N/A <tr>
0N/A <td nowrap="nowrap">
0N/A <a href="{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a>
0N/A </td>
0N/A </tr>
0N/A </xsl:for-each>
0N/A </TABLE>
0N/A </BODY>
0N/A </HTML>
0N/A</xsl:template>
0N/A
0N/A
0N/A<!--
0N/A Creates an all-classes.html file that contains a link to all package-summary.html
0N/A on each class.
0N/A-->
0N/A<xsl:template match="metrics" mode="all.classes">
0N/A <html>
0N/A <head>
0N/A <xsl:call-template name="create.stylesheet.link">
0N/A <xsl:with-param name="package.name" select="''"/>
0N/A </xsl:call-template>
0N/A </head>
0N/A <body>
0N/A <h2>Classes</h2>
0N/A <table width="100%">
0N/A <xsl:for-each select="$doctree/classes/class">
0N/A <xsl:sort select="@name"/>
0N/A <xsl:apply-templates select="." mode="all.classes"/>
0N/A </xsl:for-each>
0N/A </table>
0N/A </body>
0N/A </html>
0N/A</xsl:template>
0N/A
0N/A<xsl:template match="class" mode="all.classes">
0N/A <xsl:variable name="package.name" select="@package"/>
0N/A <xsl:variable name="class.name" select="@name"/>
0N/A <tr>
0N/A <td nowrap="nowrap">
0N/A <a target="classFrame">
0N/A <xsl:attribute name="href">
0N/A <xsl:if test="not($package.name='unnamed package')">
0N/A <xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text>
0N/A </xsl:if>
0N/A <xsl:value-of select="$class.name"/><xsl:text>.html</xsl:text>
0N/A </xsl:attribute>
0N/A <xsl:value-of select="$class.name"/>
0N/A </a>
0N/A </td>
0N/A </tr>
0N/A</xsl:template>
0N/A
0N/A<!--
0N/A Creates an html file that contains a link to all package-summary.html files on
0N/A each package existing on testsuites.
0N/A @bug there will be a problem here, I don't know yet how to handle unnamed package :(
0N/A-->
0N/A<xsl:template match="metrics" mode="all.packages">
0N/A <html>
0N/A <head>
0N/A <xsl:call-template name="create.stylesheet.link">
0N/A <xsl:with-param name="package.name" select="/package/@name"/>
0N/A </xsl:call-template>
0N/A </head>
0N/A <body>
0N/A <h2><a href="overview-summary.html" target="classFrame">Home</a></h2>
0N/A <h2>Packages</h2>
0N/A <table width="100%">
0N/A <xsl:apply-templates select=".//package[not(./@name = 'unnamed package')]" mode="all.packages">
0N/A <xsl:sort select="@name"/>
0N/A </xsl:apply-templates>
0N/A </table>
0N/A </body>
0N/A </html>
0N/A</xsl:template>
0N/A
0N/A<xsl:template match="package" mode="all.packages">
0N/A <tr>
0N/A <td nowrap="nowrap">
0N/A <a href="{translate(@name,'.','/')}/package-summary.html" target="classFrame">
0N/A <xsl:value-of select="@name"/>
0N/A </a>
0N/A </td>
0N/A </tr>
0N/A</xsl:template>
0N/A
0N/A
0N/A<xsl:template match="metrics" mode="overview.packages">
0N/A <html>
0N/A <head>
0N/A <xsl:call-template name="create.stylesheet.link">
0N/A <xsl:with-param name="package.name" select="''"/>
0N/A </xsl:call-template>
0N/A </head>
0N/A <body onload="open('allclasses-frame.html','classListFrame')">
0N/A <xsl:call-template name="pageHeader"/>
0N/A <h3>Summary</h3>
0N/A <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
0N/A <tr>
0N/A <th><a href="metrics-reference.html#V(G)">V(G)</a></th>
0N/A <th><a href="metrics-reference.html#LOC">LOC</a></th>
0N/A <th><a href="metrics-reference.html#DIT">DIT</a></th>
0N/A <th><a href="metrics-reference.html#NOA">NOA</a></th>
0N/A <th><a href="metrics-reference.html#NRM">NRM</a></th>
0N/A <th><a href="metrics-reference.html#NLM">NLM</a></th>
0N/A <th><a href="metrics-reference.html#WMC">WMC</a></th>
0N/A <th><a href="metrics-reference.html#RFC">RFC</a></th>
0N/A <th><a href="metrics-reference.html#DAC">DAC</a></th>
0N/A <th><a href="metrics-reference.html#FANOUT">FANOUT</a></th>
0N/A <th><a href="metrics-reference.html#CBO">CBO</a></th>
0N/A <th><a href="metrics-reference.html#LCOM">LCOM</a></th>
0N/A <th><a href="metrics-reference.html#NOCL">NOCL</a></th>
0N/A </tr>
0N/A <xsl:apply-templates select="." mode="print.metrics"/>
0N/A </table>
0N/A <table border="0" width="100%">
0N/A <tr>
0N/A <td style="text-align: justify;">
0N/A Note: Metrics evaluate the quality of software by analyzing the program source and quantifying
0N/A various kind of complexity. Complexity is a common source of problems and defects in software.
0N/A High complexity makes it more difficult to develop, understand, maintain, extend, test and debug
0N/A a program.
0N/A <p/>
0N/A The primary use of metrics is to focus your attention on those parts of code that potentially are
0N/A complexity hot spots. Once the complex areas your program have been uncovered, you can take remedial
0N/A actions.
0N/A For additional information about metrics and their meaning, please consult
0N/A Metamata Metrics manual.
0N/A </td>
0N/A </tr>
0N/A </table>
0N/A
0N/A <h3>Packages</h3>
0N/A <table border="0" cellpadding="5" cellspacing="2" width="100%">
0N/A <xsl:call-template name="all.metrics.header"/>
0N/A <xsl:for-each select=".//package[not(@name = 'unnamed package')]">
0N/A <xsl:sort select="@name" order="ascending"/>
0N/A <xsl:apply-templates select="." mode="print.metrics"/>
0N/A </xsl:for-each>
0N/A </table>
0N/A <!-- @bug there could some classes at this level (classes in unnamed package) -->
0N/A <xsl:call-template name="pageFooter"/>
0N/A </body>
0N/A </html>
0N/A</xsl:template>
0N/A
0N/A<xsl:template match="package" mode="package.summary">
0N/A <HTML>
0N/A <HEAD>
0N/A <xsl:call-template name="create.stylesheet.link">
0N/A <xsl:with-param name="package.name" select="@name"/>
0N/A </xsl:call-template>
0N/A </HEAD>
0N/A <body onload="open('package-frame.html','classListFrame')">
0N/A <xsl:call-template name="pageHeader"/>
0N/A <!-- create an anchor to this package name -->
0N/A <h3>Package <xsl:value-of select="@name"/></h3>
0N/A
0N/A <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
0N/A <xsl:call-template name="all.metrics.header"/>
0N/A <xsl:apply-templates select="." mode="print.metrics"/>
0N/A </table>
0N/A
0N/A <table border="0" width="100%">
0N/A <tr>
0N/A <td style="text-align: justify;">
0N/A Note: Metrics evaluate the quality of software by analyzing the program source and quantifying
0N/A various kind of complexity. Complexity is a common source of problems and defects in software.
0N/A High complexity makes it more difficult to develop, understand, maintain, extend, test and debug
0N/A a program.
0N/A <p/>
0N/A The primary use of metrics is to focus your attention on those parts of code that potentially are
0N/A complexity hot spots. Once the complex areas your program have been uncovered, you can take remedial
0N/A actions.
0N/A For additional information about metrics and their meaning, please consult
0N/A Metamata Metrics manual.
0N/A </td>
0N/A </tr>
0N/A </table>
0N/A
0N/A <xsl:variable name="classes-in-package" select="$doctree/classes/class[@package = current()/@name]"/>
0N/A <xsl:if test="count($classes-in-package) &gt; 0">
0N/A <H3>Classes</H3>
0N/A <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
0N/A <xsl:call-template name="all.metrics.header"/>
0N/A <xsl:for-each select="$classes-in-package">
0N/A <xsl:sort select="@name"/>
0N/A <xsl:apply-templates select="." mode="print.metrics"/>
0N/A </xsl:for-each>
0N/A </table>
0N/A </xsl:if>
0N/A
0N/A <xsl:call-template name="pageFooter"/>
0N/A </body>
0N/A </HTML>
0N/A</xsl:template>
0N/A
0N/A
0N/A<!--
0N/A transform string like a.b.c to ../../../
0N/A @param path the path to transform into a descending directory path
0N/A-->
0N/A<xsl:template name="path">
0N/A <xsl:param name="path"/>
0N/A <xsl:if test="contains($path,'.')">
0N/A <xsl:text>../</xsl:text>
0N/A <xsl:call-template name="path">
0N/A <xsl:with-param name="path"><xsl:value-of select="substring-after($path,'.')"/></xsl:with-param>
0N/A </xsl:call-template>
0N/A </xsl:if>
0N/A <xsl:if test="not(contains($path,'.')) and not($path = '')">
0N/A <xsl:text>../</xsl:text>
0N/A </xsl:if>
0N/A</xsl:template>
0N/A
0N/A
0N/A<!-- create the link to the stylesheet based on the package name -->
0N/A<xsl:template name="create.stylesheet.link">
0N/A <xsl:param name="package.name"/>
0N/A <LINK REL ="stylesheet" TYPE="text/css" TITLE="Style"><xsl:attribute name="href"><xsl:if test="not($package.name = 'unnamed package')"><xsl:call-template name="path"><xsl:with-param name="path" select="$package.name"/></xsl:call-template></xsl:if>stylesheet.css</xsl:attribute></LINK>
0N/A</xsl:template>
0N/A
0N/A
0N/A<!-- Page Header -->
0N/A<xsl:template name="pageHeader">
0N/A
0N/A <!-- jakarta logo -->
0N/A <table border="0" cellpadding="0" cellspacing="0" width="100%">
0N/A <tr>
0N/A <td class="bannercell" rowspan="2">
0N/A <a href="http://jakarta.apache.org/">
0N/A <img src="http://jakarta.apache.org/images/jakarta-logo.gif" alt="http://jakarta.apache.org" align="left" border="0"/>
0N/A </a>
0N/A </td>
0N/A <td style="text-align:right"><h2>Source Code Metrics</h2></td>
0N/A </tr>
0N/A <tr>
0N/A <td style="text-align:right">Designed for use with <a href='http://www.webgain.com/products/quality_analyzer/'>Webgain QA/Metamata Metrics</a> and <a href='http://jakarta.apache.org'>Ant</a>.</td>
0N/A </tr>
0N/A </table>
0N/A <hr size="1"/>
0N/A</xsl:template>
0N/A
0N/A<!-- Page Footer -->
0N/A<xsl:template name="pageFooter">
0N/A</xsl:template>
0N/A
0N/A<!-- class header -->
0N/A<xsl:template name="all.metrics.header">
0N/A <tr>
0N/A <th width="80%">Name</th>
0N/A <th nowrap="nowrap">V(G)</th>
0N/A <th>LOC</th>
0N/A <th>DIT</th>
0N/A <th>NOA</th>
0N/A <th>NRM</th>
0N/A <th>NLM</th>
0N/A <th>WMC</th>
0N/A <th>RFC</th>
0N/A <th>DAC</th>
0N/A <th>FANOUT</th>
0N/A <th>CBO</th>
0N/A <th>LCOM</th>
0N/A <th>NOCL</th>
0N/A </tr>
0N/A</xsl:template>
0N/A
0N/A<!-- method header -->
0N/A<xsl:template name="method.metrics.header">
0N/A <tr>
0N/A <th width="80%">Name</th>
0N/A <th nowrap="nowrap">V(G)</th>
0N/A <th>LOC</th>
0N/A <th>FANOUT</th>
0N/A <th>CBO</th>
0N/A </tr>
0N/A</xsl:template>
0N/A
0N/A<!-- method information -->
0N/A<xsl:template match="method" mode="print.metrics">
0N/A <tr>
0N/A <xsl:call-template name="alternate-row"/>
0N/A <td><xsl:apply-templates select="@name"/></td>
0N/A <td><xsl:apply-templates select="@vg"/></td>
0N/A <td><xsl:apply-templates select="@loc"/></td>
0N/A <td><xsl:apply-templates select="@fanout"/></td>
0N/A <td><xsl:apply-templates select="@cbo"/></td>
0N/A </tr>
0N/A</xsl:template>
0N/A
0N/A<!-- class information -->
0N/A<xsl:template match="class" mode="print.metrics">
0N/A <tr>
0N/A <xsl:call-template name="alternate-row"/>
0N/A <td><a href="{@name}.html"><xsl:value-of select="@name"/></a></td>
0N/A <td><xsl:apply-templates select="@vg"/></td>
0N/A <td><xsl:apply-templates select="@loc"/></td>
0N/A <td><xsl:apply-templates select="@dit"/></td>
0N/A <td><xsl:apply-templates select="@noa"/></td>
0N/A <td><xsl:apply-templates select="@nrm"/></td>
0N/A <td><xsl:apply-templates select="@nlm"/></td>
0N/A <td><xsl:apply-templates select="@wmc"/></td>
0N/A <td><xsl:apply-templates select="@rfc"/></td>
0N/A <td><xsl:apply-templates select="@dac"/></td>
0N/A <td><xsl:apply-templates select="@fanout"/></td>
0N/A <td><xsl:apply-templates select="@cbo"/></td>
0N/A <td><xsl:apply-templates select="@lcom"/></td>
0N/A <td><xsl:apply-templates select="@nocl"/></td>
0N/A </tr>
0N/A</xsl:template>
0N/A
0N/A<xsl:template match="file|package" mode="print.metrics">
0N/A <tr>
0N/A <xsl:call-template name="alternate-row"/>
0N/A <td>
0N/A <a href="{translate(@name,'.','/')}/package-summary.html" target="classFrame">
0N/A <xsl:value-of select="@name"/>
0N/A </a>
0N/A </td>
0N/A <td><xsl:apply-templates select="@vg"/></td>
0N/A <td><xsl:apply-templates select="@loc"/></td>
0N/A <td><xsl:apply-templates select="@dit"/></td>
0N/A <td><xsl:apply-templates select="@noa"/></td>
0N/A <td><xsl:apply-templates select="@nrm"/></td>
0N/A <td><xsl:apply-templates select="@nlm"/></td>
0N/A <td><xsl:apply-templates select="@wmc"/></td>
0N/A <td><xsl:apply-templates select="@rfc"/></td>
0N/A <td><xsl:apply-templates select="@dac"/></td>
0N/A <td><xsl:apply-templates select="@fanout"/></td>
0N/A <td><xsl:apply-templates select="@cbo"/></td>
0N/A <td><xsl:apply-templates select="@lcom"/></td>
0N/A <td><xsl:apply-templates select="@nocl"/></td>
0N/A </tr>
0N/A</xsl:template>
0N/A
0N/A<xsl:template match="metrics" mode="print.metrics">
0N/A <tr>
0N/A <xsl:call-template name="alternate-row"/>
0N/A <!-- the global metrics is the top package metrics -->
0N/A <td><xsl:apply-templates select="/package/@vg"/></td>
0N/A <td><xsl:apply-templates select="/package/@loc"/></td>
0N/A <td><xsl:apply-templates select="/package/@dit"/></td>
0N/A <td><xsl:apply-templates select="/package/@noa"/></td>
0N/A <td><xsl:apply-templates select="/package/@nrm"/></td>
0N/A <td><xsl:apply-templates select="/package/@nlm"/></td>
0N/A <td><xsl:apply-templates select="/package/@wmc"/></td>
0N/A <td><xsl:apply-templates select="/package/@rfc"/></td>
0N/A <td><xsl:apply-templates select="/package/@dac"/></td>
0N/A <td><xsl:apply-templates select="/package/@fanout"/></td>
0N/A <td><xsl:apply-templates select="/package/@cbo"/></td>
0N/A <td><xsl:apply-templates select="/package/@lcom"/></td>
0N/A <td><xsl:apply-templates select="/package/@nocl"/></td>
0N/A </tr>
0N/A</xsl:template>
0N/A
0N/A<!-- alternated row style -->
0N/A<xsl:template name="alternate-row">
0N/A<xsl:attribute name="class">
0N/A <xsl:if test="position() mod 2 = 1">a</xsl:if>
0N/A <xsl:if test="position() mod 2 = 0">b</xsl:if>
0N/A</xsl:attribute>
0N/A</xsl:template>
0N/A
0N/A
0N/A<!-- how to display the metrics with their max value -->
0N/A<!-- @todo the max values must be external to the xsl -->
0N/A
0N/A <xsl:template match="@vg">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$vg.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@loc">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$loc.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@dit">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$dit.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@noa">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$noa.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@nrm">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$nrm.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@nlm">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$nlm.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@wmc">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$wmc.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@rfc">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$rfc.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@dac">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$dac.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@fanout">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$fanout.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@cbo">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$cbo.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@lcom">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$lcom.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template match="@nocl">
0N/A <xsl:call-template name="display-value">
0N/A <xsl:with-param name="value" select="current()"/>
0N/A <xsl:with-param name="max" select="$nocl.max"/>
0N/A </xsl:call-template>
0N/A </xsl:template>
0N/A
0N/A <xsl:template name="display-value">
0N/A <xsl:param name="value"/>
0N/A <xsl:param name="max"/>
0N/A <xsl:if test="$value > $max">
0N/A <xsl:attribute name="class">Error</xsl:attribute>
0N/A </xsl:if>
0N/A <xsl:value-of select="$value"/>
0N/A </xsl:template>
0N/A
0N/A</xsl:stylesheet>
0N/A