Package com.xffffff.wellfed.mealplan
Class MealPlan
- java.lang.Object
-
- com.xffffff.wellfed.mealplan.MealPlan
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
MealPlanProxy
public class MealPlan extends java.lang.Object implements java.io.SerializableThis 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 voidaddIngredient(Ingredient ingredient)Adds an Ingredient to the MealPlan object.voidaddRecipe(Recipe recipe)Adds a Recipe to the MealPlan object.java.lang.StringgetCategory()Gets the category of a MealPlan object.java.util.DategetEatDate()Gets the eat date that a MealPlan is to be eaten on.java.lang.StringgetId()Gets the id of a MealPlan, the id of the document in the db the MealPlan is based off ofIngredientgetIngredient(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.RecipegetRecipe(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.LonggetServings()Gets the number of servings in a MealPlanjava.lang.StringgetTitle()Gets the title of a MealPlan object.booleanisEqual(java.lang.Object o)Checks whether the meal plan is equal to another meal plan.voidremoveIngredient(Ingredient ingredient)Removes an Ingredient from the MealPlan object.voidremoveRecipe(Recipe recipe)Removes a Recipe from the MealPlan object.voidsetCategory(java.lang.String category)Sets the category of a MealPlan object.voidsetEatDate(java.util.Date eatDate)Sets the eat date that a MealPlan is to be eaten onvoidsetId(java.lang.String id)Sets the id of a MealPlanvoidsetIngredients(java.util.ArrayList<Ingredient> ingredients)Sets the entire ArrayList of Ingredients in the MealPlan object.voidsetRecipes(java.util.ArrayList<Recipe> recipes)Sets the entire ArrayList of Recipes in the MealPlan object.voidsetServings(java.lang.Long servings)Sets the number of servings in a MealPlanvoidsetTitle(java.lang.String title)Sets the title of a MealPlan object.
-
-
-
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
-
-