Package 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 (rhowell@ksu.edu)
- See Also:
-
Method Details
-
getRoot
Returns the root of the tree. TheTreeDrawing
class converts the returnedObject
to aString
. In order to control how this conversion is done, itstoString
method may be overridden.- Returns:
- the root of this tree
- Throws:
EmptyTreeException
- if the tree is empty.- See Also:
-
getChildren
Returns the children of the tree. Anull
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()Returnstrue
if the tree is empty.- Returns:
- whether this tree is empty
-