org.gmetrics.metric
Class AbstractMetric

java.lang.Object
  extended by org.gmetrics.metric.AbstractMetric
All Implemented Interfaces:
groovy.lang.GroovyObject, Metric
Direct Known Subclasses:
AbstractMethodMetric, ClassLineCountMetric

public abstract class AbstractMetric
extends java.lang.Object
implements groovy.lang.GroovyObject, Metric

Abstract superclass for metrics. Subclasses must implement the calculateForClass(ClassNode, SourceCode) method.

Version:
$Revision: 101 $ - $Date: 2010-03-10 19:17:23 -0500 (Wed, 10 Mar 2010) $
Author:
Chris Mair

Constructor Summary
AbstractMetric()
           
 
Method Summary
 ClassMetricResult applyToClass(org.codehaus.groovy.ast.ClassNode classNode, SourceCode sourceCode)
           
 MetricResult applyToPackage(java.util.Collection childMetricResults)
           
abstract  ClassMetricResult calculateForClass(org.codehaus.groovy.ast.ClassNode classNode, SourceCode sourceCode)
           
protected  MetricResult calculateForPackage(java.util.Collection childMetricResults)
           
protected  java.lang.Object createAggregateMetricResult(java.util.Collection childMetricResults)
           
 boolean getEnabled()
           
 groovy.lang.MetaClass getMetaClass()
           
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
           
 boolean isEnabled()
           
protected  boolean isNotAnInterface(org.codehaus.groovy.ast.ClassNode classNode)
           
 void setEnabled(boolean value)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gmetrics.metric.Metric
getBaseLevel, getName
 

Constructor Detail

AbstractMetric

public AbstractMetric()
Method Detail

getEnabled

public boolean getEnabled()

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface Metric

setEnabled

public void setEnabled(boolean value)

calculateForClass

public abstract ClassMetricResult calculateForClass(org.codehaus.groovy.ast.ClassNode classNode,
                                                    SourceCode sourceCode)

applyToPackage

public MetricResult applyToPackage(java.util.Collection childMetricResults)
Specified by:
applyToPackage in interface Metric

calculateForPackage

protected MetricResult calculateForPackage(java.util.Collection childMetricResults)

applyToClass

public ClassMetricResult applyToClass(org.codehaus.groovy.ast.ClassNode classNode,
                                      SourceCode sourceCode)
Specified by:
applyToClass in interface Metric

isNotAnInterface

protected boolean isNotAnInterface(org.codehaus.groovy.ast.ClassNode classNode)

createAggregateMetricResult

protected java.lang.Object createAggregateMetricResult(java.util.Collection childMetricResults)

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject

setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject

invokeMethod

public java.lang.Object invokeMethod(java.lang.String name,
                                     java.lang.Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject

getProperty

public java.lang.Object getProperty(java.lang.String name)
Specified by:
getProperty in interface groovy.lang.GroovyObject

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject


Copyright © 2010. All Rights Reserved.