com.discoversites.util.collections.tree.set
Class SetTreeRoot<T>

java.lang.Object
  extended by com.discoversites.util.collections.tree.set.SetTreeNode<T>
      extended by com.discoversites.util.collections.tree.set.SetTreeRoot<T>
Type Parameters:
T - The type of element to be stored in the SetTreeRoot
All Implemented Interfaces:
TreeNode<T>, TreeRoot<T>, Serializable

public class SetTreeRoot<T>
extends SetTreeNode<T>
implements TreeRoot<T>

Implementation of TreeRoot backed by an HashSet (actually a LinkedHashSet to maintain insertion order).

Author:
Mark
See Also:
Serialized Form

Constructor Summary
SetTreeRoot(SetTree<T> parentTree)
           
 
Method Summary
 int getDepth()
           
 TreeNode<T> getParent()
           
 SetTree<T> getTree()
           
 boolean isRoot()
           
 
Methods inherited from class com.discoversites.util.collections.tree.set.SetTreeNode
addAll, addElement, addNode, addNode, equals, getChildren, getElement, getRoot, getSiblings, hashCode, isLeaf, notifyElement, removeNode, setElement, setElementNotAware
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.discoversites.util.collections.tree.TreeNode
addAll, addElement, addNode, addNode, getChildren, getElement, getRoot, getSiblings, isLeaf, removeNode, setElement
 

Constructor Detail

SetTreeRoot

public SetTreeRoot(SetTree<T> parentTree)
Parameters:
parentTree - The parent SetTree object that this root node belongs to.
Method Detail

isRoot

public boolean isRoot()
Specified by:
isRoot in interface TreeNode<T>
Overrides:
isRoot in class SetTreeNode<T>
Returns:
True if this is a root node (i.e. it has no parents), false otherwise.

getTree

public SetTree<T> getTree()
Specified by:
getTree in interface TreeNode<T>
Overrides:
getTree in class SetTreeNode<T>
Returns:
The Tree that this node belongs to.

getParent

public TreeNode<T> getParent()
Specified by:
getParent in interface TreeNode<T>
Overrides:
getParent in class SetTreeNode<T>
Returns:
The parent node of this node.

getDepth

public int getDepth()
Specified by:
getDepth in interface TreeNode<T>
Overrides:
getDepth in class SetTreeNode<T>
Returns:
The depth (i.e. level) that this node occupies in it's parent Tree.