Class MealPlan

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    MealPlanProxy

    public class MealPlan
    extends java.lang.Object
    implements java.io.Serializable
    This class represents a MealPlan, which contains recipes and ingredients to be eaten on a specific date.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      MealPlan​(java.lang.String title)
      Creates a new MealPlan object which represents a meal to be eaten on a certain date.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addIngredient​(Ingredient ingredient)
      Adds an Ingredient to the MealPlan object.
      void addRecipe​(Recipe recipe)
      Adds a Recipe to the MealPlan object.
      java.lang.String getCategory()
      Gets the category of a MealPlan object.
      java.util.Date getEatDate()
      Gets the eat date that a MealPlan is to be eaten on.
      java.lang.String getId()
      Gets the id of a MealPlan, the id of the document in the db the MealPlan is based off of
      Ingredient getIngredient​(int index)
      Gets an Ingredient in the MealPlan object, given the index.
      java.util.ArrayList<Ingredient> getIngredients()
      Gets the entire ArrayList of Ingredients in the MealPlan object.
      Recipe getRecipe​(int index)
      Gets a Recipe in the MealPlan object, given the index.
      java.util.ArrayList<Recipe> getRecipes()
      Gets the entire ArrayList of Recipes in the MealPlan object.
      java.lang.Long getServings()
      Gets the number of servings in a MealPlan
      java.lang.String getTitle()
      Gets the title of a MealPlan object.
      boolean isEqual​(java.lang.Object o)
      Checks whether the meal plan is equal to another meal plan.
      void removeIngredient​(Ingredient ingredient)
      Removes an Ingredient from the MealPlan object.
      void removeRecipe​(Recipe recipe)
      Removes a Recipe from the MealPlan object.
      void setCategory​(java.lang.String category)
      Sets the category of a MealPlan object.
      void setEatDate​(java.util.Date eatDate)
      Sets the eat date that a MealPlan is to be eaten on
      void setId​(java.lang.String id)
      Sets the id of a MealPlan
      void setIngredients​(java.util.ArrayList<Ingredient> ingredients)
      Sets the entire ArrayList of Ingredients in the MealPlan object.
      void setRecipes​(java.util.ArrayList<Recipe> recipes)
      Sets the entire ArrayList of Recipes in the MealPlan object.
      void setServings​(java.lang.Long servings)
      Sets the number of servings in a MealPlan
      void setTitle​(java.lang.String title)
      Sets the title of a MealPlan object.
      • Methods inherited from class java.lang.Object

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

      • MealPlan

        public MealPlan​(java.lang.String title)
        Creates a new MealPlan object which represents a meal to be eaten on a certain date.
        Parameters:
        title - The title of the MealPlan
    • Method Detail

      • addIngredient

        public void addIngredient​(Ingredient ingredient)
        Adds an Ingredient to the MealPlan object.
        Parameters:
        ingredient - The Ingredient to be added.
      • removeIngredient

        public void removeIngredient​(Ingredient ingredient)
        Removes an Ingredient from the MealPlan object.
        Parameters:
        ingredient - The Ingredient to be removed.
      • getIngredient

        public Ingredient getIngredient​(int index)
        Gets an Ingredient in the MealPlan object, given the index.
        Parameters:
        index - The index to get the Ingredient of
        Returns:
        The Ingredient that was indexed
      • getIngredients

        public java.util.ArrayList<Ingredient> getIngredients()
        Gets the entire ArrayList of Ingredients in the MealPlan object.
        Returns:
        The ArrayList containing all Ingredients within a MealPlan.
      • setIngredients

        public void setIngredients​(java.util.ArrayList<Ingredient> ingredients)
        Sets the entire ArrayList of Ingredients in the MealPlan object.
        Parameters:
        ingredients - The ArrayList of Ingredients to be set.
      • addRecipe

        public void addRecipe​(Recipe recipe)
        Adds a Recipe to the MealPlan object.
        Parameters:
        recipe - The Recipe to be added.
      • removeRecipe

        public void removeRecipe​(Recipe recipe)
        Removes a Recipe from the MealPlan object.
        Parameters:
        recipe - The Recipe to be removed.
      • getRecipe

        public Recipe getRecipe​(int index)
        Gets a Recipe in the MealPlan object, given the index.
        Parameters:
        index - The index to get the Recipe of
        Returns:
        The Recipe that was indexed
      • getRecipes

        public java.util.ArrayList<Recipe> getRecipes()
        Gets the entire ArrayList of Recipes in the MealPlan object.
        Returns:
        The ArrayList containing all Recipes within a MealPlan.
      • setRecipes

        public void setRecipes​(java.util.ArrayList<Recipe> recipes)
        Sets the entire ArrayList of Recipes in the MealPlan object.
        Parameters:
        recipes - The ArrayList of Recipes to be set.
      • getTitle

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

        public void setTitle​(java.lang.String title)
        Sets the title of a MealPlan object.
        Parameters:
        title - The String to set as the title of the MealPlan.
      • getCategory

        @Nullable
        public java.lang.String getCategory()
        Gets the category of a MealPlan object.
        Returns:
        The String representing the category of a MealPlan object.
      • setCategory

        public void setCategory​(java.lang.String category)
        Sets the category of a MealPlan object.
        Parameters:
        category - The String to set as the category of the MealPlan object.
      • getEatDate

        @Nullable
        public java.util.Date getEatDate()
        Gets the eat date that a MealPlan is to be eaten on.
        Returns:
        a Date representing the day that a MealPlan is to be eaten on
      • setEatDate

        public void setEatDate​(java.util.Date eatDate)
        Sets the eat date that a MealPlan is to be eaten on
        Parameters:
        eatDate - a Date representing the day that a MealPlan is to be eaten on
      • getServings

        public java.lang.Long getServings()
        Gets the number of servings in a MealPlan
        Returns:
        an int representing the number of servings in a MealPlan
      • setServings

        public void setServings​(java.lang.Long servings)
        Sets the number of servings in a MealPlan
        Parameters:
        servings - an int representing the number of servings in a MealPlan
      • getId

        public java.lang.String getId()
        Gets the id of a MealPlan, the id of the document in the db the MealPlan 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 MealPlan
        Parameters:
        id - A string representing the id of the document in the db
      • isEqual

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