Groovy Documentation

org.gmetrics.metric.abc
Class AbcMetric

java.lang.Object
  org.gmetrics.metric.AbstractMetric
      org.gmetrics.metric.AbstractMethodMetric
          org.gmetrics.metric.abc.AbcMetric

class AbcMetric
extends AbstractMethodMetric

Calculate the ABC Metric for a class/method. The ABC Counting Rules for Groovy:

   1. Add one to the assignment count for each occurrence of an assignment operator, excluding
      constant declarations:    = *= /= %= += <<= >>= &= |= ^= >>>=
   2. Add one to the assignment count for each occurrence of an increment or decrement operator
      (prefix or postfix):    ++ --
   3. Add one to the branch count for each function call or class method call.
   4. Add one to the branch count for each occurrence of the new operator.
   5. Add one to the condition count for each use of a conditional operator:
      == != <= >= < > <=> =~ ==~
   6. Add one to the condition count for each use of the following keywords:
      else case default try catch ?
   7. Add one to the condition count for each unary conditional expression. These are cases where
      a single variable/field/value is treated as a boolean value. Examples include if (x)
      and return !ready.
 
Additional notes: See http://www.softwarerenovation.com/ABCMetric.pdf
author:
Chris Mair
version:
$Revision: 130 $ - $Date: 2010-07-21 22:46:24 -0400 (Wed, 21 Jul 2010) $


Property Summary
String name

 
Constructor Summary
AbcMetric()

 
Method Summary
MetricResult calculate(MethodNode methodNode, SourceCode sourceCode)

MetricResult calculate(ClosureExpression closureExpression, SourceCode sourceCode)

protected MetricResult createAggregateMetricResult(Collection childMetricResults, ASTNode node)

 
Methods inherited from class AbstractMethodMetric
calculate, calculate, calculateForClass
 
Methods inherited from class AbstractMetric
calculateForClass, calculateForPackage, createAggregateMetricResult, isNotAnInterface
 

Property Detail

name

final String name


 
Constructor Detail

AbcMetric

AbcMetric()


 
Method Detail

calculate

MetricResult calculate(MethodNode methodNode, SourceCode sourceCode)


calculate

MetricResult calculate(ClosureExpression closureExpression, SourceCode sourceCode)


createAggregateMetricResult

protected MetricResult createAggregateMetricResult(Collection childMetricResults, ASTNode node)


 

Groovy Documentation