Package com.microstrategy.utils
Class GenericTreeNodeImpl<T>
- java.lang.Object
-
- com.microstrategy.utils.GenericTreeNodeImpl<T>
-
- All Implemented Interfaces:
GenericTreeNode<T>
- Direct Known Subclasses:
MutableTreeNodeImpl
public class GenericTreeNodeImpl<T> extends java.lang.Object implements GenericTreeNode<T>
This class represents a generic node in an ordered tree data structure. It is not a changeable ("mutable") tree node, however. To modify a tree node, you need aMutableTreeNodeImplclass (which implements theMutableTreeNodeinterface). This class and its subclasses are not synchronized.- Since:
- MicroStrategy Web 9.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<GenericTreeNode<T>>childrenstatic java.util.Enumeration<java.lang.Object>EMPTY_ENUMERATIONAn enumeration that is always empty.protected java.lang.Stringnameprotected GenericTreeNode<T>parentprotected Tvalue
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidensureChildren()Ensure that we have space to hold children.intgetChildCount()Returns the number of children for this node.java.util.Enumeration<GenericTreeNode<T>>getChildren()Returns the enumeration of children for this node.java.lang.StringgetName()Returns the name associated with this node, if any.GenericTreeNode<T>getParent()Returns the parent of this node.TgetValue()Returns the value associated with this node, if any.protected booleanisNodeAncestor(GenericTreeNode<T> treeNode)Returns whether the supplied node is an ancestor of this node.protected booleanisNodeChild(GenericTreeNode<T> treeNode)Returns whether the specified GenericTreeNode is a child of this node.
-
-
-
Field Detail
-
EMPTY_ENUMERATION
public static final java.util.Enumeration<java.lang.Object> EMPTY_ENUMERATION
An enumeration that is always empty. This is used when an enumeration of a leaf node's children is requested.
-
parent
protected GenericTreeNode<T> parent
-
children
protected java.util.List<GenericTreeNode<T>> children
-
name
protected java.lang.String name
-
value
protected T value
-
-
Method Detail
-
getParent
public GenericTreeNode<T> getParent()
Returns the parent of this node.- Specified by:
getParentin interfaceGenericTreeNode<T>- Returns:
- The
GenericTreeNodewhich is the parent of this node, if any.
-
getName
public java.lang.String getName()
Description copied from interface:GenericTreeNodeReturns the name associated with this node, if any.- Specified by:
getNamein interfaceGenericTreeNode<T>- Returns:
- The name associated with this node, if any.
-
getValue
public T getValue()
Description copied from interface:GenericTreeNodeReturns the value associated with this node, if any.- Specified by:
getValuein interfaceGenericTreeNode<T>- Returns:
- The value associated with this node, if any.
-
getChildren
public java.util.Enumeration<GenericTreeNode<T>> getChildren()
Description copied from interface:GenericTreeNodeReturns the enumeration of children for this node. It will always return a non-null Enumeration, though it may be empty.- Specified by:
getChildrenin interfaceGenericTreeNode<T>- Returns:
- The
Enumerationof children.
-
getChildCount
public int getChildCount()
Description copied from interface:GenericTreeNodeReturns the number of children for this node.- Specified by:
getChildCountin interfaceGenericTreeNode<T>- Returns:
- The number of children for this node.
-
isNodeChild
protected boolean isNodeChild(GenericTreeNode<T> treeNode)
Returns whether the specified GenericTreeNode is a child of this node.- Parameters:
treeNode- TheGenericTreeNodeto examine.- Returns:
- True, if the specified node is a child of this node.
-
isNodeAncestor
protected boolean isNodeAncestor(GenericTreeNode<T> treeNode)
Returns whether the supplied node is an ancestor of this node.- Parameters:
treeNode- The node to examine.- Returns:
- True, if the node is an ancestor of this node; otherwise, false.
-
ensureChildren
protected void ensureChildren()
Ensure that we have space to hold children.
-
-