Class InventoryInteractor

java.lang.Object
com.mg105.use_cases.inventory.InventoryInteractor
All Implemented Interfaces:
InventoryInteractorInputInterface

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

    Constructors
    Constructor
    Description
    InventoryInteractor(@NotNull GameState gamestate, @NotNull InventoryPresenterInterface response)
    Creates a new instance of InventoryInteractor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addItem(@NotNull String itemName)
    Attempts to add an item to the inventory based on the itemName and sends action data to the appropriate class
    void
    Collects data the represents the state of the inventory (i.e.
    int
    Returns the limit of the inventory The limit of the inventory is the maximum possible number of items that could be placed in it
    int
    Returns the number of items currently in the inventory
    void
    removeItem(@NotNull String itemName)
    Attempts to remove an item of itemName to the inventory and sends action data to the appropriate class
    void
    useItem(@NotNull String itemName, @NotNull String characterName)
    Attempts to use an item of itemName and sends action data to the appropriate class

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 game
      response - an object the represents what data to perhaps output
  • Method Details

    • addItem

      public void addItem(@NotNull @NotNull String itemName)
      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

      public void removeItem(@NotNull @NotNull String itemName)
      Attempts to remove an item of itemName to the inventory and sends action data to the appropriate class
      Specified by:
      removeItem in interface InventoryInteractorInputInterface
      Parameters:
      itemName - the name of the item to be removed
      See Also:
    • useItem

      public void useItem(@NotNull @NotNull String itemName, @NotNull @NotNull String characterName)
      Attempts to use an item of itemName and sends action data to the appropriate class
      Specified by:
      useItem in interface InventoryInteractorInputInterface
      Parameters:
      itemName - the name of the item to be used
      characterName - 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:
      getInventoryDetails in interface InventoryInteractorInputInterface
      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