Package edu.ntnu.stud.model
Class Inventory
java.lang.Object
edu.ntnu.stud.model.Inventory
The Inventory class is responsible for managing the inventory of ingredients.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Clear the inventory by removing all ingredients from inventory.json.static List
<Ingredient> Get the inventory list from inventory.json.static void
reduceInventoryByRecipe
(String recipeName) Adds a recipe to the inventory by reading the recipe from cookbook.json and adding it to inventory.json.static Collection
<javafx.util.Pair<String, String>> showInventoryWithoutZero
(List<Ingredient> inventory) Get the inventory list from inventory.json without ingredients with quantity 0.
-
Constructor Details
-
Inventory
public Inventory()
-
-
Method Details
-
reduceInventoryByRecipe
Adds a recipe to the inventory by reading the recipe from cookbook.json and adding it to inventory.json.- Parameters:
recipeName
- The name of the recipe to add to the inventory
-
getInventory
Get the inventory list from inventory.json.- Returns:
- The inventory list
-
showInventoryWithoutZero
public static Collection<javafx.util.Pair<String,String>> showInventoryWithoutZero(List<Ingredient> inventory) Get the inventory list from inventory.json without ingredients with quantity 0.- Returns:
- The inventory list without ingredients with quantity 0
-
clearInventory
public static void clearInventory()Clear the inventory by removing all ingredients from inventory.json.
-