com.ibm.commerce.condition
Class SimpleCondition

java.lang.Object
  |
  +--com.ibm.commerce.condition.Condition
        |
        +--com.ibm.commerce.condition.SimpleCondition
All Implemented Interfaces:
ConditionConstants

public final class SimpleCondition
extends Condition

This class describes a simple condition boolean expression. A simple condition consists of a variable, an operator, and a value with optional qualifiers.


Nested Class Summary
static class SimpleCondition.Qualifier
          This class describes a simple condition qualifier.
 
Field Summary
static java.lang.String COPYRIGHT
          Copyright.
 
Fields inherited from interface com.ibm.commerce.condition. ConditionConstants
AND_LIST_CONDITION, OPEN_CONDITION, OPERATOR_CONTAINS, OPERATOR_DOES_NOT_CONTAIN, OPERATOR_DOES_NOT_END_WITH, OPERATOR_DOES_NOT_START_WITH, OPERATOR_ENDS_WITH, OPERATOR_EQUAL_TO, OPERATOR_GREATER_THAN, OPERATOR_GREATER_THAN_OR_EQUAL_TO, OPERATOR_LESS_THAN, OPERATOR_LESS_THAN_OR_EQUAL_TO, OPERATOR_NOT_EQUAL_TO, OPERATOR_STARTS_WITH, OR_LIST_CONDITION, SIMPLE_CONDITION, TRUE_CONDITION, XML_DTD_FRAGMENT, XML_INDENT
 
Constructor Summary
SimpleCondition(java.lang.String variable, java.lang.String operator, java.lang.String value)
          This constructor takes the variable name, the operator and the value for the simple condition.
SimpleCondition(java.lang.String variable, java.lang.String operator, java.lang.String value, SimpleCondition.Qualifier qualifier)
          This constructor takes the variable name, the operator, the value and a single qualifier for the simple condition.
SimpleCondition(java.lang.String variable, java.lang.String operator, java.lang.String value, SimpleCondition.Qualifier[] qualifiers)
          This constructor takes the variable name, the operator, the value and an array of qualifiers for the simple condition.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this condition object.
 boolean evaluate( Evaluator evaluator)
          This method evaluates the simple condition.
 java.lang.String getOperator()
          Gets the operator name.
  SimpleCondition.Qualifier[] getQualifiers()
          Gets the array of qualifiers.
 java.lang.String getValue()
          Gets the value.
 java.lang.String getVariable()
          Gets the variable name.
 void setOperator(java.lang.String operator)
          Sets the operator name.
 void setQualifiers( SimpleCondition.Qualifier[] qualifiers)
          Sets the array of qualifiers.
 void setValue(java.lang.String value)
          Sets the value name.
 void setVariable(java.lang.String variable)
          Sets the variable name.
 
Methods inherited from class com.ibm.commerce.condition. Condition
getNot, getType, getXMLFragment, loadConditionFromXML, setNot, setType
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
public static final java.lang.String COPYRIGHT
Copyright.
See Also:
Constant Field Values
Constructor Detail

SimpleCondition

public SimpleCondition(java.lang.String variable,
                       java.lang.String operator,
                       java.lang.String value)
This constructor takes the variable name, the operator and the value for the simple condition.
Parameters:
variable - The variable name.
operator - The operator name.
value - The value.

SimpleCondition

public SimpleCondition(java.lang.String variable,
                       java.lang.String operator,
                       java.lang.String value,
SimpleCondition.Qualifier qualifier)
This constructor takes the variable name, the operator, the value and a single qualifier for the simple condition.
Parameters:
variable - The variable name.
operator - The operator name.
value - The value.
qualifier - A qualifier for this simple condition.

SimpleCondition

public SimpleCondition(java.lang.String variable,
                       java.lang.String operator,
                       java.lang.String value,
SimpleCondition.Qualifier[] qualifiers)
This constructor takes the variable name, the operator, the value and an array of qualifiers for the simple condition.
Parameters:
variable - The variable name.
operator - The operator name.
value - The value.
qualifiers - An array of Qualifier objects.
Method Detail

clone

public java.lang.Object clone()
Description copied from class: Condition
Returns a clone of this condition object.
Specified by:
clone in class Condition
Returns:
A clone of this condition object.

getVariable

public java.lang.String getVariable()
Gets the variable name.
Returns:
The variable name.

setVariable

public void setVariable(java.lang.String variable)
Sets the variable name.
Parameters:
variable - The variable name.

getOperator

public java.lang.String getOperator()
Gets the operator name.
Returns:
Return the operator name.

setOperator

public void setOperator(java.lang.String operator)
Sets the operator name.
Parameters:
operator - The operator name.

getValue

public java.lang.String getValue()
Gets the value.
Returns:
Return the value.

setValue

public void setValue(java.lang.String value)
Sets the value name.
Parameters:
value - The value.

getQualifiers

public SimpleCondition.Qualifier[] getQualifiers()
Gets the array of qualifiers.
Returns:
An array of qualifier objects.

setQualifiers

public void setQualifiers(SimpleCondition.Qualifier[] qualifiers)
Sets the array of qualifiers.
Parameters:
qualifiers - An array of qualifier objects.

evaluate

public boolean evaluate(Evaluator evaluator)
This method evaluates the simple condition. The Evaluator implementation is called to evaluate the simple condition. Note that the result will be negated if the not property is true.
Specified by:
evaluate in class Condition
Parameters:
evaluator - An implementation of the Evaluator interface that is used to evaluate the simple conditions.
Returns:
true if the condition is true.