public class SourceText extends Object
Constructor and Description |
---|
SourceText(AssertStatement stat,
SourceUnit sourceUnit,
Janitor janitor)
Constructs a SourceText by reading the given assertion's source
text from the given source unit.
|
Modifier and Type | Method and Description |
---|---|
int |
getNormalizedColumn(int line,
int column)
Returns the column in getNormalizedText() corresponding
to the given line and column in the original source text.
|
int |
getNormalizedColumn(String str,
int line,
int column)
Returns the normalized column of the last occurrence of the given
substring within the original source text ending before the given
line and column (exclusive), or -1 if no such occurrence is found.
|
String |
getNormalizedText()
Returns the assertion's source text after removing line breaks.
|
public SourceText(AssertStatement stat, SourceUnit sourceUnit, Janitor janitor)
stat
- an assertion statementsourceUnit
- the source unit containing the assertion statementjanitor
- a Janitor for cleaning up reader sourcespublic String getNormalizedText()
Limitation: Line comments within the assertion's source text are not handled.
public int getNormalizedColumn(int line, int column)
line
- a line numbercolumn
- a column numberpublic int getNormalizedColumn(String str, int line, int column)
str
- a substring in the original source textline
- a line numbercolumn
- a column number