Class Tree
java.lang.Object
org.eclipse.nebula.widgets.nattable.columnCategories.Tree
- All Implemented Interfaces:
Serializable
Represents a Tree of Objects. The Tree is represented as a single rootElement
which points to a List<Node> of children.
Adapted from public domain code at http://sujitpal.blogspot.com/.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Find the Node in the tree containing the supplied data.Find a Node in a tree, containing the given dataReturn the root Node of the tree.booleanRemoves the node with the supplied node data.voidsetRootElement(Node rootElement) Set the root Element for the tree.toList()Returns the Tree as a List of Node objects.toString()Returns a String representation of the Tree.
-
Constructor Details
-
Tree
public Tree()Default ctor.
-
-
Method Details
-
getRootElement
Return the root Node of the tree.- Returns:
- the root element.
-
setRootElement
Set the root Element for the tree.- Parameters:
rootElement- the root element to set.
-
toList
Returns the Tree as a List of Node objects. The elements of the List are generated from a pre-order traversal of the tree.- Returns:
- a List<Node>.
-
toString
Returns a String representation of the Tree. The elements are generated from a pre-order traversal of the Tree. -
find
Find the Node in the tree containing the supplied data. Stops searching at the first match.- Parameters:
nodeData- the node data- Returns:
- matching Node if found, NULL otherwise
-
find
Find a Node in a tree, containing the given data- Parameters:
element- Node to start searching atnodeData- to search for- Returns:
- matching Node if found, NULL otherwise
-
clear
public void clear() -
remove
Removes the node with the supplied node data. Deletes the first matching node.- Parameters:
nodeData- the node data- Returns:
- TRUE if a node was found and removed
-