public class Block extends Statement implements Statement.Labeled
This class represents a group of Statement objects. The
statements are stored on this object in the order in which they are added.
Statement.LabeledLanguageObject.UtilTYPE_ASSIGNMENT, TYPE_BREAK, TYPE_COMMAND, TYPE_COMPOUND, TYPE_CONTINUE, TYPE_DECLARE, TYPE_ERROR, TYPE_IF, TYPE_LEAVE, TYPE_LOOP, TYPE_RETURN, TYPE_UNKNOWN, TYPE_UPDATE, TYPE_WHILE| Constructor and Description |
|---|
Block()
Constructor for Block.
|
Block(Statement statement)
Constructor for Block with a single
Statement. |
| Modifier and Type | Method and Description |
|---|---|
void |
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.
|
void |
addStatement(Statement statement)
Add a
Statement to this block. |
void |
addStatement(Statement statement,
boolean exception) |
Block |
clone()
Deep clone statement to produce a new identical block.
|
boolean |
equals(Object obj)
Compare two queries for equality.
|
String |
getExceptionGroup() |
List<Statement> |
getExceptionStatements() |
String |
getLabel() |
List<Statement> |
getStatements()
Get all the statements contained on this block.
|
int |
getType()
Return type of statement to make it easier to build switch statements by statement type.
|
int |
hashCode()
Get hashcode for block.
|
boolean |
isAtomic() |
void |
setAtomic(boolean atomic) |
void |
setExceptionGroup(String exceptionGroup) |
void |
setExceptionStatements(List<Statement> exceptionStatements) |
void |
setLabel(String label) |
void |
setStatements(List<Statement> statements)
Set the statements contained on this block.
|
String |
toString()
Returns a string representation of an instance of this class.
|
public Block()
public Block(Statement statement)
Statement.statement - The Statement to be added to the blockpublic String getLabel()
getLabel in interface Statement.Labeledpublic void setLabel(String label)
setLabel in interface Statement.Labeledpublic List<Statement> getStatements()
Statements contained in this blockpublic void setStatements(List<Statement> statements)
statements - A list of Statements contained in this blockpublic void addStatement(Statement statement)
Statement to this block.statement - The Statement to be added to the blockpublic void addStatement(Statement statement, boolean exception)
public void acceptVisitor(LanguageVisitor visitor)
LanguageObjectacceptVisitor in interface LanguageObjectvisitor - Visitor being usedpublic Block clone()
clone in interface LanguageObjectclone in class Statementpublic boolean equals(Object obj)
public int hashCode()
public String toString()
public boolean isAtomic()
public void setAtomic(boolean atomic)
public int getType()
Statementpublic String getExceptionGroup()
public void setExceptionGroup(String exceptionGroup)
Copyright © 2019. All rights reserved.