[an error occurred while processing this directive]

Lab 6

CS 5631, Spring 2004
Due Tuesday, May 4 (20 points)


For this lab you are given working code for a flat low-level file system. This code can be found in the file BaseFileSystem.java, which is contained in the file ~gshute/public/file.jar. In this jar file, you will also find a skeleton file for the HierarchicalFileSystem class. You will implement the methods in this class to construct a hierachical file system that uses path names like the UNIX operating system.

Coding Suggestions

Start with the implementation of two private methods getTail() and getLastDirectory(). These methods break up an absolute path name into two parts: everything up to the last slash character in the path (which determines the last directory) and everything after the last slash (the tail). These methods can be used to simplify the implentation of the other methods.

The getLastDirectory() method is not trivial. You can save yourself a lot of time by giving it some careful thought before writing code. One approach is to think of an absolute path as a sequence of names separated by directory separator characters (slashes). From this viewpoint, the first name in an absolute path is always an empty string.

The class is set up with a main() method that you can use for initial testing. If you look over this code, you can find some examples showing how the underlying flat file system is accessed. After you have implemented the two private methods, you will need to implement the public methods. Then you can use the TestHFS class to make sure the public methods all work properly.

Class Documentation

Class documentation for all of the classes in this lab can be found here.

What to Turn In

Turn in copies of the following: [an error occurred while processing this directive]