java.lang.Object
stud.ntnu.idatt1005.pantrypal.models.Model
stud.ntnu.idatt1005.pantrypal.models.Grocery
This is an entity class representing a grocery.
It contains the name of the grocery, the quantity of the grocery,
the unit of the grocery (g for gram and l for liter), the shelf
the grocery is intended to be placed on, and a boolean value representing
whether the grocery is checked or not in the shopping list.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Get the checked status of the grocery.getName()
Get the name of the grocery.int
Get the quantity of the grocery.getShelf()
Get the category of the grocery.getUnit()
Get the unit of the grocery.void
setChecked
(boolean checked) Set the checked status of the grocery.void
setQuantity
(int quantity) Set the quantity amount of the grocery.toString()
-
Field Details
-
quantity
private int quantity -
unit
-
shelf
-
isChecked
private boolean isChecked
-
-
Constructor Details
-
Grocery
Constructor for the Grocery class.- Parameters:
name
- the name of the groceryquantity
- the quantity of the groceryshelf
- the category of the grocery
-
Grocery
Deep-copy constructor for the Grocery class.- Parameters:
grocery
- the grocery to be copied
-
-
Method Details
-
getName
Get the name of the grocery.- Returns:
- the name of the grocery
-
getQuantity
public int getQuantity()Get the quantity of the grocery.- Returns:
- the quantity of the grocery
-
getUnit
Get the unit of the grocery.- Returns:
- the unit of the grocery
-
getShelf
Get the category of the grocery.- Returns:
- the category of the grocery
-
getChecked
public boolean getChecked()Get the checked status of the grocery.- Returns:
- the checked status of the grocery
-
setChecked
public void setChecked(boolean checked) Set the checked status of the grocery.- Parameters:
checked
- the checked status of the grocery
-
setQuantity
public void setQuantity(int quantity) Set the quantity amount of the grocery.- Parameters:
quantity
- the category of the grocery
-
toString
-