Fifth Assignment: A Binary Tree Editor
Dave Matuszek, Spring 2003

Purpose of the assignment:

The basic idea:

Implement a binary tree ADT. Then (in a separate class) design and implement a binary tree editor.

class BinaryTree

In this part of the assignment you implement a BinaryTree class. The design (and a lot of the implementation) has been done for you in my Binary Tree ADT lecture; your task is to complete the implementation. Be sure the class is well-commented (with javadoc comments) and bulletproof--that is, there is no way that we can cause your BinaryTree to crash or become invalid. We will try to break your code.



Getters and setters:

Other methods:

class BinaryTreeEditor

This is the challenging part. Your job is to design and implement a GUI-based editor for BinaryTrees. Your editor must be able to read, edit, and save binary trees.

The value of a node in a BinaryTree may be any kind of Object. Since you cannot easily create arbitrary objects from a GUI interface, you can assume (in your BinaryTreeEditor) that all values in the BinaryTree will be of type String. You should not assume this in the BinaryTree class.

A significant part of your grade will be based on how intuitive (easy to figure out) your editor is, and how convenient it is to use for some tasks that we will attempt. One or more of the tasks will be rearranging large parts of the binary tree (for example, take this entire subtree and move it over to here).

Although you cannot share code (all programming must be your own), I strongly encourage you to get together with one or more other students and try out one another's GUIs. This is the simplest and best way to discover what is confusing or hard to use about your interface. Do this as early as possible so that you have time to make any needed changes. You may borrow ideas (but not code) from other people's interfaces.

Optional: Because some binary trees are defined to have values only in their leaves, you could have a setting that will ensure all non-leaf nodes have null in their value fields. If you do, be sure that your code is bulletproof and that you don't throw away any values without first checking with the user. This part is optional (for extra credit) because I think it might turn out to be difficult to do in a way that protects the data.

Due date: Thursday, March 20.