Class Recipe

  • All Implemented Interfaces:
    java.io.Serializable

    public class Recipe
    extends java.lang.Object
    implements java.io.Serializable
    Represents a Recipe, which contains ingredients and instructions on how to prepare a recipe.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Recipe​(Recipe recipe)
      Copy constructor for Recipe
      Recipe​(java.lang.String title)
      Creates a Recipe object representing a recipe to be made.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addIngredient​(Ingredient ingredient)
      Adds an Ingredient as part of a Recipe
      void addIngredients​(java.util.List<Ingredient> ingredients)  
      java.lang.String getCategory()
      Gets the category (aka tag) of the Recipe
      java.lang.String getComments()
      Gets the comments associated with a Recipe
      java.lang.String getId()
      Gets the id of a Recipe, the id of the document in the db the Recipe is based off of
      Ingredient getIngredient​(int index)
      Gets the Ingredient object at the specified index in a Recipe
      java.util.List<Ingredient> getIngredients()
      Gets the entire ArrayList of Ingredients that make up a Recipe
      java.lang.String getPhotograph()
      Gets the photograph associated with a Recipe.
      java.lang.Long getPrepTimeMinutes()
      Gets the time in minutes that it takes a Recipe to be prepared
      java.lang.Long getServings()
      Gets the number of servings that a Recipe makes
      java.lang.String getTitle()
      Gets the title of a Recipe
      boolean isEqual​(java.lang.Object o)
      Checks whether the recipe is equal to another recipe.
      void removeIngredient​(Ingredient ingredient)
      Removes an Ingredient from being part of a Recipe
      void setCategory​(java.lang.String category)
      Adds a category (aka tag) to a Recipe
      void setComments​(java.lang.String comments)
      Sets the comments associated with a Recipe
      void setId​(java.lang.String id)
      Sets the id of a Recipe
      void setPhotograph​(java.lang.String photograph)
      Sets the photograph associated with a Recipe.
      void setPrepTimeMinutes​(java.lang.Long prepTimeMinutes)
      Sets the prep time in minutes that it takes a Recipe to be prepared
      void setServings​(java.lang.Long servings)
      Sets the number of servings that a Recipe makes
      void setTitle​(java.lang.String title)
      Sets the title of a Recipe
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Recipe

        public Recipe​(java.lang.String title)
        Creates a Recipe object representing a recipe to be made.
        Parameters:
        title - A String representing the title of a recipe
      • Recipe

        public Recipe​(Recipe recipe)
        Copy constructor for Recipe
        Parameters:
        recipe - Recipe to copy
    • Method Detail

      • addIngredient

        public void addIngredient​(Ingredient ingredient)
        Adds an Ingredient as part of a Recipe
        Parameters:
        ingredient - An Ingredient object to be added to the Recipe
      • addIngredients

        public void addIngredients​(java.util.List<Ingredient> ingredients)
      • removeIngredient

        public void removeIngredient​(Ingredient ingredient)
        Removes an Ingredient from being part of a Recipe
        Parameters:
        ingredient - An Ingredient object to be removed from the Recipe
      • getIngredient

        public Ingredient getIngredient​(int index)
        Gets the Ingredient object at the specified index in a Recipe
        Parameters:
        index - The index of the desired Ingredient object
        Returns:
        The Ingredient object that was at the index
      • getIngredients

        public java.util.List<Ingredient> getIngredients()
        Gets the entire ArrayList of Ingredients that make up a Recipe
        Returns:
        The ArrayList of all Ingredients
      • getCategory

        @Nullable
        public java.lang.String getCategory()
        Gets the category (aka tag) of the Recipe
        Returns:
        A String representing the category indexed
      • setCategory

        public void setCategory​(java.lang.String category)
        Adds a category (aka tag) to a Recipe
        Parameters:
        category - The String representing category to add to the Recipe
      • getTitle

        @Nullable
        public java.lang.String getTitle()
        Gets the title of a Recipe
        Returns:
        A String representing the title of a Recipe
      • setTitle

        public void setTitle​(java.lang.String title)
        Sets the title of a Recipe
        Parameters:
        title - A String representing the title of a Recipe
      • getComments

        @Nullable
        public java.lang.String getComments()
        Gets the comments associated with a Recipe
        Returns:
        A String representing the comments on a Recipe
      • setComments

        public void setComments​(java.lang.String comments)
        Sets the comments associated with a Recipe
        Parameters:
        comments - A String representing the comments on a Recipe
      • getServings

        public java.lang.Long getServings()
        Gets the number of servings that a Recipe makes
        Returns:
        A long representing the number of servings a Recipe makes
      • setServings

        public void setServings​(java.lang.Long servings)
        Sets the number of servings that a Recipe makes
        Parameters:
        servings - A long representing the number of servings a Recipe makes
      • getPrepTimeMinutes

        public java.lang.Long getPrepTimeMinutes()
        Gets the time in minutes that it takes a Recipe to be prepared
        Returns:
        A long representing the preparation time in minutes
      • setPrepTimeMinutes

        public void setPrepTimeMinutes​(java.lang.Long prepTimeMinutes)
        Sets the prep time in minutes that it takes a Recipe to be prepared
        Parameters:
        prepTimeMinutes - A long representing the prep time in minutes.
      • getPhotograph

        @Nullable
        public java.lang.String getPhotograph()
        Gets the photograph associated with a Recipe.
        Returns:
        An Image object representing the photograph.
      • setPhotograph

        public void setPhotograph​(java.lang.String photograph)
        Sets the photograph associated with a Recipe.
        Parameters:
        photograph - An Image object representing the photograph to be set.
      • getId

        public java.lang.String getId()
        Gets the id of a Recipe, the id of the document in the db the Recipe is based off of
        Returns:
        A string representing the id of the document in the db
      • setId

        public void setId​(java.lang.String id)
        Sets the id of a Recipe
        Parameters:
        id - A string representing the id of the document in the db
      • isEqual

        public boolean isEqual​(java.lang.Object o)
        Checks whether the recipe is equal to another recipe. Note: Any order of ingredients is accepted.
        Parameters:
        o - the object to check equality with
        Returns:
        true if the objects are equal, false otherwise