HW 2 - Generic, Doubly Linked Lists


SETUP

Note that in this assignment, you should use the eclipse IDE. To start:



In HW 1 you defined methods for maniupuating a singly linked linked. Now we'll add methods to a doubly linked list manager class.

Examine the following 4 files:

Again, go through the code and read the documentation. You'll see that the AnimatedSpriteBuilder and WordBuilder classes both start applications that make use of GenericDoublyLinkedLists, but in different ways. AnimatedSpriteBuilder stores Image objects in the list while WordBuilder uses the list to store Characters. Try running each program. You'll see that each interface provides a means to manipulate the list managing class whose methods you'll define.

The point here is that a data structure can and should be built to manipulate different types of data in abstract ways.

The AnimatedSpriteBuilder program provides controls at the top for building and maniuplating a linked list of images representing an animation sequence. At the bottom, there are controls that can start an animation that uses these images. There are also controls for selecting either forward or backward circular iteration.

What's a circular iterator? In HW 1 we built iterators that would go through a linked list once and that's it. That's a disposable iterator. With a circular iterator, once the iterator reaches the last node in the list, it would go back to the beginning again. A reverse circular iterator would go in the opposite direction.

The WordBuilder program provides controls at the top for building and querying a linked list of Characters. At the bottom, while the list is being manipulated you can always see what toString and reverseToString methods produce. Note that the reverse version would start at the tail and go to the head, which is now possible since we are using a doubly linked list.


YOUR THREE ITERATORS

In HW 1 your list managing class had only one iterator, but this time we'll use three different ones. This means we have to define three inner classes that each implement Iterator. They are:


YOUR TEN METHODS

When we press buttons in the GUIs, AnimatedSpriteBuilder & WordBuilder call methods in a list to manipulate its contents in different ways. In addition to the three iterators we've discussed, you must define the following ten methods inside the GenericDoublyLinkedList class. NOTE: make sure you properly maintain your list's head, tail, and size variables as well as all nodes' next and previous links. A problem caused by an improper assignment in one of your methods may cascade problems to subsequent method calls that expose previously unseen errors.

Again, I can't stress it enough. Make sure you properly maintain all nexts & prevs for the nodes in your list. In addition, make sure your head and tail are properly managed. After calling your method, one should be able to manipulate the list in other ways. In other words, even if it appears your method produces the correct results, it shouldn't break the list for future operations.


BONUS - 25 points

25 points bonus will be awarded to students who make their own Sprite character animation. By this I mean make 10 images that together can be used to represent an animated action. The more creative/interesting/hilarious the better. Please do not skip the programming to work on this, this is just for fun. If you do this, I would recommend you make your sprites 64x64 pixels.



Handin Instructions



Grading

All assignment will be graded purely based on program performance. Submissions that do not compile will receive 0 points. Submissions that never produce correct results will receive 0 points. The TAs will test your submissions using various input, and grades will be awarded depending on how often your code produces the correct results.




SUNYSB CSWeb page created and maintained
by Richard McKenna