Statement of Completion

Overview

My basic design has merit but I do see room for improvement. My event handling became a little tiresome because I didn't know whether I was dealing with a node or an edge and had to explicitly check by using instanceof. Also I ended up having Edge implement Dragable, even though it's not really, so I could get the mouse pointer to change for free when hovering above the edge's weight. This was really just a temporary measure (looks good though). To fix this I would create a Visual interface to replace both Drawable and Dragable. This interface could include a method such as isDragable. Then I would capture the events in VisualCanvas or some superclass and forward them on to Node and Edge (since they would both implement Visual). I was trying to keep the interfaces small as that is a good rule of thumb. Still, the Visual interface would not have to be awfully large.

Also I would have liked to keep my original non graphical graph and algorithm implementations. Then subclass them to get the graphical varieties. However I realised too late that this might have been possible. It was too late to go back and rework.

Note that this assignment was implemented using the 1.1 event model.

Standard Part of Assignment

I have implemented all the functionality of the standard part of the assignment: graph editing and running of SPF algorithm.

Extra Features

Support single stepping of the SPF animation

I have not implemented this feature.

Single stepping for the SPF algorithm would not have been difficult to implement, but this is because of the nature of the algorithm. I could have defined a method step in ShortestPathAlgorithm and used it. However, a more extensible way to implement this would have been to use notification and suspend/resume on the algorithm thread. This would also have made it easier (possible?) to implement any other graph based algorithm. I wasn't happy to implement this feature using the first option, and didn't believe I would have time to implement using the second option, so I chose to concentrate on other extensions.

Support animation of a second graph based algorithm of your choice

I have not implemented this feature.

This feature would not be hard to implement and would involve creating a class Algorithm which all supported algorithms would inherit from. Hence, the reason I originally chose to bundle SPF in a class of it's own.

Some other interesting extension

I have implemented a few interesting extensions: I also started work on undo/redo but I didn't finish. I have included the classes I have written in my assignment.