Package com.mg105.use_cases.inventory
Class InventoryInteractor
java.lang.Object
com.mg105.use_cases.inventory.InventoryInteractor
- All Implemented Interfaces:
InventoryInteractorInputInterface
This class is the only class that should directly interact with the inventory
It is responsible for all things related to get information from the inventory and updating the inventory.
-
Constructor Summary
ConstructorsConstructorDescriptionInventoryInteractor(@NotNull GameState gamestate, @NotNull InventoryPresenterInterface response) Creates a new instance of InventoryInteractor -
Method Summary
Modifier and TypeMethodDescriptionvoidAttempts to add an item to the inventory based on the itemName and sends action data to the appropriate classvoidCollects data the represents the state of the inventory (i.e.intReturns the limit of the inventory The limit of the inventory is the maximum possible number of items that could be placed in itintReturns the number of items currently in the inventoryvoidremoveItem(@NotNull String itemName) Attempts to remove an item of itemName to the inventory and sends action data to the appropriate classvoidAttempts to use an item of itemName and sends action data to the appropriate class
-
Constructor Details
-
InventoryInteractor
public InventoryInteractor(@NotNull @NotNull GameState gamestate, @NotNull @NotNull InventoryPresenterInterface response) Creates a new instance of InventoryInteractor- Parameters:
gamestate- the current state of the gameresponse- an object the represents what data to perhaps output
-
-
Method Details
-
addItem
Attempts to add an item to the inventory based on the itemName and sends action data to the appropriate class- Parameters:
itemName- the name of the item to be added- See Also:
-
removeItem
Attempts to remove an item of itemName to the inventory and sends action data to the appropriate class- Specified by:
removeItemin interfaceInventoryInteractorInputInterface- Parameters:
itemName- the name of the item to be removed- See Also:
-
useItem
Attempts to use an item of itemName and sends action data to the appropriate class- Specified by:
useItemin interfaceInventoryInteractorInputInterface- Parameters:
itemName- the name of the item to be usedcharacterName- the name of character the item should be used on- See Also:
-
getInventoryDetails
public void getInventoryDetails()Collects data the represents the state of the inventory (i.e. the items in it and their details) and sends action data to the appropriate class- Specified by:
getInventoryDetailsin interfaceInventoryInteractorInputInterface- See Also:
-
getInventoryLimit
public int getInventoryLimit()Returns the limit of the inventory The limit of the inventory is the maximum possible number of items that could be placed in it- Returns:
- and integer representing the limit of the inventory
-
getNumOfItem
public int getNumOfItem()Returns the number of items currently in the inventory- Returns:
- the number of items currently in the inventory
-