Lab 6: Auto Complete

Overview

This is the first week of a multi-week project. The project will allow you to integrate learning from throughout the freshman software development and data structures sequence. You will develop several data structures and analyze the advantages and disadvantages of each. The project will result in a user interface showing the results.

Assignment

Your program must have a user interface similar to the one shown here.

Auto Complete UI
Figure 1: Auto Complete UI

Users may type characters into search box. The list of matches below must be immediately after a letter is typed or deleted. In addition, the time required to find an exact match and all matches with the same prefix should be displayed in appropriate text boxes for both the sorted list and unsorted list data structures.

Details

AutoCompleter interface

You must create the AutoCompleter interface with the following methods:

Unsorted Collection Implementation

Implement the AutoCompleter interface using an unordered collection. Your class must have one private attribute: private final Collection<String> items that is assigned via a one-argument constructor. Note: the constructor should remove any strings in the collection passed to the constructor.

Sorted List Implementation

Implement the AutoCompleter interface using a sorted list. Your class must have at least the following private attribute: private final List<String> items that is assigned via a one-argument constructor. Recommendation: add the items in whatever order they are given, then ensure that items is sorted before searching for matches. Use Collections.binarySearch() in your implementations of exactMatch() and allMatches().

Exception Handling

If any problems are encountered with reading the input file with the word list, the program should display a useful error message to the console and terminate gracefully. The program should not crash or display any exceptions.

Just For Fun

Ambitious students may wish to:

Acknowledgment

This laboratory assignment, developed by Dr. Chris Taylor.