isql.expression
Class CaseExpression

java.lang.Object
  extended by isql.expression.CaseExpression
All Implemented Interfaces:
ISimpleExpression, IExpression

public class CaseExpression
extends java.lang.Object
implements ISimpleExpression

calculates the result of a CASE-WHEN-THEN expression

Author:
SHZ Oct 1, 2007

Constructor Summary
CaseExpression(Column test, IExpression expElse, java.util.List<WhenThen> lstWhenThen)
           
 
Method Summary
 java.util.Set<ColumnKey> getInvolvedColumns()
          Returns the table columns named in the expression
 ITypedValue getResult()
          Calculates the result of the case expression.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CaseExpression

public CaseExpression(Column test,
                      IExpression expElse,
                      java.util.List<WhenThen> lstWhenThen)
               throws ISQLException,
                      ISQLException
Throws:
ISQLException
Method Detail

getResult

public ITypedValue getResult()
                      throws ISQLException
Calculates the result of the case expression. The idea is that each then-when gives value fore some of the array's rows. We maintain the array usedIndex to know which rows of the result array got values, when-then after when-then. The rows that did not get values are covered by the else clause

Specified by:
getResult in interface IExpression
Returns:
the result of the expression (can be an array or a constant)
Throws:
ISQLException
ISQLException

getInvolvedColumns

public java.util.Set<ColumnKey> getInvolvedColumns()
Description copied from interface: IExpression
Returns the table columns named in the expression

Specified by:
getInvolvedColumns in interface IExpression
Returns:
the identifiers of the columns

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object