Implement developer classes and criteria for product filtering
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
package net.itsthesky.projetbut2.ocp;
|
||||
|
||||
import net.itsthesky.projetbut2.ocp.base.Product;
|
||||
|
||||
public class PriceRangeCriteria implements Criteria<Product> {
|
||||
|
||||
private final double minPrice;
|
||||
private final double maxPrice;
|
||||
public PriceRangeCriteria(double minPrice, double maxPrice) {
|
||||
this.minPrice = minPrice;
|
||||
this.maxPrice = maxPrice;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSatisfied(Product product) {
|
||||
return product.price >= minPrice && product.price <= maxPrice;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user