org.teiid.query.sql.symbol
Class CaseExpression

java.lang.Object
  extended by org.teiid.query.sql.symbol.AbstractCaseExpression
      extended by org.teiid.query.sql.symbol.CaseExpression
All Implemented Interfaces:
java.lang.Cloneable, LanguageObject, Expression

public class CaseExpression
extends AbstractCaseExpression


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
 
Constructor Summary
CaseExpression(Expression expression, java.util.List when, java.util.List then)
          Constructor for CaseExpression objects
 
Method Summary
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 java.lang.Object clone()
          Implement clone to make objects cloneable.
 boolean equals(java.lang.Object obj)
           
 Expression getExpression()
          Gets the expression whose evaluation is being tested in this case expression.
 java.util.List getWhen()
          Gets the List of Expressions in the WHEN parts of this expression.
 int getWhenCount()
          Gets the number of WHEN and THEN parts this case expression contains.
 Expression getWhenExpression(int index)
          Gets the WHEN expression at the given 0-based index.
 boolean isResolved()
          Return true if expression has been fully resolved.
 void setExpression(Expression expr)
          Sets the expression for this case expression
 void setWhen(java.util.List when, java.util.List then)
          Sets the WHEN and THEN parts of this CASE expression.
 
Methods inherited from class org.teiid.query.sql.symbol.AbstractCaseExpression
getElseExpression, getThen, getThenExpression, getType, hashCode, setElseExpression, setThen, setType, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaseExpression

public CaseExpression(Expression expression,
                      java.util.List when,
                      java.util.List then)
Constructor for CaseExpression objects

Parameters:
expression - a non-null expression
when - a non-null List containing at least one Expression
then - a non-null List containing at least one Expression
Method Detail

getExpression

public Expression getExpression()
Gets the expression whose evaluation is being tested in this case expression.

Returns:

setExpression

public void setExpression(Expression expr)
Sets the expression for this case expression

Parameters:
expr - a non-null Expression

getWhenCount

public int getWhenCount()
Description copied from class: AbstractCaseExpression
Gets the number of WHEN and THEN parts this case expression contains. This number is always >= 1.

Specified by:
getWhenCount in class AbstractCaseExpression
Returns:
See Also:
AbstractCaseExpression.getWhenCount()

getWhen

public java.util.List getWhen()
Gets the List of Expressions in the WHEN parts of this expression. Never null.

Returns:

getWhenExpression

public Expression getWhenExpression(int index)
Gets the WHEN expression at the given 0-based index.

Parameters:
index -
Returns:

setWhen

public void setWhen(java.util.List when,
                    java.util.List then)
Sets the WHEN and THEN parts of this CASE expression. Both lists should have the same number of Expressions.

Specified by:
setWhen in class AbstractCaseExpression
Parameters:
when - a non-null List of at least one Expression
then - a non-null List of at least one Expression

isResolved

public boolean isResolved()
Description copied from interface: Expression
Return true if expression has been fully resolved. Typically the QueryResolver component will handle resolution of an expression.

Returns:
True if resolved
See Also:
Expression.isResolved()

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.

Parameters:
visitor - Visitor being used

clone

public java.lang.Object clone()
Description copied from interface: LanguageObject
Implement clone to make objects cloneable.

Specified by:
clone in interface LanguageObject
Specified by:
clone in class AbstractCaseExpression
Returns:
Deep clone of this object
See Also:
Object.clone()

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class AbstractCaseExpression


Copyright © 2011. All Rights Reserved.