Package com.microstrategy.utils
Class MutableTreeNodeImpl<T>
- java.lang.Object
-
- com.microstrategy.utils.GenericTreeNodeImpl<T>
-
- com.microstrategy.utils.MutableTreeNodeImpl<T>
-
- All Implemented Interfaces:
GenericTreeNode<T>
,MutableTreeNode<T>
public class MutableTreeNodeImpl<T> extends GenericTreeNodeImpl<T> implements MutableTreeNode<T>
This is a mutable (changeable) Tree Node.- Since:
- MicroStrategy Web 9.0.0
-
-
Field Summary
-
Fields inherited from class com.microstrategy.utils.GenericTreeNodeImpl
children, EMPTY_ENUMERATION, name, parent, value
-
-
Constructor Summary
Constructors Constructor Description MutableTreeNodeImpl()
Creates a new MutableTreeNodeImpl object.MutableTreeNodeImpl(java.lang.String name)
Creates a new MutableTreeNodeImpl object.MutableTreeNodeImpl(java.lang.String name, T value)
Creates a new MutableTreeNodeImpl object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(MutableTreeNode<T> treeNode)
Adds a node to the end of a list of children of this node.void
add(MutableTreeNode<T> treeNode, int index)
Adds a node as a child of this node at a specified position.MutableTreeNode<T>
remove(int index)
Removes a child at a specific index.void
remove(MutableTreeNode<T> treeNode)
Removes a specific GenericTreeNode from the list of children.void
setName(java.lang.String name)
Sets the name associated with this node.void
setValue(T value)
Sets the value associated with this node.-
Methods inherited from class com.microstrategy.utils.GenericTreeNodeImpl
ensureChildren, getChildCount, getChildren, getName, getParent, getValue, isNodeAncestor, isNodeChild
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.microstrategy.utils.GenericTreeNode
getChildCount, getChildren, getName, getParent, getValue
-
-
-
-
Constructor Detail
-
MutableTreeNodeImpl
public MutableTreeNodeImpl()
Creates a new MutableTreeNodeImpl object. Both the name and value are left undefined.
-
MutableTreeNodeImpl
public MutableTreeNodeImpl(java.lang.String name)
Creates a new MutableTreeNodeImpl object. The name is defined here, but the value is not.- Parameters:
name
- The name of the node.
-
MutableTreeNodeImpl
public MutableTreeNodeImpl(java.lang.String name, T value)
Creates a new MutableTreeNodeImpl object. Both the name and value are specified.- Parameters:
name
- The name of the node.value
- The value of the node.
-
-
Method Detail
-
setName
public void setName(java.lang.String name)
Description copied from interface:MutableTreeNode
Sets the name associated with this node.- Specified by:
setName
in interfaceMutableTreeNode<T>
- Parameters:
name
- The name to associate with this node.
-
setValue
public void setValue(T value)
Description copied from interface:MutableTreeNode
Sets the value associated with this node.- Specified by:
setValue
in interfaceMutableTreeNode<T>
- Parameters:
value
- The value to associate with this node.
-
add
public void add(MutableTreeNode<T> treeNode)
Description copied from interface:MutableTreeNode
Adds a node to the end of a list of children of this node. This is merely a shortcut to using the full version of this method#add(GenericTreeNode, int)
See it for more details.- Specified by:
add
in interfaceMutableTreeNode<T>
- Parameters:
treeNode
- TheMutableTreeNode
to add.- See Also:
MutableTreeNode.add(MutableTreeNode, int)
-
add
public void add(MutableTreeNode<T> treeNode, int index) throws java.lang.IllegalArgumentException, java.lang.ArrayIndexOutOfBoundsException
Description copied from interface:MutableTreeNode
Adds a node as a child of this node at a specified position.- Specified by:
add
in interfaceMutableTreeNode<T>
- Parameters:
treeNode
- TheMutableTreeNode
to add.index
- The position in the children list to add into.- Throws:
java.lang.IllegalArgumentException
- If the 'treeNode' parameter is null or is an ancestor of this node.java.lang.ArrayIndexOutOfBoundsException
- If the 'index' parameter is less than 0 or greater than the number of children currently in the list.
-
remove
public void remove(MutableTreeNode<T> treeNode) throws java.lang.IllegalArgumentException
Description copied from interface:MutableTreeNode
Removes a specific GenericTreeNode from the list of children.- Specified by:
remove
in interfaceMutableTreeNode<T>
- Parameters:
treeNode
- TheMutableTreeNode
to remove.- Throws:
java.lang.IllegalArgumentException
- If 'treeNode' is either null or NOT a child of this node.
-
remove
public MutableTreeNode<T> remove(int index) throws java.lang.ArrayIndexOutOfBoundsException
Description copied from interface:MutableTreeNode
Removes a child at a specific index.- Specified by:
remove
in interfaceMutableTreeNode<T>
- Parameters:
index
- The index of the child to remove.- Returns:
- The
MutableTreeNode
removed by this operation. - Throws:
java.lang.ArrayIndexOutOfBoundsException
- If the index is less than 0 or greater than or equal to the number of children currently in the list.
-
-