feat: add online editor, work in progress

This commit is contained in:
2026-01-30 19:48:30 +01:00
parent e274352f98
commit ebb10ed61b
9 changed files with 621 additions and 44 deletions

View File

@@ -8,10 +8,14 @@ public class CartManager {
// Unified and global list for whole application
private static final List<CartItem> items = new ArrayList<>();
// Private constructor: utility class, it should not be instantiated
/**
* Private constructor: utility class, it should not be instantiated
*/
private CartManager() {}
// Returns the direct reference to the list to save memory on older devices
/**
* Returns the direct reference to the list to save memory on older devices
*/
public static List<CartItem> getItems() {
return items;
}
@@ -25,7 +29,9 @@ public class CartManager {
return null;
}
// Logic for adding, updating or removing items based on quantity, prevents duplicate entries
/**
* Logic for adding, updating or removing items based on quantity, prevents duplicate entries
*/
public static void addOrUpdateItem(String name, int minPrice, int maxPrice, int quantity, String imageFile) {
CartItem current = getItemByName(name);
@@ -40,20 +46,27 @@ public class CartManager {
}
}
// Range-based pricing
/**
* Range-based pricing
*/
public static int getGlobalTotalMin() {
int total = 0;
for (CartItem item : items) total += item.getTotalMin();
return total;
}
/**
* Range-based pricing
*/
public static int getGlobalTotalMax() {
int total = 0;
for (CartItem item : items) total += item.getTotalMax();
return total;
}
/**
* Remove item from cart
*/
public static void clear() {
items.clear();
}