Class Backpack
java.lang.Object
com.deco2800.game.components.player.entity.Backpack
- All Implemented Interfaces:
Inventory
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(int id) Add an item with a specified idbooleanadd(int id, int num) Add several of this itembooleanAdd an item with a specified idbooleanAdd several of this itembooleancontains(int id) Check if a specific item is present in the backpackbooleanCheck if a specific item is present in the backpackintcount(int id) Quantity of a specific itemintQuantity of a specific itembooleanremove(int id) Remove an item with this idbooleanremove(int id, int num) booleanremove a specified itembooleantoString()
-
Field Details
-
ID_ITEM_MAP
-
NAME_ID_MAP
-
-
Constructor Details
-
Backpack
public Backpack()
-
-
Method Details
-
contains
public boolean contains(int id) Description copied from interface:InventoryCheck if a specific item is present in the backpack -
contains
Description copied from interface:InventoryCheck if a specific item is present in the backpack -
count
public int count(int id) Description copied from interface:InventoryQuantity of a specific item -
count
Description copied from interface:InventoryQuantity of a specific item -
add
public boolean add(int id) Description copied from interface:InventoryAdd an item with a specified id -
add
public boolean add(int id, int num) Description copied from interface:InventoryAdd several of this item -
remove
public boolean remove(int id) Remove an item with this id -
add
Description copied from interface:InventoryAdd an item with a specified id -
add
Description copied from interface:InventoryAdd several of this item -
remove
Description copied from interface:Inventoryremove a specified item -
remove
public boolean remove(int id, int num) -
remove
-
getInStockItemIds
- Specified by:
getInStockItemIdsin interfaceInventory
-
toString
-