mirror of
https://github.com/st-tu-dresden-praktikum/swt23w23
synced 2024-07-04 19:19:39 +02:00
40 lines
784 B
Java
40 lines
784 B
Java
|
package catering.order;
|
||
|
|
||
|
import org.springframework.stereotype.Component;
|
||
|
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
|
||
|
|
||
|
@Component
|
||
|
public class CustomCart {
|
||
|
private CustomOrder.OrderType orderType;
|
||
|
private Map<String, Integer> products;
|
||
|
|
||
|
public CustomCart() {
|
||
|
this.orderType = CustomOrder.OrderType.SOMETHING_ELSE;
|
||
|
this.products = new HashMap<>();
|
||
|
}
|
||
|
|
||
|
public CustomOrder.OrderType getOrderType() {
|
||
|
return orderType;
|
||
|
}
|
||
|
|
||
|
public void setOrderType(CustomOrder.OrderType type) {
|
||
|
this.orderType = type;
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
public Map<String, Integer> getProucts() {
|
||
|
return products;
|
||
|
}
|
||
|
|
||
|
public void addProduct(String product, int number) {
|
||
|
products.put(product, number);
|
||
|
}
|
||
|
|
||
|
public boolean removeProduct(String product) {
|
||
|
return products.remove(product) != null;
|
||
|
}
|
||
|
}
|