com.ibm.commerce.condition

Class SimpleCondition

  • All Implemented Interfaces:
    com.ibm.commerce.base.helpers.Uniquifiable, ConditionConstants, com.ibm.commerce.datatype.Hashable, com.ibm.websphere.cache.Sizeable, java.io.Serializable


    public final class SimpleCondition
    extends Condition
    implements com.ibm.commerce.base.helpers.Uniquifiable, java.io.Serializable, com.ibm.websphere.cache.Sizeable
    This class describes a simple condition boolean expression. A simple condition consists of a variable, an operator, and a value with optional qualifiers.
    See Also:
    Serialized Form
    • Field Detail

    • 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

      • getObjectSize

        public long getObjectSize()
        Returns the estimated footprint size in bytes of this object and the objects it contains.
        Specified by:
        getObjectSize in interface com.ibm.websphere.cache.Sizeable
        Overrides:
        getObjectSize in class Condition
        Returns:
        the estimated footprint size in bytes or -1 if a size cannot be determined.
      • 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.
      • equals

        public boolean equals(java.lang.Object aObject)
        Returns true if the specified object is equivalent to this object.
        Overrides:
        equals in class Condition
        Parameters:
        aObject - the specified object.
        Returns:
        true if the specified object is equivalent to this object.
      • hashCode

        public int hashCode()
        Returns a hash code for this object. Equal objects must return the same hash code.
        Overrides:
        hashCode in class Condition
        Returns:
        the hash code.
      • uniquify

        public void uniquify()

        Reduces memory footprint of this object.

        It is expected that the implementation of this method will use the Uniquee class to replace some or all of its properties with equivalent values from the Uniquee cache, or, if equivalent values are not found, place this object's properties in the Uniquee cache.

        The caller must be able to promise that this object and its properties, recursively, will never be modified again, so that it and its properties can be shared by other objects.

        This method is intended to be called by the Uniquee class.

        Specified by:
        uniquify in interface com.ibm.commerce.base.helpers.Uniquifiable