Outcomes Addressed

Overview

The Java Collections Framework provides only a Queue<E> interface but no classes that provide an actual implementation. (Well almost - there is a very basic AbstractQueue<E> class that provides a minimal implementation of the element() and remove() methods, but is otherwise essentially non-functional).

For this assignment, you will create an implementation of the Queue<E> interface in a class called DoublyLinkedQueue<E>. The UML class diagram for the related classes is shown below.

Procedure

Create a class called DoublyLinkedQueue<E> that implements the Queue<E> interface. Your class may not make use of any collection classes in the JCF such as ArrayList or LinkedList - you must implement the internal structure yourself. Internally, your class must store elements of the collection in a doubly linked list that you design and implement. Recall from the lectures that the elements within the linked list are objects of a nested Node<E> class. Re-read Chapter 7 of the textbook, and study the sample code from the in-class exercise from week 3 to re-acquaint yourself with the internal structure of both singly and doubly linked lists. Again, you'll be implementing a doubly linked list, but use caution: the JCF implementation of the doubly linked list is rather complex, so it is suggested that you base your doubly linked list as an extension of the singly linked list sample code.

Technical Note: In your research and review of existing code, you may run across an obscure feature of Java where you see that you can declare nested classes static. This does not mean all their methods are static, or that they cannot be instantiated - rather, it means you instantiate the inner classes independently of the main enclosing class. There is no associated outer class object. Such classes are often called nested static classes. Non-static inner class objects always have an associated outer class object.

Note that because Queue<E> inherits from Collection<E> (and Collection<E> inherits from Iterable<E>), your DoublyLinkedQueue<E> class must provide implementation of all behavior (i.e., methods) inherited from Collection<E>, Iterable<E>, and Queue<E>. However, you should provide "dummy" implementations for all of the methods defined in the Collection<E> and Iterable<E> interfaces, i.e., the only methods that you should implement "for real" are those from the Queue<E>, for the remainder, your implementation should just throw an UnsupportedOperationException.

Interim Time Report (due 11:00pm, the day prior to week 5 lab)

You must submit:

Note: Your final implementation must agree with this design and will constitute 25% of your grade.

You do not need to create an XML document for the interim report. Just submit the UML image as the report and the Java file as the supporting file.

In addition, you should indicate how much time you spend on this assignment in the FAST system. You are encouraged to log your activity as you work on the project. At a minimum, you should log all of the time spent during the first week before the due date given above.

Lab report (due 11:00pm, the day prior to week 6 lab)

Here is a template file to use as a starting point for this report.

Your report should include:

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the XML help video and/or sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost.

If you have any questions, consult your instructor.

Acknowledgment

This assignment was originally developed by Dr. Chris Taylor and Dr. Mark Hornick.