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: 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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
public class Facility implements Iterable<String> { protected String name;

}

protected class StorageUnit { public String unitId; public ArrayList<String> items; public StorageUnit next; public StorageUnit thread_next; public StorageUnit(String unitId) { this.unitId = unitId; this.items = new ArrayList<String>(); 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.

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Passing Array as Argument
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education