org.d2rq.db.expr
Class BinaryOperator

java.lang.Object
  extended by org.d2rq.db.expr.Expression
      extended by org.d2rq.db.expr.BinaryOperator
Direct Known Subclasses:
Add, Divide, Equality, GreaterThan, GreaterThanOrEqual, LessThan, LessThanOrEqual, Multiply, Subtract

public abstract class BinaryOperator
extends Expression


Field Summary
protected  Expression expr1
           
protected  Expression expr2
           
protected  String operator
           
 
Fields inherited from class org.d2rq.db.expr.Expression
FALSE, TRUE
 
Constructor Summary
protected BinaryOperator(Expression expr1, Expression expr2, String operator, boolean isCommutative, DataType.GenericType dataType)
           
 
Method Summary
 boolean equals(Object o)
           
 Set<ColumnName> getColumns()
           
 DataType getDataType(DatabaseOp table, Vendor vendor)
           
 int hashCode()
           
 boolean isConstant()
           
 boolean isConstantColumn(ColumnName column, boolean constIfTrue, boolean constIfFalse, boolean constIfConstantValue)
          Checks whether this expression forces a given column to be a constant, that is, have the same value everywhere.
 boolean isFalse()
           
 boolean isTrue()
           
 String toSQL(DatabaseOp table, Vendor vendor)
           
 String toString()
           
 
Methods inherited from class org.d2rq.db.expr.Expression
and, or, rename
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

expr1

protected final Expression expr1

expr2

protected final Expression expr2

operator

protected final String operator
Constructor Detail

BinaryOperator

protected BinaryOperator(Expression expr1,
                         Expression expr2,
                         String operator,
                         boolean isCommutative,
                         DataType.GenericType dataType)
Method Detail

getColumns

public Set<ColumnName> getColumns()
Specified by:
getColumns in class Expression

isFalse

public boolean isFalse()
Specified by:
isFalse in class Expression

isTrue

public boolean isTrue()
Specified by:
isTrue in class Expression

isConstant

public boolean isConstant()
Specified by:
isConstant in class Expression

isConstantColumn

public boolean isConstantColumn(ColumnName column,
                                boolean constIfTrue,
                                boolean constIfFalse,
                                boolean constIfConstantValue)
Description copied from class: Expression
Checks whether this expression forces a given column to be a constant, that is, have the same value everywhere. For example, T.COL1=5 forces T.COL1 to be constant if the expression is assumed to be true; T.COL1+1 forces it to be constant if the expression is assumed to evaluate to a constant value. Exactly one of the three constXXX arguments must be true, the other two must be false.

Specified by:
isConstantColumn in class Expression
Parameters:
column - The column to be checked
constIfTrue - Is the column constant assuming the expression evaluates to true?
constIfFalse - Is the column constant assuming the expression evaluates to false?
constIfConstantValue - Is column constant assuming the expression evaluates to a value equal to some constant?

getDataType

public DataType getDataType(DatabaseOp table,
                            Vendor vendor)
Specified by:
getDataType in class Expression

toSQL

public String toSQL(DatabaseOp table,
                    Vendor vendor)
Specified by:
toSQL in class Expression

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object