Class StorageIngredient

  • All Implemented Interfaces:
    java.io.Serializable

    public class StorageIngredient
    extends Ingredient
    An Ingredient represented in a user's storage, with added amount, unit, location, and best before.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      StorageIngredient​(java.lang.String description)
      Creates a new StorageIngredient object without data.
      StorageIngredient​(java.lang.String description, java.lang.Double amount, java.lang.String unit, java.lang.String location, java.util.Date bestBefore)
      Creates a new StorageIngredient object that represents an Ingredient used for various meal purposes.
      StorageIngredient​(java.lang.String description, java.lang.Double amount, java.lang.String unit, java.lang.String location, java.util.Date bestBefore, java.lang.String category)
      Creates a new StorageIngredient object that represents an Ingredient used for various meal purposes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Date getBestBefore()
      Gets the best before date of the ingredient in the storage.
      java.lang.String getLocation()
      Gets the location of the ingredient in the storage.
      java.lang.String getStorageId()
      Get the database ID of a storage ingredient.
      boolean isEqual​(java.lang.Object o)
      Checks whether the ingredient is equal to another ingredient.
      void setBestBefore​(java.util.Date bestBefore)
      Sets the best before date of the ingredient in the storage.
      void setLocation​(java.lang.String location)
      Sets the location of the ingredient in the storage.
      void setStorageId​(java.lang.String storageId)
      Sets the database ID of a storage ingredient.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StorageIngredient

        public StorageIngredient​(java.lang.String description)
        Creates a new StorageIngredient object without data.
        Parameters:
        description - The description of the ingredient.
      • StorageIngredient

        public StorageIngredient​(java.lang.String description,
                                 java.lang.Double amount,
                                 java.lang.String unit,
                                 java.lang.String location,
                                 java.util.Date bestBefore)
        Creates a new StorageIngredient object that represents an Ingredient used for various meal purposes.
        Parameters:
        description - The description/title of an Ingredient
        amount - The amount of the ingredient in the storage.
        unit - The unit of the ingredient in the storage.
        location - The location of the ingredient in the storage.
        bestBefore - The best before date of the ingredient in the storage.
      • StorageIngredient

        public StorageIngredient​(java.lang.String description,
                                 java.lang.Double amount,
                                 java.lang.String unit,
                                 java.lang.String location,
                                 java.util.Date bestBefore,
                                 java.lang.String category)
        Creates a new StorageIngredient object that represents an Ingredient used for various meal purposes.
        Parameters:
        description - The description/title of an Ingredient
        amount - The amount of the ingredient in the storage.
        unit - The unit of the ingredient in the storage.
        location - The location of the ingredient in the storage.
        bestBefore - The best before date of the ingredient in the storage.
        category - The categories of the ingredient.
    • Method Detail

      • getLocation

        public java.lang.String getLocation()
        Gets the location of the ingredient in the storage.
        Returns:
        The location of the ingredient in the storage
      • setLocation

        public void setLocation​(java.lang.String location)
        Sets the location of the ingredient in the storage.
        Parameters:
        location - The location of the ingredient in the storage
      • getBestBefore

        public java.util.Date getBestBefore()
        Gets the best before date of the ingredient in the storage.
        Returns:
        The best before date of the ingredient in the storage
      • setBestBefore

        public void setBestBefore​(java.util.Date bestBefore)
        Sets the best before date of the ingredient in the storage.
        Parameters:
        bestBefore - The best before date of the ingredient in the storage
      • isEqual

        public boolean isEqual​(java.lang.Object o)
        Checks whether the ingredient is equal to another ingredient.
        Overrides:
        isEqual in class Ingredient
        Parameters:
        o - the object to check equality with
        Returns:
        true if the objects are equal, false otherwise
      • getStorageId

        public java.lang.String getStorageId()
        Get the database ID of a storage ingredient. This returns null if the storage ingredient is not in DB.
        Returns:
        the ID of the storage ingredient
      • setStorageId

        public void setStorageId​(java.lang.String storageId)
        Sets the database ID of a storage ingredient.
        Parameters:
        storageId - the ID of the storage ingredient