com.metamatrix.query.sql.lang
Class SubqueryCompareCriteria

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.SubqueryCompareCriteria
All Implemented Interfaces:
SubqueryContainer, LanguageObject, ContextReference, java.io.Serializable, java.lang.Cloneable

public class SubqueryCompareCriteria
extends AbstractCompareCriteria
implements SubqueryContainer, ContextReference

This class implements a quantified comparison predicate. This is a criteria which represents a simple operator relationship between an expression and either a scalar subquery or a table subquery preceded by one of the possible quantifiers.

The quantifiers are:

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
static int ALL
          "All" predicate quantifier
static int ANY
          "Any" predicate quantifier (equivalent to "Some")
static int NO_QUANTIFIER
          "All" predicate quantifier
static int SOME
          "Some" predicate quantifier (equivalent to "Any")
 
Fields inherited from class com.metamatrix.query.sql.lang.AbstractCompareCriteria
EQ, GE, GT, LE, LT, NE
 
Constructor Summary
SubqueryCompareCriteria()
           
SubqueryCompareCriteria(Expression leftExpression, Command subCommand, int operator, int predicateQuantifier)
           
 
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.
 Command getCommand()
          Returns the subquery Command object
 java.lang.String getContextSymbol()
           
 int getPredicateQuantifier()
          Get the predicate quantifier - returns one of the following: NO_QUANTIFIER ANY SOME ALL
 java.lang.String getPredicateQuantifierAsString()
          Returns the predicate quantifier as a string.
 Expression getRightExpression()
           
 Expression getValueExpression()
           
 int hashCode()
          Get hash code.
 void setCommand(Command command)
          Set the subquery command (either a SELECT or a procedure execution).
 void setPredicateQuantifier(int predicateQuantifier)
          Set the predicate quantifier - use one of the following: NO_QUANTIFIER ANY SOME ALL
 
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
 

Field Detail

NO_QUANTIFIER

public static final int NO_QUANTIFIER
"All" predicate quantifier

See Also:
Constant Field Values

SOME

public static final int SOME
"Some" predicate quantifier (equivalent to "Any")

See Also:
Constant Field Values

ANY

public static final int ANY
"Any" predicate quantifier (equivalent to "Some")

See Also:
Constant Field Values

ALL

public static final int ALL
"All" predicate quantifier

See Also:
Constant Field Values
Constructor Detail

SubqueryCompareCriteria

public SubqueryCompareCriteria()

SubqueryCompareCriteria

public SubqueryCompareCriteria(Expression leftExpression,
                               Command subCommand,
                               int operator,
                               int predicateQuantifier)
Method Detail

getContextSymbol

public java.lang.String getContextSymbol()
Specified by:
getContextSymbol in interface ContextReference

getValueExpression

public Expression getValueExpression()
Specified by:
getValueExpression in interface ContextReference

getPredicateQuantifier

public int getPredicateQuantifier()
Get the predicate quantifier - returns one of the following:

Returns:
the predicate quantifier

setPredicateQuantifier

public void setPredicateQuantifier(int predicateQuantifier)
Set the predicate quantifier - use one of the following:

Parameters:
predicateQuantifier - the predicate quantifier

getCommand

public Command getCommand()
Description copied from interface: SubqueryContainer
Returns the subquery Command object

Specified by:
getCommand in interface SubqueryContainer
Returns:
the subquery Command object
See Also:
com.metamatrix.query.sql.lang.SubqueryCriteria#getCommand()

setCommand

public void setCommand(Command command)
Set the subquery command (either a SELECT or a procedure execution).

Specified by:
setCommand in interface SubqueryContainer
Parameters:
command - Command to execute to get the values for the criteria

getPredicateQuantifierAsString

public java.lang.String getPredicateQuantifierAsString()
Returns the predicate quantifier as a string.

Returns:
String version of predicate quantifier

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. The values Iterator of this object will not be cloned - it will be null in the new object (see #setValueIterator setValueIterator}).

Specified by:
clone in interface LanguageObject
Specified by:
clone in class PredicateCriteria
Returns:
Deep copy of object
See Also:
Object.clone()

getRightExpression

public Expression getRightExpression()
Specified by:
getRightExpression in class AbstractCompareCriteria
See Also:
AbstractCompareCriteria.getRightExpression()


Copyright © 2009. All Rights Reserved.