public class Inventory
extends java.lang.Object
Constructor and Description |
---|
Inventory()
Creates an empty inventory.
|
Modifier and Type | Method and Description |
---|---|
<T extends Item> |
addItem(java.lang.Class<T> itemClass,
int quantity)
Adds the Item of the given class inside the Inventory in the given quantity.
|
void |
clear()
Clears all of the items stored in the inventory.
|
java.util.HashMap<java.lang.Class,java.lang.Integer> |
getItemMap()
Returns the ItemMap which maps the Item classes to the amount of the item stored inside the inventory.
|
int |
getQuantity(java.lang.Class itemClass)
Returns the quantity of items of the given class inside the inventory.
|
void |
setItemMap(java.util.HashMap<java.lang.Class,java.lang.Integer> itemMap)
Sets the ItemMap which maps the Item classes to the amount of the item stored inside the inventory.
|
public <T extends Item> void addItem(java.lang.Class<T> itemClass, int quantity)
public int getQuantity(java.lang.Class itemClass)
public void clear()
public java.util.HashMap<java.lang.Class,java.lang.Integer> getItemMap()
public void setItemMap(java.util.HashMap<java.lang.Class,java.lang.Integer> itemMap)