/**
 * Steven Ward
 * Inventory.java | Drink Machine Project
 *
 * This file contains the definition of the Inventory generic class, which is described below.
 *
 * Due Date: December 4, 2016
 *
 */


/**
 * TODO: CLASS-LEVEL DOCUMENTATION FOR INVENTORY CLASS!
 *       JAVADOC TAGS
 */
public class Inventory<ProductType extends Enum<ProductType>> {

  public final Class<ProductType>;
  public final EnumSet<ProductType> products;
  public int[] currentStock;

}

@@ -193,17 +193,92 @@
  *%0A */%0A%0A
+import java.util.ArrayList;%0Aimport java.util.Arrays;%0Aimport java.util.List;
 %0A
-
 /**%0A * T
@@ -453,16 +453,28 @@
 uctType%3E
+ productType
 ;%0A  publ
@@ -486,67 +486,1708 @@
 nal 
-EnumSet%3CProductType%3E products;%0A  public int%5B%5D currentStock;
+List%3CProductType%3E products;%0A  private int%5B%5D currentStock;%0A%0A  public Inventory(Class%3CProductType%3E productType, final int%5B%5D initStock) %7B%0A    this.productType = productType;%0A    this.products = new ArrayList%3CProductType%3E( Arrays.asList(this.productType.getEnumConstants()) );%0A%0A    // the 'Arrays.copyOf(int%5B%5D original, int newLength)' method truncates (or pads with zeros) the%0A    // resulting copy so that it has the specified length - so, 'initStock' will be copied to the%0A    // proper length by removing trailing elements or adding elements with a zero value, if necessary%0A    this.currentStock = Arrays.copyOf(initStock, products.size());%0A  %7D%0A%0A%0A  public Inventory(Class%3CProductType%3E productType, int initStock) %7B%0A    this.productType = productType;%0A    this.products = new ArrayList%3CProductType%3E( Arrays.asList(this.productType.getEnumConstants()) );%0A    this.currentStock = new int%5Bproducts.size()%5D;%0A    Arrays.fill(currentStock, initStock);%0A  %7D%0A%0A%0A  public boolean removeItem(int itemNo) %7B%0A    if (itemNo %3E= this.currentStock.length) throw new IllegalArgumentException();%0A%0A    if (currentStock%5BitemNo%5D %3E 0) %7B%0A      --currentStock%5BitemNo%5D;%0A      return true;%0A    %7D%0A    else %7B%0A      return false;%0A    %7D%0A  %7D%0A%0A  public boolean removeItem(ProductType item) %7B%0A    return removeItem(getItemNo(item));%0A  %7D%0A%0A%0A  public boolean isSoldOut(int itemNo) %7B%0A    return this.currentStock%5BitemNo%5D %3C= 0;%0A  %7D%0A%0A  public boolean isSoldOut(ProductType item) %7B%0A    return isSoldOut(getItemNo(item));%0A  %7D%0A%0A  public boolean isSoldOut( ) %7B%0A    for (int n : this.currentStock) %7B%0A      if (n %3E 0) return false;%0A    %7D%0A    return true;%0A  %7D%0A%0A%0A  private int getItemNo(ProductType item) %7B%0A    return this.products.indexOf(item);%0A  %7D
 %0A%0A%7D%0A

Add almost complete version of Inventory generic class