com.metamatrix.query.sql.lang
Class CompareCriteria

java.lang.Object
  extended by com.metamatrix.query.sql.lang.Criteria
      extended by com.metamatrix.query.sql.lang.PredicateCriteria
          extended by com.metamatrix.query.sql.lang.AbstractCompareCriteria
              extended by com.metamatrix.query.sql.lang.CompareCriteria
All Implemented Interfaces:
PredicateCriteria.Negatable, LanguageObject, java.io.Serializable, java.lang.Cloneable

public class CompareCriteria
extends AbstractCompareCriteria
implements PredicateCriteria.Negatable

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:

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.metamatrix.query.sql.lang.PredicateCriteria
PredicateCriteria.Negatable
 
Field Summary
 
Fields inherited from class com.metamatrix.query.sql.lang.AbstractCompareCriteria
EQ, GE, GT, LE, LT, NE
 
Constructor Summary
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
 void acceptVisitor(LanguageVisitor visitor)
          Method for accepting a visitor.
 java.lang.Object clone()
          Deep copy of object
 boolean equals(java.lang.Object obj)
          Override equals() method.
static int getInverseOperator(int op)
           
 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 negate()
           
 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 join
 void setRightExpression(Expression expression)
          Set right expression.
 
Methods inherited from class com.metamatrix.query.sql.lang.AbstractCompareCriteria
getLeftExpression, getOperator, getOperator, getOperatorAsString, setLeftExpression, setOperator
 
Methods inherited from class com.metamatrix.query.sql.lang.Criteria
combineCriteria, combineCriteria, combineCriteria, separateCriteriaByAnd, toConjunctiveNormalForm, toDisjunctiveNormalForm, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

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:
identifier - The variable being compared
value - 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.

Parameters:
expression - Right expression

getRightExpression

public Expression getRightExpression()
Get right expression.

Specified by:
getRightExpression in class AbstractCompareCriteria
Returns:
right expression

set

public void set(Expression leftExpression,
                int operator,
                Expression rightExpression)
Sets the operands and operator. The clause is of the form: .

Parameters:
leftExpression - The left expression
operator - The operator representing how the expressions are compared
rightExpression - 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:

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 interface LanguageObject
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.

Overrides:
hashCode in class java.lang.Object
Returns:
Hash code

equals

public boolean equals(java.lang.Object obj)
Override equals() method.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Other object
Returns:
true if objects are equivalent

clone

public java.lang.Object clone()
Deep copy of object

Specified by:
clone in interface LanguageObject
Specified by:
clone in class PredicateCriteria
Returns:
Deep copy of object

negate

public void negate()
Specified by:
negate in interface PredicateCriteria.Negatable

getInverseOperator

public static int getInverseOperator(int op)


Copyright © 2009. All Rights Reserved.