com.ibm.websphere.query.base
Class Predicate

java.lang.Object
  extended by com.ibm.websphere.query.base.PredicateBase
      extended by com.ibm.websphere.query.base.Predicate
All Implemented Interfaces:
IPredicate, IRightOperand, IStringBuilder, java.io.Serializable

public class Predicate
extends PredicateBase
implements IPredicate

The Predicate class represents a predicate in the query framework. It is derived from PredicateBase.

This class contains an operator and predicate bases to describe a typical predicate in a query. The operator is usually either "AND" or "OR". For example, a predicate "(age > 30) AND (last name = Smith)" will be decomposed as operator = Operator("AND"), and predicate bases = Condition(Attribute("age"), Operator(">"), Value("30", Constants.DATATYPE_INTEGER)), Condition(Attribute("last name"), Operator("="), Value("Smith", Constants.DATATYPE_CHAR))

See Also:
Serialized Form

Constructor Summary
Predicate()
          Creates a new Predicate instance, default constructor.
Predicate(IOperator operator, java.util.List predicateBases)
          Creates a new Predicate instance with the given operator and list of predicate bases.
Predicate(IOperator operator, PredicateBase[] predicateBases)
          Creates a new Predicate instance with the given operator and array of predicate bases.
 
Method Summary
 void addPredicateBase(PredicateBase p)
          Adds a predicate base to the predicate base list.
 void addPredicateBases(java.util.List predicateBases)
          Adds an array of predicate bases to the predicate base list.
 java.lang.String buildString(ISelectQueryCallback builder)
          Builds a query string for the predicate.
 void buildString(ISelectQueryCallback builder, java.lang.StringBuffer sb)
           
 boolean equals(java.lang.Object o)
          Tests for equality with the given object.
 IOperator getOperator()
          Returns the operator.
 PredicateBase[] getPredicateBases()
          Returns the array of predicate bases.
 int hashCode()
          Computes a hash code for the predicate.
 void setOperator(IOperator newOperator)
          Sets the operator of the predicate.
 void setPredicateBases(java.util.List predicateBases)
          Sets the predicate bases of the predicate.
 void setPredicateBases(PredicateBase[] predicateBases)
          Sets the predicate bases of the predicate.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Predicate

public Predicate()
Creates a new Predicate instance, default constructor.


Predicate

public Predicate(IOperator operator,
                 PredicateBase[] predicateBases)
Creates a new Predicate instance with the given operator and array of predicate bases.


Predicate

public Predicate(IOperator operator,
                 java.util.List predicateBases)
Creates a new Predicate instance with the given operator and list of predicate bases.

Method Detail

addPredicateBase

public void addPredicateBase(PredicateBase p)
Adds a predicate base to the predicate base list.


addPredicateBases

public void addPredicateBases(java.util.List predicateBases)
Adds an array of predicate bases to the predicate base list.


buildString

public java.lang.String buildString(ISelectQueryCallback builder)
                             throws QueryException
Builds a query string for the predicate.

Specified by:
buildString in interface IStringBuilder
Throws:
QueryException

buildString

public void buildString(ISelectQueryCallback builder,
                        java.lang.StringBuffer sb)
                 throws QueryException
Specified by:
buildString in interface IStringBuilder
Throws:
QueryException

equals

public boolean equals(java.lang.Object o)
Tests for equality with the given object.

Overrides:
equals in class PredicateBase

getOperator

public IOperator getOperator()
Returns the operator.

Specified by:
getOperator in interface IPredicate

getPredicateBases

public PredicateBase[] getPredicateBases()
Returns the array of predicate bases.

Specified by:
getPredicateBases in interface IPredicate

hashCode

public int hashCode()
Computes a hash code for the predicate.

Overrides:
hashCode in class PredicateBase

setOperator

public void setOperator(IOperator newOperator)
Sets the operator of the predicate.


setPredicateBases

public void setPredicateBases(java.util.List predicateBases)
Sets the predicate bases of the predicate.


setPredicateBases

public void setPredicateBases(PredicateBase[] predicateBases)
Sets the predicate bases of the predicate.