org.teiid.query.sql.lang
Class Criteria

java.lang.Object
  extended by org.teiid.query.sql.lang.Criteria
All Implemented Interfaces:
java.lang.Cloneable, LanguageObject, Expression
Direct Known Subclasses:
ExpressionCriteria, LogicalCriteria, PredicateCriteria

public abstract class Criteria
extends java.lang.Object
implements Expression

This class represents the criteria clause for a query, which defines constraints on the data values to be retrieved for each parameter in the select clause.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
 
Constructor Summary
Criteria()
          Constructs a default instance of this class.
 
Method Summary
abstract  java.lang.Object clone()
          Abstract clone method
static Criteria combineCriteria(Criteria primaryCrit, Criteria additionalCrit)
          This utility method can be used to combine two criteria using an AND.
static Criteria combineCriteria(Criteria primaryCrit, Criteria additionalCrit, boolean disjunctively)
           
static Criteria combineCriteria(java.util.List parts)
           
 java.lang.Class getType()
          Get the return type of this expression.
 boolean isResolved()
          Return true if expression has been fully resolved.
static java.util.List<Criteria> separateCriteriaByAnd(Criteria crit)
          This utility method will pull apart a tree of criteria by breaking all compound AND criteria apart.
static Criteria toConjunctiveNormalForm(Criteria input)
           
static Criteria toDisjunctiveNormalForm(Criteria input)
           
 java.lang.String toString()
          Return the parser string.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.teiid.query.sql.LanguageObject
acceptVisitor
 

Constructor Detail

Criteria

public Criteria()
Constructs a default instance of this class.

Method Detail

clone

public abstract java.lang.Object clone()
Abstract clone method

Specified by:
clone in interface LanguageObject
Overrides:
clone in class java.lang.Object
Returns:
Deep clone of this criteria

toString

public java.lang.String toString()
Return the parser string.

Overrides:
toString in class java.lang.Object

separateCriteriaByAnd

public static java.util.List<Criteria> separateCriteriaByAnd(Criteria crit)
This utility method will pull apart a tree of criteria by breaking all compound AND criteria apart. For instance, ((A=1 AND B=2) AND C=3) will be broken into A=1, B=2, C=3.

Parameters:
crit - Criteria to break apart
Returns:
List of Criteria, empty list if crit is null

combineCriteria

public static Criteria combineCriteria(java.util.List parts)

combineCriteria

public static Criteria combineCriteria(Criteria primaryCrit,
                                       Criteria additionalCrit)
This utility method can be used to combine two criteria using an AND. If both criteria are null, then null will be returned. If either is null, then the other will be returned. If neither is null and the primaryCrit is a CompoundCriteria, then the additionalCrit will be added to the primaryCrit and the primaryCrit will be returned. If the primaryCrit is not compound, a new CompoundCriteria will be created and both criteria will be added to it.

Parameters:
primaryCrit - Primary criteria - may be modified
additionalCrit - Won't be modified, but will likely be attached to the returned crit
Returns:
Combined criteria

combineCriteria

public static Criteria combineCriteria(Criteria primaryCrit,
                                       Criteria additionalCrit,
                                       boolean disjunctively)

toDisjunctiveNormalForm

public static Criteria toDisjunctiveNormalForm(Criteria input)

toConjunctiveNormalForm

public static Criteria toConjunctiveNormalForm(Criteria input)

getType

public java.lang.Class getType()
Description copied from interface: Expression
Get the return type of this expression. This method will not necessarily work right before resolution (Expression.isResolved() returns true).

Specified by:
getType in interface Expression
Returns:
Java class name

isResolved

public boolean isResolved()
Description copied from interface: Expression
Return true if expression has been fully resolved. Typically the QueryResolver component will handle resolution of an expression.

Specified by:
isResolved in interface Expression
Returns:
True if resolved


Copyright © 2011. All Rights Reserved.