com.metamatrix.query.sql.proc
Class Block

java.lang.Object
  extended by com.metamatrix.query.sql.proc.Block
All Implemented Interfaces:
LanguageObject, java.io.Serializable, java.lang.Cloneable

public class Block
extends java.lang.Object
implements LanguageObject

This class represents a group of Statement objects. The statements are stored on this object in the order in which they are added.

See Also:
Serialized Form

Constructor Summary
Block()
          Constructor for Block.
Block(Statement statement)
          Constructor for Block with a single Statement.
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 void addStatement(Statement statement)
          Add a Statement to this block.
 java.lang.Object clone()
          Deep clone statement to produce a new identical block.
 boolean equals(java.lang.Object obj)
          Compare two queries for equality.
 java.util.List getStatements()
          Get all the statements contained on this block.
 int hashCode()
          Get hashcode for block.
 void setStatements(java.util.List statements)
          Set the statements contained on this block.
 java.lang.String toString()
          Returns a string representation of an instance of this class.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Block

public Block()
Constructor for Block.


Block

public Block(Statement statement)
Constructor for Block with a single Statement.

Parameters:
statement - The Statement to be added to the block
Method Detail

getStatements

public java.util.List getStatements()
Get all the statements contained on this block.

Returns:
A list of Statements contained in this block

setStatements

public void setStatements(java.util.List statements)
Set the statements contained on this block.

Parameters:
statements - A list of Statements contained in this block

addStatement

public void addStatement(Statement statement)
Add a Statement to this block.

Parameters:
statement - The Statement to be added to the block

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 interface LanguageObject
Parameters:
visitor - Visitor being used

clone

public java.lang.Object clone()
Deep clone statement to produce a new identical block.

Specified by:
clone in interface LanguageObject
Overrides:
clone in class java.lang.Object
Returns:
Deep clone

equals

public boolean equals(java.lang.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.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Other object
Returns:
True if equal

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.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code

toString

public java.lang.String toString()
Returns a string representation of an instance of this class.

Overrides:
toString in class java.lang.Object
Returns:
String representation of object


Copyright © 2009. All Rights Reserved.