com.metamatrix.query.sql.lang
Class Criteria

java.lang.Object
  extended by com.metamatrix.query.sql.lang.Criteria
All Implemented Interfaces:
LanguageObject, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
LogicalCriteria, PredicateCriteria

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

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.

See Also:
Serialized Form

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)
           
static java.util.List 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 com.metamatrix.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 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)


Copyright © 2009. All Rights Reserved.