Class LocalStockImpl
- java.lang.Object
-
- eu.kartoffelquadrat.bookstoreinternals.LocalStockImpl
-
- All Implemented Interfaces:
LocalStock
public class LocalStockImpl extends Object implements LocalStock
Implementation for the LocalStock interface.- Author:
- Maximilian Schiedermeier
-
-
Constructor Summary
Constructors Constructor Description LocalStockImpl()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAmount(long isbn)
Tells the amount in stock for a given book id (isbn).Map<Long,Integer>
getEntireStock()
Returns the entire stock of this location, as an immutable map.void
setAmount(long isbn, int amount)
Update the amount of books in local stock, for a given book.String
toString()
Overrides default toString method to serialize instances of this class to human readable string.
-
-
-
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 interfaceLocalStock
- 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 interfaceLocalStock
- Parameters:
isbn
- as identifies of the book in questionamount
- 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 interfaceLocalStock
- Returns:
- a map, where the key is a book isbn and the value the amount in stock for this isbn.
-
-