edu.ksu.cis.viewer
Interface TreeInterface

All Known Implementing Classes:
PatriciaTrie, Trie

public interface TreeInterface

This interface may be implemented by a tree in order to allow a TreeDrawing to be constructed from the tree. Empty trees may be represented either by null references or by objects whose isEmpty methods return true. If null references are used, isEmpty should always return false.

Author:
Rod Howell (howell@cis.ksu.edu)
See Also:
TreeDrawing

Method Summary
 TreeInterface[] getChildren()
          Returns the children of the tree.
 Object getRoot()
          Returns the root of the tree.
 boolean isEmpty()
          Returns true if the tree is empty.
 

Method Detail

getRoot

public Object getRoot()
               throws EmptyTreeException
Returns the root of the tree. The TreeDrawing class converts the returned Object to a String. In order to control how this conversion is done, its toString method may be overridden.

Throws:
EmptyTreeException - if the tree is empty.
See Also:
Object.toString()

getChildren

public TreeInterface[] getChildren()
                            throws EmptyTreeException
Returns the children of the tree. A null returned value is treated as equivalent to an array of length 0.

Throws:
EmptyTreeException - if the tree is empty.

isEmpty

public boolean isEmpty()
Returns true if the tree is empty.