Package com.xffffff.wellfed.ingredient
Class Ingredient
- java.lang.Object
-
- com.xffffff.wellfed.ingredient.Ingredient
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
ShoppingCartIngredient,StorageIngredient
public class Ingredient extends java.lang.Object implements java.io.SerializableThis class represents an Ingredient which can be used in many ways in a MealPlanning application.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Ingredient()Creates a new Ingredient object that represents an Ingredient used for various meal purposes.Ingredient(Ingredient ingredient)Copy constructor for an Ingredient object.Ingredient(java.lang.String description)Creates a new Ingredient object that represents an Ingredient used for various meal purposes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.DoublegetAmount()Gets the amount of an ingredientjava.lang.StringgetCategory()Gets the category.java.lang.StringgetDescription()Gets the description (aka title) of an Ingredientjava.lang.StringgetId()Get the database ID of an ingredient.java.lang.StringgetUnit()Gets a String representing the unit of an amountbooleanisEqual(java.lang.Object o)Checks whether the ingredient is equal to another ingredient.voidsetAmount(java.lang.Double amount)Sets the amount of an ingredientvoidsetCategory(java.lang.String category)Sets the category (aka tag) of an Ingredient object.voidsetDescription(java.lang.String description)Sets the description (aka title) of an IngredientvoidsetId(java.lang.String id)Sets the database ID of an ingredient.voidsetUnit(java.lang.String unit)Sets the unit of an amount
-
-
-
Constructor Detail
-
Ingredient
public Ingredient(java.lang.String description)
Creates a new Ingredient object that represents an Ingredient used for various meal purposes.- Parameters:
description- The description/title of an Ingredient
-
Ingredient
public Ingredient(Ingredient ingredient)
Copy constructor for an Ingredient object.- Parameters:
ingredient- The Ingredient object to be copied.
-
Ingredient
public Ingredient()
Creates a new Ingredient object that represents an Ingredient used for various meal purposes.
-
-
Method Detail
-
getCategory
public java.lang.String getCategory()
Gets the category.- Returns:
- The String representing the category
-
setCategory
public void setCategory(java.lang.String category)
Sets the category (aka tag) of an Ingredient object.- Parameters:
category- The category to add
-
getDescription
public java.lang.String getDescription()
Gets the description (aka title) of an Ingredient- Returns:
- The String representing the description (aka title) of the Ingredient
-
setDescription
public void setDescription(java.lang.String description)
Sets the description (aka title) of an Ingredient- Parameters:
description- The String representing the description (aka title) of the Ingredient
-
getUnit
public java.lang.String getUnit()
Gets a String representing the unit of an amount- Returns:
- A String representing the unit
-
setUnit
public void setUnit(java.lang.String unit)
Sets the unit of an amount- Parameters:
unit- A String representing the unit
-
getAmount
public java.lang.Double getAmount()
Gets the amount of an ingredient- Returns:
- the amount
-
setAmount
public void setAmount(java.lang.Double amount)
Sets the amount of an ingredient- Parameters:
amount- the amount
-
getId
public java.lang.String getId()
Get the database ID of an ingredient. This returns null if the ingredient is not in DB.- Returns:
- the ID of the ingredient
-
setId
public void setId(java.lang.String id)
Sets the database ID of an ingredient.- Parameters:
id- the ID of the ingredient
-
isEqual
public boolean isEqual(java.lang.Object o)
Checks whether the ingredient is equal to another ingredient.- Parameters:
o- the object to check equality with- Returns:
- true if the objects are equal, false otherwise
-
-