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 (rhowell@ksu.edu)
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the children of the tree.
    Returns the root of the tree.
    boolean
    Returns true if the tree is empty.
  • Method Details

    • getRoot

      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.
      Returns:
      the root of this tree
      Throws:
      EmptyTreeException - if the tree is empty.
      See Also:
    • getChildren

      TreeInterface[] getChildren() throws EmptyTreeException
      Returns the children of the tree. A null returned value is treated as equivalent to an array of length 0.
      Returns:
      an array containing the children of this tree
      Throws:
      EmptyTreeException - if the tree is empty.
    • isEmpty

      boolean isEmpty()
      Returns true if the tree is empty.
      Returns:
      whether this tree is empty