com.metamatrix.query.sql.proc
Class DeclareStatement

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

public class DeclareStatement
extends AssignmentStatement

This class represents a statement used to declare variables in the storedprocedure language. It extends the Statement that could part of a Block. This this object holds variable and it's type.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.metamatrix.query.sql.proc.Statement
TYPE_ASSIGNMENT, TYPE_BREAK, TYPE_COMMAND, TYPE_CONTINUE, TYPE_DECLARE, TYPE_ERROR, TYPE_IF, TYPE_LOOP, TYPE_UNKNOWN, TYPE_WHILE
 
Constructor Summary
DeclareStatement()
          Constructor for DeclareStatement.
DeclareStatement(ElementSymbol variable, java.lang.String varType)
          Constructor for DeclareStatement.
DeclareStatement(ElementSymbol variable, java.lang.String varType, LanguageObject value)
          Constructor for DeclareStatement.
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 java.lang.Object clone()
          Deep clone statement to produce a new identical statement.
 boolean equals(java.lang.Object obj)
          Compare two DeclareStatements for equality.
 int getType()
          Return the type for this statement, this is one of the types defined on the statement object.
 java.lang.String getVariableType()
          Get the type of this variable declared in this statement.
 int hashCode()
          Get hashcode for TableAssignmentStatement.
 void setVariableType(java.lang.String varType)
          Set the type of this variable declared in this statement.
 java.lang.String toString()
          Returns a string representation of an instance of this class.
 
Methods inherited from class com.metamatrix.query.sql.proc.AssignmentStatement
getCommand, getExpression, getValue, getVariable, hasCommand, hasExpression, setCommand, setExpression, setValue, setVariable
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeclareStatement

public DeclareStatement()
Constructor for DeclareStatement.


DeclareStatement

public DeclareStatement(ElementSymbol variable,
                        java.lang.String varType)
Constructor for DeclareStatement.

Parameters:
variable - The ElementSymbol object that is the variable
valueType - The type of this variable

DeclareStatement

public DeclareStatement(ElementSymbol variable,
                        java.lang.String varType,
                        LanguageObject value)
Constructor for DeclareStatement.

Parameters:
variable - The ElementSymbol object that is the variable
valueType - The type of this variable
Method Detail

getVariableType

public java.lang.String getVariableType()
Get the type of this variable declared in this statement.

Returns:
A string giving the variable type

setVariableType

public void setVariableType(java.lang.String varType)
Set the type of this variable declared in this statement.

Parameters:
varType - A string giving the variable type

getType

public int getType()
Return the type for this statement, this is one of the types defined on the statement object.

Overrides:
getType in class AssignmentStatement
Returns:
The type of this statement

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
Overrides:
acceptVisitor in class AssignmentStatement
Parameters:
visitor - Visitor being used

clone

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

Specified by:
clone in interface LanguageObject
Overrides:
clone in class AssignmentStatement
Returns:
Deep clone

equals

public boolean equals(java.lang.Object obj)
Compare two DeclareStatements for equality. They will only evaluate to equal if they are IDENTICAL: variable and the its type are equal.

Overrides:
equals in class AssignmentStatement
Parameters:
obj - Other object
Returns:
True if equal

hashCode

public int hashCode()
Get hashcode for TableAssignmentStatement. 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 AssignmentStatement
Returns:
Hash code

toString

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

Overrides:
toString in class AssignmentStatement
Returns:
String representation of object


Copyright © 2009. All Rights Reserved.