Class RecipeRegister

java.lang.Object
edu.ntnu.stud.idatt1005.team3.model.RecipeRegister

public class RecipeRegister extends Object
This class represents a register of recipes. It can store, remove and find recipes from the register.
Since:
0.1
Version:
0.2
Author:
augustrb
  • Constructor Details

    • RecipeRegister

      public RecipeRegister()
      Constructor for the RecipeRegister class. Initializes the recipes ArrayList.
  • Method Details

    • addRecipe

      public void addRecipe(Recipe recipe)
      Adds a recipe to the register.
      Parameters:
      recipe - The recipe to be added to the register.
    • getRecipes

      public ArrayList<Recipe> getRecipes()
      A method to get the recipes in the register.
      Returns:
      The recipes in the register.
    • removeRecipe

      public void removeRecipe(Recipe recipe)
      A method to remove a recipe from the register.
      Parameters:
      recipe - The recipe to be removed from the register.
    • removeRecipeByName

      public void removeRecipeByName(String recipeName)
      A method to remove a recipe from the register by name.
      Parameters:
      recipeName - The name of the recipe to be removed from the register.
    • findRecipeByName

      public Recipe findRecipeByName(String recipeName)
      A method to find a recipe by name.
      Parameters:
      recipeName - The name of the recipe to be found.
      Returns:
      The recipe with the given name, or null if no recipe with that name is found.
    • findRecipesByIngredient

      public ArrayList<Recipe> findRecipesByIngredient(String ingredient)
      A method to find recipes by ingredient.
      Parameters:
      ingredient - The ingredient to be found in the recipes.
      Returns:
      An ArrayList of recipes containing the given ingredient.
    • findRecipesByMaxCookTime

      public ArrayList<Recipe> findRecipesByMaxCookTime(int maxCookTime)
      A method to find recipes by maximum cook time.
      Parameters:
      maxCookTime - The maximum cook time for the recipes.
      Returns:
      An ArrayList of recipes with a cook time less than or equal to the given maximum cook time.