For this Assignment, you update WERS to handle a new user requirement. Your updates follow the Composite and Iterator design patterns and include some of the iteration features of Java.
Consider the following scenario for WERS. Your users are requiring an addition to the WERS Emergency Materials list. This list now needs to include a new data structure based on materials information in the database. This data structure follows the Composite pattern and creates a tree with the school “campus” as root. It also includes “buildings” as children of campus, “rooms” as children of buildings, and “materials” as leaves within rooms. You should assume that the resulting structure will be provided and used by other developers.
In order to update WERS to handle this requirement, the above structure will have to return a string showing the entire structure of materials on the campus. This string should be displayed with good indentation for each level and all information in building, then room, then material order. Also make sure to check the correctness of your composite structure.
A second capability is required as well. From the tree, you need to provide the ability to print out a catalog of all items stored on campus. For now, the list should be simply the names of the materials in alphabetical order, and should not include duplicates. The list must be available through a String iterator.
Once you have completed your updates, confirm the system runs as required.
By Day 7, submit the following:
- The updated source code with appropriate comments (Make sure to include the following comment above your updates: “// CHANGED for ITERATOR AND COMPOSITE IMPLEMENTATION”.)
- An explanation of how you applied the Iterator pattern to the implementation of the Composite pattern
- Screenshots of the updated system running the tree composition and printing your lists
- A single, updated UML class diagram for both of your Composite and Iterator classes