com.ibm.commerce.marketing.promotion.condition

Class WeightedRange

  • java.lang.Object
    • com.ibm.commerce.marketing.promotion.condition.WeightedRange
  • All Implemented Interfaces:
    XMLizable, java.io.Serializable


    public class WeightedRange
    extends java.lang.Object
    implements XMLizable
    A WeightedRange is used to define the quantity requirement of a pattern definition. It is used to express quantity related conditions like: exactly 5, or at least 5. A Weighted Range has a lower bound and an upper bound, and a weight.

    When the weight is set to 1, and the lower bound is the same as the upper bound, then this weighted range defines a concept of exactly X where X is the value of the lower bound and the upper bound. If the lower bound is not the same as the upper bound, it defines a quantity requirement of “at least M, but no more than N”, where M is the value of the lower bound and N is the value of the upper bound. If N is set to unlimited, then the concept is simplified to “at least M, but as many as possible”.

    XML Snippet of WeightedRange:

       <WeightedRange impl= "com.ibm.commerce.marketing.promotion.condition.WeightedRange">
            <!-- Minimum number of items is 1 --> 
            <LowerBound>1</LowerBound>
       
            <!-- Maximum number of item is unlimited -->
            <UpperBound>-1</UpperBound>
       
             <!-- Usually possible values are: 0 and 1. 0: indicates lower boundary is used
                 to match patterns, 1 indicates the upper boundary is used to match patterns --> 
            <Weight>0</Weight>
       </WeightedRange>
      
       
     
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM copyright notice field.
    • Constructor Summary

      Constructors 
      Constructor and Description
      WeightedRange() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void fromXML(org.w3c.dom.Node anXMLNode)
      Transforms the XML node into its corresponding real Object.
      java.math.BigDecimal getLowerBound()
      Get lower bound of the weighted range.
      java.math.BigDecimal getSize(java.math.BigDecimal qty)
      This method takes the total quantity of one line item in this order as the parameter and returns the quantity required for each line item in current pattern.
      java.math.BigDecimal getUpperBound()
      Get upper bound of the weighted range.
      java.math.BigDecimal getWeight()
      Returns the weight of the weighted range.
      void setLowerBound(java.math.BigDecimal lBound)
      Set lower bound of the weighted range.
      void setUpperBound(java.math.BigDecimal uBound)
      Set upper bound of the weighted range.
      void setWeight(java.math.BigDecimal aWeight)
      Sets the weight of the weighted range.
      java.lang.String toXML()
      Converts the object into its corresponding XML format representation.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM copyright notice field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • WeightedRange

        public WeightedRange()
    • Method Detail

      • getLowerBound

        public java.math.BigDecimal getLowerBound()
        Get lower bound of the weighted range.
        Returns:
        the lower bound
      • setLowerBound

        public void setLowerBound(java.math.BigDecimal lBound)
        Set lower bound of the weighted range.
        Parameters:
        lBound - lower bound for this weighted range
      • getUpperBound

        public java.math.BigDecimal getUpperBound()
        Get upper bound of the weighted range. This upper bound is an option when exactQuantityRequired is false, but when exactQuantityRequired is true, this upper bound is useless.
        Returns:
        the upper bound
      • setUpperBound

        public void setUpperBound(java.math.BigDecimal uBound)
        Set upper bound of the weighted range.
        Parameters:
        uBound - upper bound of this weighted range
      • getSize

        public java.math.BigDecimal getSize(java.math.BigDecimal qty)
        This method takes the total quantity of one line item in this order as the parameter and returns the quantity required for each line item in current pattern. The size is used to calculate how many times this pattern occurs in the order, in order to give the corresponding reward.
        Parameters:
        qty - of the line item set to for which the size parameter is calculated
        Returns:
        The size for this line item set as measured by the current pattern
      • getWeight

        public java.math.BigDecimal getWeight()
        Returns the weight of the weighted range.
        Returns:
        BigDecimal weight
      • setWeight

        public void setWeight(java.math.BigDecimal aWeight)
        Sets the weight of the weighted range.
        Parameters:
        aWeight - The weight to set