Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5437 mandeep.dh 1
/**
2
 * 
3
 */
4
package in.shop2020.inventory.service;
5
 
6
/**
7
 * @author mandeep
8
 *
9
 */
10
public class SubtractStrategy implements Strategy {
11
    long subtractionFactor;
12
    public SubtractStrategy(long factor) {
13
        subtractionFactor = factor;
14
    }
15
    /* (non-Javadoc)
16
     * @see in.shop2020.inventory.service.Strategy#compute(long, long, long)
17
     */
18
    public long compute(long itemId, long warehouseId, long quantity) {
19
        return Math.max(0, quantity - subtractionFactor);
20
    }
21
}