Package com.xffffff.wellfed.recipe
Class Recipe
- java.lang.Object
-
- com.xffffff.wellfed.recipe.Recipe
-
- All Implemented Interfaces:
java.io.Serializable
public class Recipe extends java.lang.Object implements java.io.SerializableRepresents a Recipe, which contains ingredients and instructions on how to prepare a recipe.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddIngredient(Ingredient ingredient)Adds an Ingredient as part of a RecipevoidaddIngredients(java.util.List<Ingredient> ingredients)java.lang.StringgetCategory()Gets the category (aka tag) of the Recipejava.lang.StringgetComments()Gets the comments associated with a Recipejava.lang.StringgetId()Gets the id of a Recipe, the id of the document in the db the Recipe is based off ofIngredientgetIngredient(int index)Gets the Ingredient object at the specified index in a Recipejava.util.List<Ingredient>getIngredients()Gets the entire ArrayList of Ingredients that make up a Recipejava.lang.StringgetPhotograph()Gets the photograph associated with a Recipe.java.lang.LonggetPrepTimeMinutes()Gets the time in minutes that it takes a Recipe to be preparedjava.lang.LonggetServings()Gets the number of servings that a Recipe makesjava.lang.StringgetTitle()Gets the title of a RecipebooleanisEqual(java.lang.Object o)Checks whether the recipe is equal to another recipe.voidremoveIngredient(Ingredient ingredient)Removes an Ingredient from being part of a RecipevoidsetCategory(java.lang.String category)Adds a category (aka tag) to a RecipevoidsetComments(java.lang.String comments)Sets the comments associated with a RecipevoidsetId(java.lang.String id)Sets the id of a RecipevoidsetPhotograph(java.lang.String photograph)Sets the photograph associated with a Recipe.voidsetPrepTimeMinutes(java.lang.Long prepTimeMinutes)Sets the prep time in minutes that it takes a Recipe to be preparedvoidsetServings(java.lang.Long servings)Sets the number of servings that a Recipe makesvoidsetTitle(java.lang.String title)Sets the title of a Recipe
-
-
-
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
-
-