CS U370 Assignment #7 Assigned: Tuesday, 24 March 2009 Due: Tuesday, 31 March 2009 The purposes of this assignment are: * To illustrate the Iterator pattern. This assignment is to be done by individual students, not by pairs or teams of students. Collaboration between students is forbidden on this assignment. You are responsible for keeping your code hidden from all other students. You will extend your implementation of the Dependencies ADT that was specified in assignments 3, 5, and 6 by adding the public dynamic method specified below. Collaboration between students is forbidden on this assignment. You are responsible for keeping your code hidden from all other students. Turn in your work on this assignment before 10 pm on the due date by sending electronic mail to: will@ccs.neu.edu with subject CSU370 assignment 7 and a body that consists of nothing but your Dependencies.java file. That file should begin with a block comment that lists 1. Your name, as you want the instructor to write it. 2. Your email address. 3. Any remarks that you wish to make to the instructor. Part of your grade will depend on the quality and correctness of your code (including its implementation of the specifications given in assignments 3, 5, and 6 as well as the specification below), part will depend on the readability of your code (comments and indentation), and part will depend on how well you follow the procedure above for submitting your work. Late assignments may be discounted, and very late assignments may be discarded. -------------------------------------------------- Your assignment is to write the code for a single file, Dependencies.java, that implements the specification below as well as the specifications of assignments 3, 5, and 6. You are given two files in /course/csu370wc/Assignments/A7: Visitor.java TestIterator.java As in assignment 6, the Visitor.java file defines the Visitor interface. The TestIterator.java file contains a simple test program; you will need to supplement that test program with further tests, including tests for the methods specified by assignments 3, 5, and 6. -------------------------------------------------- Specification of the Dependencies ADT. The Dependencies ADT remains immutable. The Dependencies ADT shall be implemented in Java, and will be tested using Sun's Java 2 Runtime Environment, Standard Edition, version 1.6.0. The code for this implementation will be in the default package, and shall define a public class named Dependencies. The Dependencies class is a client of the Refreshable ADT (as specified in assignment #1), the Dependency ADT (as specified in assignment #2), and the Visitor interface (as provided by Visitor.java). Your code for the Dependencies class should therefore work with all possible implementations of those ADTs and with all function objects that implement Visitor. The Dependencies class shall provide all of the methods specified in assignments 3, 5, and 6. In addition, that class shall implement Iterable and shall provide the following public dynamic method: java.util.Iterator iterator (); The iterator() method shall return an Iterator that conforms to Sun's general specification for java.util.Iterator. The next() method shall throw a NoSuchElementException if there are no more elements for it to generate. The remove() method shall throw an UnsupportedOperationException if it is called. The next() method shall generate Dependency objects in the same order they would be visited using the accept method specified by assignment #6. --------------------------------------------------