Package org.teiid.query.sql.lang
Class CompareCriteria
- java.lang.Object
-
- org.teiid.query.sql.lang.Criteria
-
- org.teiid.query.sql.lang.PredicateCriteria
-
- org.teiid.query.sql.lang.AbstractCompareCriteria
-
- org.teiid.query.sql.lang.CompareCriteria
-
- All Implemented Interfaces:
Cloneable
,BinaryComparison
,PredicateCriteria.Negatable
,LanguageObject
,Expression
- Direct Known Subclasses:
ImmutableCompareCriteria
public class CompareCriteria extends AbstractCompareCriteria implements BinaryComparison
A criteria which represents a simple operator relationship between two expressions. There are 6 operator types. Each side of the comparison may be an expression, which could be an element, a constant, or a function.
Some examples are:
- ticker = 'IBM'
- price >= 50
- revenue < 0
- 5 <= length(companyName)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.teiid.query.sql.lang.PredicateCriteria
PredicateCriteria.Negatable
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
-
Constructor Summary
Constructors Constructor Description CompareCriteria()
Constructs a default instance of this class.CompareCriteria(Expression leftExpression, int operator, Expression rightExpression)
Constructs an instance of this class for a specific "operand operator operand" clause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acceptVisitor(LanguageVisitor visitor)
Method for accepting a visitor.Object
clone()
Deep copy of objectboolean
equals(Object obj)
Override equals() method.Boolean
getIsOptional()
int
getReverseOperator()
Expression
getRightExpression()
Get right expression.int
hashCode()
Get hash code.boolean
isOptional()
Returns true if the compare criteria is used as join criteria, but not needed during processing.void
set(Expression leftExpression, int operator, Expression rightExpression)
Sets the operands and operator.void
setOptional(Boolean isOptional)
Set during planning to indicate that this criteria is no longer needed to correctly process a joinvoid
setRightExpression(Expression expression)
Set right expression.-
Methods inherited from class org.teiid.query.sql.lang.AbstractCompareCriteria
getInverseOperator, getLeftExpression, getOperator, getOperator, getOperatorAsString, negate, setLeftExpression, setOperator
-
Methods inherited from class org.teiid.query.sql.lang.Criteria
applyDemorgan, combineCriteria, combineCriteria, combineCriteria, getType, separateCriteriaByAnd, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.teiid.query.sql.lang.BinaryComparison
getLeftExpression, setLeftExpression
-
-
-
-
Constructor Detail
-
CompareCriteria
public CompareCriteria()
Constructs a default instance of this class.
-
CompareCriteria
public CompareCriteria(Expression leftExpression, int operator, Expression rightExpression)
Constructs an instance of this class for a specific "operand operator operand" clause.- Parameters:
leftExpression
- The variable being comparedrightExpression
- The value the variable is being compared to (literal or variable)operator
- The operator representing how the variable and value are to be compared
-
-
Method Detail
-
setRightExpression
public void setRightExpression(Expression expression)
Set right expression.- Specified by:
setRightExpression
in interfaceBinaryComparison
- Parameters:
expression
- Right expression
-
getRightExpression
public Expression getRightExpression()
Get right expression.- Specified by:
getRightExpression
in interfaceBinaryComparison
- Returns:
- right expression
-
set
public void set(Expression leftExpression, int operator, Expression rightExpression)
Sets the operands and operator. The clause is of the form: <variable> <operator> <value>.- Parameters:
leftExpression
- The left expressionoperator
- The operator representing how the expressions are comparedrightExpression
- The right expression
-
setOptional
public void setOptional(Boolean isOptional)
Set during planning to indicate that this criteria is no longer needed to correctly process a join- Parameters:
isOptional
-
-
isOptional
public boolean isOptional()
Returns true if the compare criteria is used as join criteria, but not needed during processing.- Returns:
-
getIsOptional
public Boolean getIsOptional()
-
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 interfaceLanguageObject
- Parameters:
visitor
- Visitor being used
-
hashCode
public int hashCode()
Get hash code. WARNING: The hash code is based on data in the criteria. If data values are changed, the hash code will change - don't hash this object and change values.
-
equals
public boolean equals(Object obj)
Override equals() method.
-
clone
public Object clone()
Deep copy of object- Specified by:
clone
in interfaceLanguageObject
- Specified by:
clone
in classPredicateCriteria
- Returns:
- Deep copy of object
-
getReverseOperator
public int getReverseOperator()
-
-