Skip to content

Commit

Permalink
Some minor corrections to Inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
prmr committed Sep 26, 2022
1 parent 635af38 commit 5aa88ab
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/comp303/corp/Inventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
* Represents the inventory of a
Expand All @@ -10,7 +11,7 @@
public class Inventory implements Iterable<Item>
{
private final String aName; // Unique
private final HashMap<Item, Integer> aInventory = new HashMap<>();
private final Map<Item, Integer> aInventory = new HashMap<>();

/**
* Creates a new inventory with no items in it,
Expand Down Expand Up @@ -47,12 +48,10 @@ public void stock(Item pItem, int pQuantity)
}

/**
* Removes pQuantity of items from the inventory,
* for example by selling them or tossing them in
* the garbage.
* Removes pQuantity of items from the inventory.
* @param pItem The type of item to dispose of
* @param pQuantity The amount to dispose.
* @pre aInventory.containsKey(pItem) && pQuantity >= aInventory.get(pItem)
* @pre aInventory.containsKey(pItem) && pQuantity <= available(pItem)
*/
public void dispose(Item pItem, int pQuantity)
{
Expand Down

0 comments on commit 5aa88ab

Please sign in to comment.