Class RecipeRegister
java.lang.Object
edu.ntnu.stud.idatt1005.team3.model.RecipeRegister
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a recipe to the register.findRecipeByName
(String recipeName) A method to find a recipe by name.findRecipesByIngredient
(String ingredient) A method to find recipes by ingredient.findRecipesByMaxCookTime
(int maxCookTime) A method to find recipes by maximum cook time.A method to get the recipes in the register.void
removeRecipe
(Recipe recipe) A method to remove a recipe from the register.void
removeRecipeByName
(String recipeName) A method to remove a recipe from the register by name.
-
Constructor Details
-
RecipeRegister
public RecipeRegister()Constructor for the RecipeRegister class. Initializes the recipes ArrayList.
-
-
Method Details
-
addRecipe
Adds a recipe to the register.- Parameters:
recipe
- The recipe to be added to the register.
-
getRecipes
A method to get the recipes in the register.- Returns:
- The recipes in the register.
-
removeRecipe
A method to remove a recipe from the register.- Parameters:
recipe
- The recipe to be removed from the register.
-
removeRecipeByName
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
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
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
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.
-