public interface Block extends Codeable
Block superinterface. A Block is a structure that holds
Statements and typically delimited by braces. Block acts as a factory
for all Statement objects.| Modifier and Type | Method and Description |
|---|---|
List<Statement> |
getStatements()
Gets the list of statements as an list of
Statement. |
Statement |
insertStatement(int index,
Expression expression)
Insert the expression at the specified index.
|
void |
insertStatement(int index,
Statement statement)
Insert the statement at the specified index.
|
Break |
newBreak()
Adds a new
Break statement to this block and returns it. |
Continue |
newContinue()
Adds a new
Continue statement to this block and returns it. |
Let |
newDeclarationLet(Type type)
Adds a new
Let statement to declaration section of this block for
the given type and returns it. |
DoWhile |
newDoWhile(Expression predicate)
Adds a new
DoWhile statement to this block and returns it. |
Empty |
newEmpty()
Adds a new
Empty statement to this block and returns it. |
For |
newFor()
Adds a new
For statement to this block and returns it. |
If |
newIf(Expression predicate)
Adds a new
If statement to this block and returns it. |
Let |
newLet(Type type)
Adds a new
Let statement to this block for the given type and
returns it. |
LocalBlock |
newLocalBlock()
Adds a new
LocalBlock statement to this block and returns it. |
LocalClass |
newLocalClass(String name)
Adds a new
LocalClass statement to this block and returns it. |
LocalClass |
newLocalClass(String name,
Comparator comparator)
Adds a new
LocalClass statement to this block and returns it. |
Return |
newReturn()
Adds a new
Return statement to this block and returns it. |
ExpressionStatement |
newStmt(Expression expr)
Adds a new
ExpressionStatement statement to this block on the
given statement Expression and returns it. |
Switch |
newSwitch(Expression integer)
Adds a new
Switch statement to this block and returns it. |
Synchronized |
newSynchronized(Expression mutex)
Adds a new
Synchronized statement to this block and returns it. |
Throw |
newThrow(Expression throwable)
Adds a new
Throw statement to this block and returns it. |
Try |
newTry()
Adds a new
Try statement to this block and returns it. |
While |
newWhile(Expression predicate)
Adds a new
While statement to this block and returns it. |
void |
removeStmt(Statement statement)
removes a statement from the statement list.
|
applyStyle, cast, getComment, isActive, isBlockWithAbruptCompletion, setComment, toCode, visit, vmStatement insertStatement(int index, Expression expression)
Statementvoid insertStatement(int index,
Statement statement)
Break newBreak()
Break statement to this block and returns it.Continue newContinue()
Continue statement to this block and returns it.Let newDeclarationLet(Type type)
Let statement to declaration section of this block for
the given type and returns it.DoWhile newDoWhile(Expression predicate)
DoWhile statement to this block and returns it.Empty newEmpty()
Empty statement to this block and returns it.For newFor()
For statement to this block and returns it.If newIf(Expression predicate)
If statement to this block and returns it.Let newLet(Type type)
Let statement to this block for the given type and
returns it.LocalBlock newLocalBlock()
LocalBlock statement to this block and returns it.LocalClass newLocalClass(String name)
LocalClass statement to this block and returns it.LocalClass newLocalClass(String name, Comparator comparator)
LocalClass statement to this block and returns it.Return newReturn()
Return statement to this block and returns it.ExpressionStatement newStmt(Expression expr)
ExpressionStatement statement to this block on the
given statement Expression and returns it.Switch newSwitch(Expression integer)
Switch statement to this block and returns it.Synchronized newSynchronized(Expression mutex)
Synchronized statement to this block and returns it.Throw newThrow(Expression throwable)
Throw statement to this block and returns it.Try newTry()
Try statement to this block and returns it.While newWhile(Expression predicate)
While statement to this block and returns it.void removeStmt(Statement statement)
Copyright © 2000–2018 jenesis4java. All rights reserved.