Groovy Documentation

org.gmetrics.metric.abc
[Groovy] 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
Authors:
Chris Mair
Version:
\$Revision: 130 \$ - \$Date: 2010-07-21 22:46:24 -0400 (Wed, 21 Jul 2010) \$


Property Summary
String name

 
Method Summary
MetricResult calculate(org.codehaus.groovy.ast.MethodNode methodNode, SourceCode sourceCode)

MetricResult calculate(org.codehaus.groovy.ast.expr.ClosureExpression closureExpression, SourceCode sourceCode)

protected MetricResult createAggregateMetricResult(Collection childMetricResults, org.codehaus.groovy.ast.ASTNode node)

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

Property Detail

name

final String name


 
Method Detail

calculate

MetricResult calculate(org.codehaus.groovy.ast.MethodNode methodNode, SourceCode sourceCode)


calculate

MetricResult calculate(org.codehaus.groovy.ast.expr.ClosureExpression closureExpression, SourceCode sourceCode)


createAggregateMetricResult

protected MetricResult createAggregateMetricResult(Collection childMetricResults, org.codehaus.groovy.ast.ASTNode node)


 

Groovy Documentation