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 TypeMethodDescriptionboolean
add
(int id) Add an item with a specified idboolean
add
(int id, int num) Add several of this itemboolean
Add an item with a specified idboolean
Add several of this itemboolean
contains
(int id) Check if a specific item is present in the backpackboolean
Check if a specific item is present in the backpackint
count
(int id) Quantity of a specific itemint
Quantity of a specific itemboolean
remove
(int id) Remove an item with this idboolean
remove
(int id, int num) boolean
remove a specified itemboolean
toString()
-
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:Inventory
Check if a specific item is present in the backpack -
contains
Description copied from interface:Inventory
Check if a specific item is present in the backpack -
count
public int count(int id) Description copied from interface:Inventory
Quantity of a specific item -
count
Description copied from interface:Inventory
Quantity of a specific item -
add
public boolean add(int id) Description copied from interface:Inventory
Add an item with a specified id -
add
public boolean add(int id, int num) Description copied from interface:Inventory
Add several of this item -
remove
public boolean remove(int id) Remove an item with this id -
add
Description copied from interface:Inventory
Add an item with a specified id -
add
Description copied from interface:Inventory
Add several of this item -
remove
Description copied from interface:Inventory
remove a specified item -
remove
public boolean remove(int id, int num) -
remove
-
getInStockItemIds
- Specified by:
getInStockItemIds
in interfaceInventory
-
toString
-