java.lang.Object
stud.ntnu.idatt1005.pantrypal.models.Model
stud.ntnu.idatt1005.pantrypal.models.Grocery

public class Grocery extends Model
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 Details

    • quantity

      private int quantity
    • unit

      private final String unit
    • shelf

      private String shelf
    • isChecked

      private boolean isChecked
  • Constructor Details

    • Grocery

      public Grocery(String name, int quantity, String unit, String shelf, boolean isChecked)
      Constructor for the Grocery class.
      Parameters:
      name - the name of the grocery
      quantity - the quantity of the grocery
      shelf - the category of the grocery
    • Grocery

      public Grocery(Grocery grocery)
      Deep-copy constructor for the Grocery class.
      Parameters:
      grocery - the grocery to be copied
  • Method Details

    • getName

      public String 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

      public String getUnit()
      Get the unit of the grocery.
      Returns:
      the unit of the grocery
    • getShelf

      public String 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

      public String toString()
      Overrides:
      toString in class Object