![]() |
Assignment 7Submission
RequirementsAs stated on the assignment handout, you must:
SuggestionsUpdated 07 Dec: Added Sorter and some minor changes to the other two classes, including extra tests in main to demonstrate the value of abstraction. Also posted non-generic versions of my classes. Clarified grading requirements that exceptions are acceptable instead of sorting mis-ordered input. Do this however you want, so long as it meets the requirements of the assignment. (See the assignment handout and the grading criteria, below, for more on this.) However, I recommend you create a Node class, with DataNode and IndexNode subclasses. A KeyedValue class can hold your key and value together in a single object. Then your five required methods would go in a fifth class. Here is my partial code for these classes.
Here is some sample output produced by the complete code. You can also see the generated JavaDoc pages.
Feel free to use this code however you like--as a framework or just for ideas. If you do adopt it and add to it, please keep the comments up-to-date. (Remove //comments that no longer apply, change the /** javadoc */ documentation if you change how a method works, etc.) Remember to add an As I'm still learning generics myself (new in Java 5.0), my code uses them a lot. You can learn more about generics in this Java tutorial thread. My code does include three warnings associated with trying to construct arrays with generics. After a few hours of research, I've discovered that this is largely unavoidable. (I also discovered that compiling java.util.PriorityQueue produces 25 warnings, and java.util.ArrayList produces 8 warnings. So this seems pretty common with Java 5.0.) This page sums up the basic issues at work here. If you find generics confusing, here are non-generic version of the above files with all generics removed (even for Comparable). This is what code looked like before Java 5.0. Notice that I maintained the abstraction in KeyedValue class--keys are stored as Comparables and values as Objects. This means the code is still reusable with data types other than Integers. (Note that I didn't bother to write reusable versions of the dataMerge and indexMerge methods though.) To use these files, they need to be renamed, removing the "ng" prefix.
My code also includes a few other idioms you may not have seen much, but that you should become familiar with. (You should be able to understand my code, even if you disagree with how I wrote it.) These include the Grading:Out of 100 points:
|
~ztomasze Index :
TA Details: ICS211:
Assignment 7 http://www2.hawaii.edu/~ztomasze |
Last Edited: 06 Dec 2006 ©2006 by Z. Tomaszewski. |