19 lines
508 B
Java
19 lines
508 B
Java
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;
|
|
}
|
|
}
|