Implement developer classes and criteria for product filtering

This commit is contained in:
ItsTheSky
2025-12-01 09:39:29 +01:00
parent e580d6995d
commit 17d960fd3b
27 changed files with 219 additions and 383 deletions

View File

@ -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;
}
}