Browse Source

Added: Javadoc for Warehouse

feature-pr/shop
Maxim Volkov 3 years ago
parent
commit
22f136449f
  1. 9
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Warehouse.java

9
projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Warehouse.java

@ -5,10 +5,19 @@ import java.util.HashMap;
public class Warehouse { public class Warehouse {
protected HashMap<String, Item> pool = new HashMap<String, Item>(); protected HashMap<String, Item> pool = new HashMap<String, Item>();
/**
*
* @param item Item to insert.
* @return the inserted Item or null.
*/
public Item insertItem(Item item) { public Item insertItem(Item item) {
return pool.putIfAbsent(item.getTitel(), item); return pool.putIfAbsent(item.getTitel(), item);
} }
/**
*
* @return The total amount of all Items.
*/
public int getCountOfStock() { public int getCountOfStock() {
int sumItems = 0; int sumItems = 0;
for (HashMap.Entry<String, Item> set : pool.entrySet()) { for (HashMap.Entry<String, Item> set : pool.entrySet()) {

Loading…
Cancel
Save