Class ShoppingListController

java.lang.Object
edu.ntnu.stud.idatt1005.team3.controller.ShoppingListController

public class ShoppingListController extends Object
A class that generates a shopping list and alters it.
  • Constructor Details

    • ShoppingListController

      public ShoppingListController(TheCookbookDB db)
  • Method Details

    • addRecipeIngredients

      public void addRecipeIngredients(TheCookbookDB db, int recipeId)
      Adds ingredients from a chosen recipe to the shopping list.
      Parameters:
      recipeId - the id of the recipe you want to use.
    • addIngredient

      public void addIngredient(String ingredientName, Double quantity, String unit)
      Adds an individual ingredient.
      Parameters:
      ingredientName - the ingredient you want to add.
    • generateShoppingList

      public List<FoodItem> generateShoppingList()
      Generates the final shopping list.
      Returns:
      Returns the shopping list.
    • clear

      public void clear()
    • checkInventory

      public List<FoodItem> checkInventory(TheCookbookDB db, List<FoodItem> shoppingList)
      Checks the shopping list against the inventory in the database. Updates the inventory by removing if we have it, or adding to a final list what we are missing.
      Parameters:
      db - the database.