com.pnfsoftware.jeb.core.units.code.java.IJavaBlock |
Java AST interface to represent a sequence of statements
.
Example:
{ stm0; stm1; stm2; }
Statements cannot be null. An exception will be raised if an attempt to insert a null statement is made.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaElement
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract void |
add(IJavaStatement stm)
Append a statement to this block.
| ||||||||||
abstract void | addAll(IJavaBlock b) | ||||||||||
abstract void | addMultiple(IJavaBlock src, int start, int end, boolean removeSourceStatements) | ||||||||||
abstract void |
clear()
Remove all statements of the block, making the block effectively empty: {}
| ||||||||||
abstract IJavaBlock |
duplicate()
Duplicate this element.
| ||||||||||
abstract void | generateBody(JavaOutputSink out) | ||||||||||
abstract void |
generateBody(JavaOutputSink out, boolean expectLambdaExpression)
Raw body generation, the caller is responsible for calling generateEnter/generateExit
| ||||||||||
abstract void | generateFooter(JavaOutputSink out) | ||||||||||
abstract void | generateHeader(JavaOutputSink out) | ||||||||||
abstract IJavaStatement |
get(int index)
Get the statement at a given index.
| ||||||||||
abstract IJavaStatement | getLast() | ||||||||||
abstract void |
insert(int index, IJavaStatement stm)
Insert a statement at the given index.
| ||||||||||
abstract void |
insertAll(int index, IJavaBlock b)
Insert all statements of another block in this block.
| ||||||||||
abstract void | insertMultiple(int index, IJavaBlock src, int start, int end, boolean removeSourceStatements) | ||||||||||
abstract boolean | isEmpty() | ||||||||||
abstract IJavaStatement |
remove(int index)
Pull a statement from the block.
| ||||||||||
abstract boolean |
remove(IJavaStatement stm)
Remove a statement from the block.
| ||||||||||
abstract IJavaStatement | removeLast() | ||||||||||
abstract void | removeMultiple(int index, int cnt) | ||||||||||
abstract void | removeRange(int from, int to) | ||||||||||
abstract void |
set(int index, IJavaStatement stm)
Replace a statement by another statement.
| ||||||||||
abstract int |
size()
Get the number of statements in this block.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaCompound
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaElement
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaExpression
| |||||||||||
From interface
com.pnfsoftware.jeb.core.units.code.java.IJavaStatement
| |||||||||||
From interface
java.lang.Iterable
|
Append a statement to this block.
stm | mandatory statement to be appended |
---|
Remove all statements of the block, making the block effectively empty: {}
Duplicate this element.
Raw body generation, the caller is responsible for calling generateEnter/generateExit
Get the statement at a given index.
index | 0-based statement index |
---|
Insert a statement at the given index.
index | 0-based statement index |
---|---|
stm | mandatory statement to be inserted |
Insert all statements of another block in this block.
index | 0-based index |
---|---|
b | mandatory block |
Pull a statement from the block.
index | 0-based statement index |
---|
Remove a statement from the block. Does not throw if the statement is not found.
stm | mandatory statement |
---|
Replace a statement by another statement.
index | 0-based statement index |
---|---|
stm | mandatory statement |
Get the number of statements in this block.
Note: Compound statements
count for a single statement.