com.metamatrix.query.sql.proc
Class AssignmentStatement

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

public class AssignmentStatement
extends Statement
implements SubqueryContainer

This class represents an assignment statement in the storedprocedure language. It extends the Statement that could part of a Block. This statement holds references to the variable and it's value which could be an Expression or a Command.

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
AssignmentStatement()
          Constructor for AssignmentStatement.
AssignmentStatement(ElementSymbol variable, LanguageObject value)
           
 
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 AssignmentStatements for equality.
 Command getCommand()
          Returns the subquery Command object
 Expression getExpression()
           
 int getType()
          Return the type for this statement, this is one of the types defined on the statement object.
 LanguageObject getValue()
           
 ElementSymbol getVariable()
          Get the expression giving the value that is assigned to the variable.
 boolean hasCommand()
           
 boolean hasExpression()
           
 int hashCode()
          Get hashcode for AssignmentStatement.
 void setCommand(Command command)
          Sets the subquery Command object
 void setExpression(Expression expression)
           
 void setValue(LanguageObject value)
           
 void setVariable(ElementSymbol variable)
          Set the variable that is assigned to the value
 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

AssignmentStatement

public AssignmentStatement()
Constructor for AssignmentStatement.


AssignmentStatement

public AssignmentStatement(ElementSymbol variable,
                           LanguageObject value)
Method Detail

hasCommand

public boolean hasCommand()

getCommand

public Command getCommand()
Description copied from interface: SubqueryContainer
Returns the subquery Command object

Specified by:
getCommand in interface SubqueryContainer
Returns:
the subquery Command object

setCommand

public void setCommand(Command command)
Description copied from interface: SubqueryContainer
Sets the subquery Command object

Specified by:
setCommand in interface SubqueryContainer
Parameters:
command - the subquery Command object

hasExpression

public boolean hasExpression()

getExpression

public Expression getExpression()

setExpression

public void setExpression(Expression expression)

getValue

public LanguageObject getValue()

setValue

public void setValue(LanguageObject value)

getVariable

public ElementSymbol getVariable()
Get the expression giving the value that is assigned to the variable.

Returns:
An Expression with the value

setVariable

public void setVariable(ElementSymbol variable)
Set the variable that is assigned to the value


getType

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

Specified by:
getType in class Statement
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
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
Specified by:
clone in class Statement
Returns:
Deep clone

equals

public boolean equals(java.lang.Object obj)
Compare two AssignmentStatements for equality. They will only evaluate to equal if they are IDENTICAL: variable and its value which could be a command or an expression objects are equal.

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

hashCode

public int hashCode()
Get hashcode for AssignmentStatement. WARNING: This hash code relies on the hash codes of the variable and its value which could be a command or an expression.

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.