public class CodeSection extends Object implements Serializable
A code section must describe a continuous part of source code, meaning that the last statement in the section will always be executed if the first one was executed, given that no Exceptions occur. Furthermore, if the last statement is not the same as the first one, the last statement may only be executed after the first one was. All statements that may potentially be executed after the first statement but before the last one are considered to be “in” the section. A code section is considered to have been “completely executed” if the section’s first and last statement were executed. This does generally not mean that all statements in the section were executed. Code Sections no fulfilling these requirements must not be created. However, this is not checked at run time, because doing so would solve the halting problem.
Constructor and Description |
---|
CodeSection(File startFile,
int startIndex,
File endFile,
int endIndex)
Creates a code section that spans from the statements starting at
startIndex in startFile to the statement starting at
endIndex in endFile . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object) |
File |
getEndFile()
Gets the file that contains this section’s last statement.
|
int |
getEndSectionIndex()
Gets the index of the first character of the last statement in this code section.
|
File |
getStartFile()
Gets the file that contains this section’s first statement.
|
int |
getStartSectionIndex()
Gets the index of the first character of the last statement in this code section.
|
int |
hashCode() |
String |
toString() |
public CodeSection(File startFile, int startIndex, File endFile, int endIndex)
startIndex
in startFile
to the statement starting at
endIndex
in endFile
.startFile
- The file containing this section’s first statement. Must not be
null
and startFile.isFile()
must return
true
.startIndex
- The index of this section’s first statement’s first character in
startFile
. Counting starts at 0
.endFile
- The file containing this section’s last statement. Must not be
null
and endFile.isFile()
must return
true
.endIndex
- The index of this section’s last statement’s first character in
endFile
. Counting starts at 0
.IllegalArgumentException
- When startFile.isFile()
or
endFile.isFile()
returned false
.RuntimeException
- If startFile
or endFile
cannot be read.public File getEndFile()
null
and getEndFile().isFile()
always returns true
.public int getEndSectionIndex()
public File getStartFile()
null
and getStartFile().isFile()
always returns
true
.public int getStartSectionIndex()