Class InventoryPresenter
java.lang.Object
com.mg105.interface_adapters.inventory.InventoryPresenter
- All Implemented Interfaces:
InventoryPresenterInterface
A class whose purpose is to update the view with the current state of the inventory and update it based on
a user's actions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addItem
(boolean isSuccessful, ItemDetails itemDetails) Sends an alert the view about the status of the potentially added itemvoid
inventoryDetails
(ItemDetails[] allItemsDetails) Send the information to update the exact state of the inventory to the view Should only be called right when the view is displayedvoid
removeItem
(boolean isSuccessful, ItemDetails itemDetails) Sends an alert the view about the status of the potentially removed item.void
setView
(@NotNull InventoryViewInterface view) Sets the view of the of this presenter This should be called right after the presenter is createdvoid
useItem
(boolean isSuccessful, String characterName, ItemDetails itemDetails) Sends an alert the view about the status of the attempted use of an item Also updates the view to display the appropriate amount of items left fo that type
-
Constructor Details
-
InventoryPresenter
public InventoryPresenter()
-
-
Method Details
-
setView
Sets the view of the of this presenter This should be called right after the presenter is created- Parameters:
view
- an object that is used to display information to the user
-
inventoryDetails
Send the information to update the exact state of the inventory to the view Should only be called right when the view is displayed- Specified by:
inventoryDetails
in interfaceInventoryPresenterInterface
- Parameters:
allItemsDetails
- a list of object that represent a state of single item type in the inventory- See Also:
-
addItem
Sends an alert the view about the status of the potentially added item- Specified by:
addItem
in interfaceInventoryPresenterInterface
- Parameters:
isSuccessful
- if an item of itemName was added to the inventoryitemDetails
- the state of the item that was potentially used- See Also:
-
removeItem
Sends an alert the view about the status of the potentially removed item. Also updates the view to display the appropriate amount of items left fo that type- Specified by:
removeItem
in interfaceInventoryPresenterInterface
- Parameters:
isSuccessful
- if an item of itemName was removed from the inventoryitemDetails
- the state of the item that was potentially used- See Also:
-
useItem
Sends an alert the view about the status of the attempted use of an item Also updates the view to display the appropriate amount of items left fo that type- Specified by:
useItem
in interfaceInventoryPresenterInterface
- Parameters:
isSuccessful
- if an item of itemName was removed from the inventoryitemDetails
- the state of the item that was potentially usedcharacterName
- the name of character the item was attempted to be used on- See Also:
-