Package ruscz.game.gameOfProd.Inventory
Class InventoryManager
- java.lang.Object
-
- ruscz.game.gameOfProd.Inventory.InventoryManager
-
public class InventoryManager extends java.lang.ObjectClass for working with Inventory (fully static)
-
-
Constructor Summary
Constructors Constructor Description InventoryManager()
-
Method Summary
Modifier and Type Method Description static voidaddItem(Item item)Increase multiplicity of items, if exists in Inventory, or add to Liststatic ItemfindItemByName(java.lang.String name)Return Item, if exists in List with this Namestatic voidflushInventory()Deletes all items from Inventorystatic java.util.LinkedList<Item>getInventory()static booleanisInInventory(Item item)Checks, if item in Inventorystatic booleanremoveItem(Item item, int count)Removes count of Item, if it possible
-
-
-
Field Detail
-
inventory
private static java.util.LinkedList<Item> inventory
-
-
Method Detail
-
addItem
public static void addItem(Item item)
Increase multiplicity of items, if exists in Inventory, or add to List- Parameters:
item- Item to add to inventory
-
flushInventory
public static void flushInventory()
Deletes all items from Inventory
-
isInInventory
public static boolean isInInventory(Item item)
Checks, if item in Inventory- Parameters:
item- Item to check- Returns:
- true if is in List, false if not
-
removeItem
public static boolean removeItem(Item item, int count)
Removes count of Item, if it possible- Parameters:
item- Item to removecount- Count of this Item- Returns:
- true if successful, false if not
-
getInventory
public static java.util.LinkedList<Item> getInventory()
-
findItemByName
public static Item findItemByName(java.lang.String name)
Return Item, if exists in List with this Name- Parameters:
name- Name of Item- Returns:
- Item if exists, null if not
-
-