com.ibm.websphere.query.base
Class Condition

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

public class Condition
extends PredicateBase
implements ICondition

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

This class contains left operand, operator, and right operands, to describe a typical condition in a query. For example, a simple condition "age > 30" will be decomposed as left operand = Attribute("age"), operator = Operator(">"), and right operand = Value("30")

See Also:
Serialized Form

Constructor Summary
Condition()
          Creates a new Condition instance, default constructor.
Condition(ILeftOperand newLeftOperand)
          Creates a new Condition instance with the given left operand object.
Condition(ILeftOperand newLeftOperand, IOperator newOperator)
          Creates a new Condition instance with the given left operand, and operator.
Condition(ILeftOperand newLeftOperand, IOperator newOperator, IRightOperand newRightOperand)
          Creates a new Condition instance with the given left operand, operator, and right operand.
Condition(ILeftOperand newLeftOperand, IOperator newOperator, IRightOperand[] newRightOperands)
          Creates a new Condition instance with the given left operand, operator, and an array of right operands.
 
Method Summary
 void addRightOperand(IRightOperand r)
          Adds a right operand to the right operand vector.
 java.lang.String buildString(ISelectQueryCallback builder)
          Builds a query string for the condition.
 void buildString(ISelectQueryCallback builder, java.lang.StringBuffer sb)
           
 boolean equals(java.lang.Object o)
          Tests for equality with the given object.
 ILeftOperand getLeftOperand()
          Returns the left operand.
 IOperator getOperator()
          Returns the operator.
 IRightOperand[] getRightOperands()
          Returns the right operands as an array.
 int hashCode()
          Computes a hash code for the condition.
 boolean operatorNameEquals(java.lang.String operatorNameString)
           
 void setLeftOperand(ILeftOperand newLeftOperand)
          Sets the left operand of the condition.
 void setOperator(IOperator newOperator)
          Sets the operator of the condition.
 void setRightOperand(IRightOperand r)
          Sets the right operand of the condition.
 void setRightOperands(IRightOperand[] newRightOperands)
          Sets the right operands of the condition.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Condition

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


Condition

public Condition(ILeftOperand newLeftOperand)
Creates a new Condition instance with the given left operand object.


Condition

public Condition(ILeftOperand newLeftOperand,
                 IOperator newOperator)
Creates a new Condition instance with the given left operand, and operator.


Condition

public Condition(ILeftOperand newLeftOperand,
                 IOperator newOperator,
                 IRightOperand[] newRightOperands)
Creates a new Condition instance with the given left operand, operator, and an array of right operands.


Condition

public Condition(ILeftOperand newLeftOperand,
                 IOperator newOperator,
                 IRightOperand newRightOperand)
Creates a new Condition instance with the given left operand, operator, and right operand.

Method Detail

addRightOperand

public void addRightOperand(IRightOperand r)
Adds a right operand to the right operand vector.


buildString

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

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

getLeftOperand

public ILeftOperand getLeftOperand()
Returns the left operand.

Specified by:
getLeftOperand in interface ICondition

getOperator

public IOperator getOperator()
Returns the operator.

Specified by:
getOperator in interface ICondition

getRightOperands

public IRightOperand[] getRightOperands()
Returns the right operands as an array.

Specified by:
getRightOperands in interface ICondition

hashCode

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

Overrides:
hashCode in class PredicateBase

setLeftOperand

public void setLeftOperand(ILeftOperand newLeftOperand)
Sets the left operand of the condition.


setOperator

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


setRightOperand

public void setRightOperand(IRightOperand r)
Sets the right operand of the condition.


setRightOperands

public void setRightOperands(IRightOperand[] newRightOperands)
Sets the right operands of the condition.


operatorNameEquals

public boolean operatorNameEquals(java.lang.String operatorNameString)