public final class SourceSection extends Object
Source of program code.; supports
multiple modes of access to the text and its location.
Two available source sections are considered equal if their sources, start and length are equal.
Unavailable source sections are compared by identity. Source sections are
designed to be used as keys in hash maps.| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
CharSequence |
getCharacters()
Returns the source code fragment described by this section.
|
int |
getCharEndIndex()
Returns the index of the text position immediately following the last character in the
section.
|
int |
getCharIndex()
Returns the 0-based index of the first character in this section.
|
int |
getCharLength()
Returns the length of this section in characters.
|
int |
getEndColumn()
Returns the 1-based column number of the last character in this section (inclusive).
|
int |
getEndLine()
Returns 1-based line number of the last character in this section (inclusive).
|
Source |
getSource()
Representation of the source program that contains this section.
|
int |
getStartColumn()
Returns the 1-based column number of the first character in this section (inclusive).
|
int |
getStartLine()
Returns 1-based line number of the first character in this section (inclusive).
|
int |
hashCode() |
boolean |
isAvailable()
Returns whether this is a special instance that signifies that source information is
available.
|
String |
toString()
Returns an implementation-defined string representation of this source section to be used for
debugging purposes only.
|
public boolean isAvailable()
0.public Source getSource()
public int getStartLine()
1 for out of bounds or unavailable source sections. Note
that calling this method causes the code of the
source to be loaded if it was not yet loaded.public int getStartColumn()
1 for out of bounds or unavailable source sections. Note
that calling this method causes the code of the
source to be loaded if it was not yet loaded.public int getEndLine()
1 for out of bounds or unavailable source sections. Note
that calling this method causes the code of the
source to be loaded if it was not yet loaded.public int getEndColumn()
1 for out of bounds or unavailable source sections. Note
that calling this method causes the code of the
source to be loaded if it was not yet loaded.public int getCharIndex()
0 for
unavailable source sections. Note that calling this method does not
cause the code of the source to be
loaded. The returned index might be out of bounds of the source code if assertions (-ea) are
not enabled.public int getCharLength()
0 for
unavailable source sections. Note that calling this method does not
cause the code of the source to be
loaded. The returned length might be out of bounds of the source code if assertions (-ea) are
not enabled.public int getCharEndIndex()
0 for unavailable source sections. Note
that calling this method does not cause the code of the
source to be loaded. The returned index might be out of bounds of the
source code if assertions (-ea) are not enabled.public CharSequence getCharacters()
unavailable source sections.public String toString()
toString in class ObjectSourceSection.getCharacters()