Groovy Documentation

groovy.org.codenarc.source
[Groovy] Class AbstractSourceCode

java.lang.Object
  groovy.org.codenarc.source.AbstractSourceCode
All Implemented Interfaces:
SourceCode

@SuppressWarnings('AbstractClassWithoutAbstractMethod')
abstract class AbstractSourceCode

Abstract superclass for SourceCode implementations

Authors:
Chris Mair
Hamlet D'Arcy


Property Summary
static def FILE_SEPARATOR

static def LOG

static def SEPARATOR_PROP

SuppressionAnalyzer suppressionAnalyzer

 
Method Summary
org.codehaus.groovy.ast.ModuleNode getAst()

Return the Groovy AST (Abstract Syntax Tree) for this source file

int getLineNumberForCharacterIndex(int charIndex)

Return the line index for the line containing the character at the specified index within the source code.

List getLines()

@return the List of lines of the source code (with line terminators removed)

Map getMethodCallExpressions()

boolean isValid()

Return true if and only if the source code can be successfully compiled

String line(int lineNumber)

Get the trimmed line at the specified index

protected String normalizePath(String path)

Return the normalized value of the specified path.

protected void setSuppressionAnalyzer(SuppressionAnalyzer suppressionAnalyzer)

Setter exists to avoid circular dependency.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Property Detail

FILE_SEPARATOR

static final def FILE_SEPARATOR


LOG

static final def LOG


SEPARATOR_PROP

static final def SEPARATOR_PROP


suppressionAnalyzer

SuppressionAnalyzer suppressionAnalyzer


 
Method Detail

getAst

org.codehaus.groovy.ast.ModuleNode getAst()
Return the Groovy AST (Abstract Syntax Tree) for this source file
Returns:
the ModuleNode representing the AST for this source file


getLineNumberForCharacterIndex

int getLineNumberForCharacterIndex(int charIndex)
Return the line index for the line containing the character at the specified index within the source code.
Parameters:
charIndex - - the index of the character within the source code (zero-based)
Returns:
the line number (one-based) containing the specified character; Return -1 if charIndex is not valid.


getLines

List getLines()
Returns:
the List of lines of the source code (with line terminators removed)


getMethodCallExpressions

Map getMethodCallExpressions()


isValid

boolean isValid()
Return true if and only if the source code can be successfully compiled
Returns:
true only if the source code is valid


line

String line(int lineNumber)
Get the trimmed line at the specified index
Parameters:
lineNumber - - the zero-based line number; may be negative
Returns:
the trimmed line at the specified index, or null if lineNumber is not valid


normalizePath

protected String normalizePath(String path)
Return the normalized value of the specified path. Convert file separator chars to standard '/'.
Parameters:
path - - the path to normalize
Returns:
the normalized value


setSuppressionAnalyzer

protected void setSuppressionAnalyzer(SuppressionAnalyzer suppressionAnalyzer)
Setter exists to avoid circular dependency.
Parameters:
suppressionAnalyzer - suppression analyzer


 

Groovy Documentation