java.lang.Object
stud.ntnu.idatt1005.pantrypal.models.Model
stud.ntnu.idatt1005.pantrypal.models.Recipe

public class Recipe extends Model
This is an entity class representing a recipe. It contains the name, groceries and steps of the recipe. Goal: act as a model for a recipe.
  • Field Details

    • description

      private final String description
      The recipe description of the recipe.
    • recipeGroceries

      private final GroceryRegister recipeGroceries
      The groceries needed for the recipe.
    • steps

      private final StepRegister steps
      The steps needed to make the recipe.
    • imagePath

      private final String imagePath
      The imagePath pointing to image location.
    • isFavorite

      private boolean isFavorite
      The boolean isFavorite, which is true if the recipe is a favorite, and false if it is not.
  • Constructor Details

    • Recipe

      public Recipe(String name, String description, GroceryRegister recipeGroceries, StepRegister steps, String imagePath, boolean isFavorite)
      Constructor for the Recipe class.
      Parameters:
      name - the name of the recipe.
      recipeGroceries - the groceries needed for the recipe.
      steps - the steps needed to make the recipe.
  • Method Details

    • validImagePath

      private static boolean validImagePath(String imagePath)
      Check if the image path is valid. By checking if the image path is a URL and then if the image path is correctly formatted. returns based on the result.
      Parameters:
      imagePath - the image path to check.
      Returns:
      true if the image path is valid, false if it is not.
    • getDescription

      public String getDescription()
      Get the description of the recipe.
      Returns:
      the description of the recipe.
    • getRecipeGroceries

      public GroceryRegister getRecipeGroceries()
      Get the groceries needed for the recipe.
      Returns:
      the groceries needed for the recipe.
    • getRecipeSteps

      public List<String> getRecipeSteps()
      Get the steps needed to make the recipe.
      Returns:
      the steps needed to make the recipe.
    • getImagePath

      public String getImagePath()
      Get the image path of the recipe.
      Returns:
      the image path of the recipe.
    • getIsFavorite

      public boolean getIsFavorite()
      Get the isFavorite boolean of the recipe.
      Returns:
      the isFavorite boolean of the recipe.
    • toggleIsFavorite

      public void toggleIsFavorite()
      Toggle the isFavorite boolean to the opposite. If isFavorite is true, it will be set to false, and if isFavorite is false, it will be set to true.