org.gmetrics.metric
Class AbstractAstVisitor

java.lang.Object
  extended by org.codehaus.groovy.ast.CodeVisitorSupport
      extended by org.codehaus.groovy.ast.ClassCodeVisitorSupport
          extended by org.gmetrics.metric.AbstractAstVisitor
All Implemented Interfaces:
groovy.lang.GroovyObject, org.codehaus.groovy.ast.GroovyClassVisitor, org.codehaus.groovy.ast.GroovyCodeVisitor, AstVisitor
Direct Known Subclasses:
AbcAstVisitor, ClassLineCountAstVisitor, CyclomaticComplexityAstVisitor, MethodLineCountAstVisitor

public abstract class AbstractAstVisitor
extends org.codehaus.groovy.ast.ClassCodeVisitorSupport
implements groovy.lang.GroovyObject, AstVisitor

Abstract superclass for Groovy AST Visitors

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

Field Summary
static java.lang.Object MAX_SOURCE_LINE_LENGTH
           
static java.lang.Object SOURCE_LINE_LAST_SEGMENT_LENGTH
           
 
Constructor Summary
AbstractAstVisitor()
           
 
Method Summary
 groovy.lang.MetaClass getMetaClass()
           
 java.lang.Object getProperty(java.lang.String name)
           
 SourceCode getSourceCode()
           
protected  org.codehaus.groovy.control.SourceUnit getSourceUnit()
           
 java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args)
           
protected  java.lang.Object isFirstVisit(java.lang.Object expression)
          Return true if the AST expression has not already been visited.
protected  boolean isSyntheticNonRunMethod(org.codehaus.groovy.ast.MethodNode methodNode)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 void setSourceCode(SourceCode value)
          Set the SourceCode associated with this visitor
protected  java.lang.String sourceLine(org.codehaus.groovy.ast.ASTNode node)
          Return the source line corresponding to the specified AST node
 
Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport
addError, visitAnnotations, visitAssertStatement, visitBlockStatement, visitBreakStatement, visitCaseStatement, visitCatchStatement, visitClass, visitClassCodeContainer, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitMethod, visitProperty, visitReturnStatement, visitStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitTryCatchFinally, visitWhileLoop
 
Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport
visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitDeclarationExpression, visitFieldExpression, visitGStringExpression, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitRegexExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitTernaryExpression, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.codehaus.groovy.ast.GroovyClassVisitor
visitClass, visitConstructor, visitField, visitMethod, visitProperty
 

Field Detail

MAX_SOURCE_LINE_LENGTH

public static final java.lang.Object MAX_SOURCE_LINE_LENGTH

SOURCE_LINE_LAST_SEGMENT_LENGTH

public static final java.lang.Object SOURCE_LINE_LAST_SEGMENT_LENGTH
Constructor Detail

AbstractAstVisitor

public AbstractAstVisitor()
Method Detail

getSourceCode

public SourceCode getSourceCode()

setSourceCode

public void setSourceCode(SourceCode value)
Description copied from interface: AstVisitor
Set the SourceCode associated with this visitor

Specified by:
setSourceCode in interface AstVisitor
Parameters:
value - - the SourceCode

isFirstVisit

protected java.lang.Object isFirstVisit(java.lang.Object expression)
Return true if the AST expression has not already been visited. If it is the first visit, register the expression so that the next visit will return false.

Parameters:
expression - - the AST expression to check
Returns:
true if the AST expression has NOT already been visited

sourceLine

protected java.lang.String sourceLine(org.codehaus.groovy.ast.ASTNode node)
Return the source line corresponding to the specified AST node

Parameters:
node - - the Groovy AST node

getSourceUnit

protected org.codehaus.groovy.control.SourceUnit getSourceUnit()
Specified by:
getSourceUnit in class org.codehaus.groovy.ast.ClassCodeVisitorSupport

isSyntheticNonRunMethod

protected boolean isSyntheticNonRunMethod(org.codehaus.groovy.ast.MethodNode methodNode)

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.