Linked Lists, String Parsing, and File I/O.

This program is a registry system, which means it will store name value pairs in a file. When your program starts it will read from the file ( if it exists ), then it will read from stdin ( keyboard ), then it will write the current list state to the file.

This program uses a linked list to create what is called an associative array. Every node in your list have a single token Word that is the name, and some other Word ( possibly multiple tokens ) that is the value. The user may do the following: assign, delete, query, and print.

You may not have duplicate names in list, so if you try to insert a name value pair that the name already exists, update the value.

The Linked List

You need to create a linked list class. Don't forget that you are storing names and values, so the nodes will have two fields, one that is the sort key ( name ), and another that is just associated information ( value ).

Parsing the user input

Get the lines, then parse each one to figure out what operation needs to be done to the list. This should be a function, since it gets called multiple times from multiple input sources.

Here are the required operations and thier format in precedence order. The operations are mutually exclusive.

Storing/Restoring the registry

This program needs to retain the last stored values in a text file. It will use the same data format as the user input does, that way the same parsing code can be reused. You can read in a line at a time from the file, and pass it to your parsing function.

The filename will be the first argument to your program. You will write the contents to the same file that you read from. This will allow the file to preserve the list state between runs of the program. Reading input from this file is done before reading from stdin, and writing to it happens after we are done with input from stdin.

Program Notes

Here are some sample runs

This program is due August 4th.
It is worth 150 points.

useful Java API

The Goals