Overview | Package | Class | Deprecated | Index | Help
| Groovy Documentation
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.runtime.powerassert
[Java] Class SourceText

    java.lang.Object
      org.codehaus.groovy.runtime.powerassert.SourceText

    public class SourceText
    extends java.lang.Object

Provides the source text for an assertion statement and translates coordinates in the original source text to coordinates relative to the assertion's (normalized) source text.

Authors:
  Peter Niederwieser

Constructor Summary
`SourceText(AssertStatement stat, SourceUnit sourceUnit, Janitor janitor)` Constructs a `SourceText` by reading the given assertion's source text from the given source unit.

Method Summary
`int` | `getNormalizedColumn(int line, int column)` Returns the column in `getNormalizedText()` corresponding to the given line and column in the original source text.
`java.lang.String` | `getNormalizedText()` Returns the assertion's source text after removing line breaks.

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Constructor Detail

### SourceText

    public SourceText(AssertStatement stat, SourceUnit sourceUnit, Janitor janitor)

  Constructs a `SourceText` by reading the given assertion's source text from the given source unit.
  Parameters:
    `stat` - an assertion statement
    `sourceUnit` - the source unit containing the assertion statement
    `janitor` - a `Janitor` for cleaning up reader sources

Method Detail

### getNormalizedColumn

    public int getNormalizedColumn(int line, int column)

  Returns the column in `getNormalizedText()` corresponding to the given line and column in the original source text. The first character in the normalized text has column 1.
  Parameters:
    `line` - a line number
    `column` - a column number
  Returns:
    the column in getNormalizedText() corresponding to the given line and column in the original source text

### getNormalizedText

    public java.lang.String getNormalizedText()

  Returns the assertion's source text after removing line breaks.

  Limitation: Line comments within the assertion's source text are not handled.

  Returns:
    the assertion's source text after removing line breaks.

Groovy Documentation