public class GroceryList extends ProductAmountListOwner
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
groceryListName |
Constructor and Description |
---|
GroceryList(GroceryList groceryList) |
GroceryList(java.lang.String listName) |
GroceryList(java.lang.String groceryListName,
java.util.List<ProductAmount> productList) |
Modifier and Type | Method and Description |
---|---|
void |
deleteItem(ProductAmount productAmount)
Deletes an item from a grocery list
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getGroceryListName() |
ProductAmount |
getProductAmountByProductName(java.lang.String name)
Searches and returns a product in the productAmountList.
|
java.util.List<ProductAmount> |
getProductAmountList()
Gets a list of all the products of a grocery list with their amount
|
java.util.List<Product> |
getProductsList()
Gets a list of all the products contained in the productAmountList.
|
int |
hashCode() |
java.util.List<java.lang.String> |
toList()
Transforms a GroceryList into an ArrayList of strings in which each
string contains the information of a GroceryList element.
|
addProductAmount, addProductOrIncreaseAmount, getUnderlyingProductAmountList, isEmpty, setUnderlyingProductAmountList
public GroceryList(java.lang.String listName)
public GroceryList(GroceryList groceryList)
public GroceryList(java.lang.String groceryListName, java.util.List<ProductAmount> productList)
public java.lang.String getGroceryListName()
public void deleteItem(ProductAmount productAmount)
productAmount
- The item to be deletedpublic java.util.List<ProductAmount> getProductAmountList()
public java.util.List<Product> getProductsList()
public ProductAmount getProductAmountByProductName(java.lang.String name)
getProductAmountByProductName
in class ProductAmountListOwner
name
- the name of the product.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.util.List<java.lang.String> toList()