CS 334: Block Organization

Table of Contents

Introduction

In this assignment, you will implement the structure for a block that contains variable width records via the use of a slot array.

Preliminary Work

Begin by reading the description of file organization techniques in section 10.5 of the text book, focusing specifically on section 10.5.2.

For this assignment, you will be implementing the SlottedBlock class, which wraps around a disk Block. Specifically, you will implement the approach described in section 10.5.2.

You'll be coding in Java. You'll want to read about the IntBuffer class in particular, as well as System.arraycopy.

For IntBuffer, you'll only need two methods: get(int index) and put(int index, int i).

Getting Started

Start by grabbing the the project zip files and extract to a directory you have created. The project contains the following files, among others:

  • SlottedBlock.java: This is framework code for you to use as a starting point. You will likely want to add your own private variables and methods, but your public API should be precisely as specified. All the code that you write should go right in this file.
  • SPTester.java: These are block organization test programs. We'll run these programs against your code to see if you're getting the right output. But I'm only supplying a couple of tests, and I'm not supplying the correct output; we'll run more tests than these.

I've created a Makefile which will compile your code for you. At the terminal prompt, type:

make

and it will generate all the Java class files. To run the test program, type

java SPTester

These tests are not sufficient to see if your code is working properly. You will want to write more tests.

You can type

make clean

at a prompt to delete all of the class files.

Multiple parts

Part 1: Get the first two tests (i.e., test1 and test2) to run correctly.

Part 2: Get the rest of the methods implemented, and test them. Make sure to test edge cases (full block, empty block, all of that kind of thing); we will attempt to do so when grading.

Handing in Your Code

If you are working in a team, only one of you should submit the code. We will be grading anonymously, so leave your names off the file. If you need to make sure to grant credit to someone else, do so in a file called credits.txt; we will not look at this file until after we are done grading anonymously.

Zip up all of your code, and submit it via Moodle.

Good luck, have fun, and ask questions!