Package org.teiid.query.sql.proc
Class Block
- java.lang.Object
-
- org.teiid.query.sql.proc.Statement
-
- org.teiid.query.sql.proc.Block
-
- All Implemented Interfaces:
Cloneable
,LanguageObject
,Statement.Labeled
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.teiid.query.sql.proc.Statement
Statement.Labeled
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
-
Field Summary
-
Fields inherited from class org.teiid.query.sql.proc.Statement
TYPE_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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.void
addStatement(Statement statement)
Add aStatement
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.
-
-
-
Constructor Detail
-
Block
public Block()
Constructor for Block.
-
Block
public Block(Statement statement)
Constructor for Block with a singleStatement
.- Parameters:
statement
- TheStatement
to be added to the block
-
-
Method Detail
-
getLabel
public String getLabel()
- Specified by:
getLabel
in interfaceStatement.Labeled
-
setLabel
public void setLabel(String label)
- Specified by:
setLabel
in interfaceStatement.Labeled
-
getStatements
public List<Statement> getStatements()
Get all the statements contained on this block.- Returns:
- A list of
Statement
s contained in this block
-
setStatements
public void setStatements(List<Statement> statements)
Set the statements contained on this block.- Parameters:
statements
- A list ofStatement
s contained in this block
-
addStatement
public void addStatement(Statement statement)
Add aStatement
to this block.- Parameters:
statement
- TheStatement
to be added to the block
-
addStatement
public void addStatement(Statement statement, boolean exception)
-
acceptVisitor
public void acceptVisitor(LanguageVisitor visitor)
Description copied from interface:LanguageObject
Method for accepting a visitor. It is the responsibility of the language object to call back on the visitor.- Specified by:
acceptVisitor
in interfaceLanguageObject
- Parameters:
visitor
- Visitor being used
-
clone
public Block clone()
Deep clone statement to produce a new identical block.- Specified by:
clone
in interfaceLanguageObject
- Specified by:
clone
in classStatement
- Returns:
- Deep clone
-
equals
public boolean equals(Object obj)
Compare two queries for equality. Blocks will only evaluate to equal if they are IDENTICAL: statements in the block are equal and are in the same order.
-
hashCode
public int hashCode()
Get hashcode for block. WARNING: This hash code relies on the hash codes of the statements present in the block. If statements are added to the block or if statements on the block change the hash code will change. Hash code is only valid after the block has been completely constructed.
-
toString
public String toString()
Returns a string representation of an instance of this class.
-
isAtomic
public boolean isAtomic()
-
setAtomic
public void setAtomic(boolean atomic)
-
getType
public int getType()
Description copied from class:Statement
Return type of statement to make it easier to build switch statements by statement type.
-
getExceptionGroup
public String getExceptionGroup()
-
setExceptionGroup
public void setExceptionGroup(String exceptionGroup)
-
-