Package org.teiid.query.sql.symbol
Class CaseExpression
- java.lang.Object
-
- org.teiid.query.sql.symbol.AbstractCaseExpression
-
- org.teiid.query.sql.symbol.CaseExpression
-
- All Implemented Interfaces:
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
Constructors Constructor Description CaseExpression(Expression expression, List when, List then)
Constructor for CaseExpression objects
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.Object
clone()
Implement clone to make objects cloneable.boolean
equals(Object obj)
Expression
getExpression()
Gets the expression whose evaluation is being tested in this case expression.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.void
setExpression(Expression expr)
Sets the expression for this case expressionvoid
setWhen(List when, 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
-
-
-
-
Constructor Detail
-
CaseExpression
public CaseExpression(Expression expression, List when, List then)
Constructor for CaseExpression objects- Parameters:
expression
- a non-null expressionwhen
- a non-null List containing at least one Expressionthen
- 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 classAbstractCaseExpression
- Returns:
- See Also:
AbstractCaseExpression.getWhenCount()
-
getWhen
public 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(List when, 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 classAbstractCaseExpression
- Parameters:
when
- a non-null List of at least one Expressionthen
- a non-null List of at least one Expression
-
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 Object clone()
Description copied from interface:LanguageObject
Implement clone to make objects cloneable.- Specified by:
clone
in interfaceLanguageObject
- Specified by:
clone
in classAbstractCaseExpression
- Returns:
- Deep clone of this object
- See Also:
Object.clone()
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractCaseExpression
-
-