CMPS 340 Fall 2008
Programming Assignment #1: Bucket of Records
Due: Noon, Monday, September 22, 2008

As has been discussed in class, one way to organize a file of records is as a collection of buckets, each containing some records in a logically contiguous segment of the file. The logical ordering of the buckets may be described by references/pointers in the buckets themselves (possibly forming a linked list or a tree of buckets) or by some sort of index structure (such as a mapping that associates with each logical position the physical position of the corresponding bucket).

Given to you is an incomplete Java class, BucketOfRecords, each instance of which is intended to model a bucket of records that has been stored in primary memory. That is, you can think of an instance of this class as representing a bucket that has been placed into (or formed in) RAM for any of several possible purposes: to retrieve one or more of its records, to insert one or more new records, and/or to delete or replace one or more of its records. (In the case that any modifications are made to the bucket, the client's intent is probably to write it back to secondary storage shortly thereafter. But this is not your concern.)

Your task is to supply code necessary to complete the class so that it meets its specifications, as described in the pre- and post-conditions of its methods, which have been provided.

Following the approach we discussed in class (in which each piece of metadata stored in a bucket —including the record count and record lengths— was encoded using a single byte), you may write your code so that records are limited in length to 255 bytes and buckets are limited to holding at most 255 records.

This is not to say, however, that you must follow the approach we used in class. For example, you could choose to use record separators rather than record lengths. If you are sufficiently imaginative, you can even find an approach that makes it unnecessary to ever do any shifting of values within an array of bytes!

To make your job somewhat easier, three (complete) classes have been provided to you:

Submit your Java source code (for the class BucketOfRecords, and any other class you may have developed) via e-mail to your instructor at mccloske@cs.uofs.edu.

Be sure to include comments in your program that identify any known bugs and any persons who helped you in doing the assignment. Also make sure that your code (including comments) is formatted in an appropriate manner. In particular, no line of code (including comments) should extend beyond 80 characters and the indentation pattern of the code should be faithful to its hierarchical structure.