Package: groovy.org.codenarc.source

## [Groovy] Class AbstractSourceCode

- groovy.org.codenarc.source.AbstractSourceCode

- All Implemented Interfaces and Traits:
    SourceCode

      @SuppressWarnings('AbstractClassWithoutAbstractMethod')
      abstract class AbstractSourceCode

  Abstract superclass for SourceCode implementations

  Authors:
    Chris Mair
    Hamlet D'Arcy

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `static def` | `LOG`
    `static def` | `SEPARATOR_PROP`
    `SuppressionAnalyzer` | `suppressionAnalyzer`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `org.codehaus.groovy.ast.ModuleNode` | `getAst()` Return the Groovy AST (Abstract Syntax Tree) for this source file
    `` | `int` | `getAstCompilerPhase()` @return compiler phase (as in org.codehaus.groovy.control.Phases) up to which the AST will be processed
    `` | `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<org.codehaus.groovy.ast.ClassNode, List<org.codehaus.groovy.ast.expr.MethodCallExpression>>` | `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.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, toString, hashCode, getClass, notify, notifyAll, wait, wait, wait`

- - ### Property Detail

    - #### static final def LOG

    - #### static final def SEPARATOR_PROP

    - #### SuppressionAnalyzer suppressionAnalyzer

  - ### Method Detail

    - #### 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

    - #### @SuppressWarnings('GetterMethodCouldBeProperty') int getAstCompilerPhase()

      Returns:
        compiler phase (as in org.codehaus.groovy.control.Phases) up to which the AST will be processed

    - #### 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.

    - #### List getLines()

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

    - #### Map<org.codehaus.groovy.ast.ClassNode, List<org.codehaus.groovy.ast.expr.MethodCallExpression>> getMethodCallExpressions()

    - #### boolean isValid()

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

      Returns:
        true only if the source code is valid

    - #### 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

    - #### 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

    - #### protected void setSuppressionAnalyzer(SuppressionAnalyzer suppressionAnalyzer)

      Setter exists to avoid circular dependency.

      Parameters:
        `suppressionAnalyzer` - suppression analyzer