Class LocalStockImpl

  • All Implemented Interfaces:
    LocalStock

    public class LocalStockImpl
    extends Object
    implements LocalStock
    Implementation for the LocalStock interface.
    Author:
    Maximilian Schiedermeier
    • Constructor Detail

      • LocalStockImpl

        public LocalStockImpl()
        Default constructor.
    • Method Detail

      • getAmount

        public int getAmount​(long isbn)
        Tells the amount in stock for a given book id (isbn). There is no effective check if that book is actually known to the assortment.
        Specified by:
        getAmount in interface LocalStock
        Parameters:
        isbn - as identifier of the book in question.
        Returns:
        the amount in stock for the given book.
      • setAmount

        public void setAmount​(long isbn,
                              int amount)
        Update the amount of books in local stock, for a given book. There is no effective check if that book is actually known to the assortment.
        Specified by:
        setAmount in interface LocalStock
        Parameters:
        isbn - as identifies of the book in question
        amount - as the new amount in stock for the book in question
      • getEntireStock

        public Map<Long,​Integer> getEntireStock()
        Returns the entire stock of this location, as an immutable map.
        Specified by:
        getEntireStock in interface LocalStock
        Returns:
        a map, where the key is a book isbn and the value the amount in stock for this isbn.
      • toString

        public String toString()
        Overrides default toString method to serialize instances of this class to human readable string.
        Overrides:
        toString in class Object
        Returns:
        Human readable string representation of current object.