Interface Inventory
- All Known Implementing Classes:
Backpack,InventoryComponent
public interface Inventory
Inventory interface, limiting some basic functions of inventory
-
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 a specified itembooleanremove(int id, int num) booleanremove 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
-