public class Facility implements Iterable { protected String name; } protected class StorageUnit { public String unitId; public ArrayList items; public StorageUnit next; public StorageUnit...


public class Facility implements Iterable { protected String name;

}


protected class StorageUnit { public String unitId; public ArrayList items; public StorageUnit next; public StorageUnit thread_next; public StorageUnit(String unitId) { this.unitId = unitId; this.items = new ArrayList(); next = null;

}


public void addItem(String singleItem) { items.add(singleItem);

} }


protected StorageUnit head; protected int totalUnits; protected StorageUnit thread_head;

}



Please provide implementation for the setThread method to accompany the above code.



Method description:




  1. public void setThread(int minimumItemsInUnit) - RECURSIVE METHOD - This method initializes thread_head and thread_next to form a list with those nodes from the original list that have at least a number of items that corresponds to the parameter. This method must be recursive. The instance variable thread_head must point to the first node with at least a number of items that correspond to the parameter (if any). You can use the method toStringThreadedNodes() (provided) to verify whether the thread has been set correctly. You will lose at least half of the points for this method if you use any iteration statement (e.g., for, while, do while), if you use more than one auxiliary method to support the recursion, or if you add any instance or static variables to support the recursion. Also, you will lose half of the points if you create any StorageUnit nodes. Make sure the support method is private. You can assume the parameter will have a value greater than or equal to 0.




Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here