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 aMutableTreeNodeImpl
class (which implements theMutableTreeNode
interface). 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>>
children
static java.util.Enumeration<java.lang.Object>
EMPTY_ENUMERATION
An enumeration that is always empty.protected java.lang.String
name
protected GenericTreeNode<T>
parent
protected T
value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
ensureChildren()
Ensure that we have space to hold children.int
getChildCount()
Returns the number of children for this node.java.util.Enumeration<GenericTreeNode<T>>
getChildren()
Returns the enumeration of children for this node.java.lang.String
getName()
Returns the name associated with this node, if any.GenericTreeNode<T>
getParent()
Returns the parent of this node.T
getValue()
Returns the value associated with this node, if any.protected boolean
isNodeAncestor(GenericTreeNode<T> treeNode)
Returns whether the supplied node is an ancestor of this node.protected boolean
isNodeChild(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:
getParent
in interfaceGenericTreeNode<T>
- Returns:
- The
GenericTreeNode
which is the parent of this node, if any.
-
getName
public java.lang.String getName()
Description copied from interface:GenericTreeNode
Returns the name associated with this node, if any.- Specified by:
getName
in interfaceGenericTreeNode<T>
- Returns:
- The name associated with this node, if any.
-
getValue
public T getValue()
Description copied from interface:GenericTreeNode
Returns the value associated with this node, if any.- Specified by:
getValue
in interfaceGenericTreeNode<T>
- Returns:
- The value associated with this node, if any.
-
getChildren
public java.util.Enumeration<GenericTreeNode<T>> getChildren()
Description copied from interface:GenericTreeNode
Returns the enumeration of children for this node. It will always return a non-null Enumeration, though it may be empty.- Specified by:
getChildren
in interfaceGenericTreeNode<T>
- Returns:
- The
Enumeration
of children.
-
getChildCount
public int getChildCount()
Description copied from interface:GenericTreeNode
Returns the number of children for this node.- Specified by:
getChildCount
in 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
- TheGenericTreeNode
to 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.
-
-