Interface Inventory
- All Known Implementing Classes:
Backpack
,InventoryComponent
public interface Inventory
Inventory interface, limiting some basic functions of inventory
-
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 a specified itemboolean
remove
(int id, int num) boolean
remove a specified itemboolean
-
Method Details
-
contains
boolean contains(int id) Check if a specific item is present in the backpack- Parameters:
id
- item id- Returns:
- true if the quantity of the item in stock is greater than zero
-
contains
Check if a specific item is present in the backpack- Parameters:
itemName
- item name- Returns:
- true if the quantity of the item in stock is greater than zero
-
count
int count(int id) Quantity of a specific item- Parameters:
id
- item id- Returns:
- the quantity of the item or -1 if the item id is not exist.
-
count
Quantity of a specific item- Parameters:
itemName
- item name- Returns:
- the quantity of the item or -1 if the item name is not exist.
-
add
boolean add(int id) Add an item with a specified id- Parameters:
id
- item id- Returns:
- true if add successfully
-
add
boolean add(int id, int num) Add several of this item- Parameters:
id
- item idnum
- the number of the added item- Returns:
-
add
Add an item with a specified id- Parameters:
itemName
- item name- Returns:
- true if add successfully
-
add
Add several of this item- Parameters:
itemName
- item namenum
- the number of the added item- Returns:
-
remove
boolean remove(int id) remove a specified item- Parameters:
id
- item id- Returns:
- true if remove successfully
-
remove
remove a specified item- Parameters:
itemName
- item name- Returns:
- true if remove successfully
-
remove
boolean remove(int id, int num) -
remove
-
getInStockItemIds
-