Class InventoryPresenter

java.lang.Object
com.mg105.interface_adapters.inventory.InventoryPresenter
All Implemented Interfaces:
InventoryPresenterInterface

public class InventoryPresenter extends Object implements 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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addItem(boolean isSuccessful, ItemDetails itemDetails)
    Sends an alert the view about the status of the potentially added item
    void
    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 displayed
    void
    removeItem(boolean isSuccessful, ItemDetails itemDetails)
    Sends an alert the view about the status of the potentially removed item.
    void
    Sets the view of the of this presenter This should be called right after the presenter is created
    void
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InventoryPresenter

      public InventoryPresenter()
  • Method Details

    • setView

      public void setView(@NotNull @NotNull InventoryViewInterface view)
      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

      public void 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 displayed
      Specified by:
      inventoryDetails in interface InventoryPresenterInterface
      Parameters:
      allItemsDetails - a list of object that represent a state of single item type in the inventory
      See Also:
    • addItem

      public void addItem(boolean isSuccessful, ItemDetails itemDetails)
      Sends an alert the view about the status of the potentially added item
      Specified by:
      addItem in interface InventoryPresenterInterface
      Parameters:
      isSuccessful - if an item of itemName was added to the inventory
      itemDetails - the state of the item that was potentially used
      See Also:
    • removeItem

      public void removeItem(boolean isSuccessful, ItemDetails itemDetails)
      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 interface InventoryPresenterInterface
      Parameters:
      isSuccessful - if an item of itemName was removed from the inventory
      itemDetails - the state of the item that was potentially used
      See Also:
    • useItem

      public void 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
      Specified by:
      useItem in interface InventoryPresenterInterface
      Parameters:
      isSuccessful - if an item of itemName was removed from the inventory
      itemDetails - the state of the item that was potentially used
      characterName - the name of character the item was attempted to be used on
      See Also: