psoft.hsphere.promotion.calc
Class PercentDiscountCalc

java.lang.Object
  |
  +--psoft.hsphere.promotion.AbstractPromoDataStorage
        |
        +--psoft.hsphere.promotion.calc.PercentDiscountCalc
All Implemented Interfaces:
PromoCalculator

public class PercentDiscountCalc
extends AbstractPromoDataStorage
implements PromoCalculator


Field Summary
 
Fields inherited from class psoft.hsphere.promotion.AbstractPromoDataStorage
data, promoId
 
Constructor Summary
PercentDiscountCalc(long promoId)
           
PercentDiscountCalc(long promoId, java.util.Hashtable data)
           
 
Method Summary
 int getDataType()
           
 double getPromoDiscount(psoft.hsphere.Account a, double sum)
          Calculates discount for passed sum
 void updateData(long promoId, java.util.Hashtable data)
          Updates calculator object and saves the data needed by the calculator to the H-SPhere database
 
Methods inherited from class psoft.hsphere.promotion.AbstractPromoDataStorage
delete, getData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface psoft.hsphere.promotion.calc.PromoCalculator
delete
 

Constructor Detail

PercentDiscountCalc

public PercentDiscountCalc(long promoId)
                    throws java.lang.Exception

PercentDiscountCalc

public PercentDiscountCalc(long promoId,
                           java.util.Hashtable data)
                    throws java.lang.Exception
Method Detail

getDataType

public int getDataType()
Specified by:
getDataType in class AbstractPromoDataStorage

getPromoDiscount

public double getPromoDiscount(psoft.hsphere.Account a,
                               double sum)
Description copied from interface: PromoCalculator
Calculates discount for passed sum

Specified by:
getPromoDiscount in interface PromoCalculator
Parameters:
a - Account for which discount is being calculated
sum - Full amount of charge
Returns:
double

updateData

public void updateData(long promoId,
                       java.util.Hashtable data)
                throws java.lang.Exception
Description copied from interface: PromoCalculator
Updates calculator object and saves the data needed by the calculator to the H-SPhere database

Specified by:
updateData in interface PromoCalculator
Overrides:
updateData in class AbstractPromoDataStorage
Parameters:
promoId - id of the Promo object
data - name/value pairs of data
Throws:
java.lang.Exception