Package de.alpharogroup.swing.tree.model
Class AbstractGenericTreeNode<T>
- java.lang.Object
-
- de.alpharogroup.swing.tree.model.AbstractGenericTreeNode<T>
-
-
Constructor Summary
Constructors Constructor Description AbstractGenericTreeNode()
Instantiates a new tree node.AbstractGenericTreeNode(T value)
Instantiates a new tree node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(ITreeNode<T> child)
Adds the child.void
addChildAt(int index, ITreeNode<T> child)
Adds the child.boolean
equals(ITreeNode<T> treeNode)
Equals.int
getChildCount()
Gets the child count.java.util.List<ITreeNode<T>>
getChildren()
Gets the children.T
getValue()
Gets the value.boolean
hasChildren()
(non-Javadoc).int
hashCode()
(non-Javadoc).boolean
isLeaf()
(non-Javadoc).boolean
isNode()
(non-Javadoc).void
removeChild(ITreeNode<T> child)
Removes the child.void
removeChildAt(int index)
Removes the child.void
setChildren(java.util.List<ITreeNode<T>> children)
Sets the children.void
setValue(T value)
Sets the value.java.util.List<ITreeNode<T>>
toList()
To list.void
traverse(ITreeNode<T> node, java.util.List<ITreeNode<T>> list)
Traverse.
-
-
-
Constructor Detail
-
AbstractGenericTreeNode
public AbstractGenericTreeNode()
Instantiates a new tree node.
-
AbstractGenericTreeNode
public AbstractGenericTreeNode(T value)
Instantiates a new tree node.- Parameters:
value
- the value
-
-
Method Detail
-
addChildAt
public void addChildAt(int index, ITreeNode<T> child) throws java.lang.IndexOutOfBoundsException
Adds the child.- Specified by:
addChildAt
in interfaceITreeNode<T>
- Parameters:
index
- the indexchild
- the child- Throws:
java.lang.IndexOutOfBoundsException
- the index out of bounds exception
-
getChildCount
public int getChildCount()
Gets the child count.- Specified by:
getChildCount
in interfaceITreeNode<T>
- Returns:
- the child count
-
getChildren
public java.util.List<ITreeNode<T>> getChildren()
Gets the children.- Specified by:
getChildren
in interfaceITreeNode<T>
- Returns:
- the children
-
getValue
public T getValue()
Gets the value.
-
hasChildren
public boolean hasChildren()
(non-Javadoc).- Specified by:
hasChildren
in interfaceITreeNode<T>
- Returns:
- true, if successful
- See Also:
ITreeNode.hasChildren()
-
hashCode
public int hashCode()
(non-Javadoc).- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- the int
- See Also:
Object.hashCode()
-
isLeaf
public boolean isLeaf()
(non-Javadoc).- Specified by:
isLeaf
in interfaceITreeNode<T>
- Returns:
- true, if is leaf
- See Also:
ITreeNode.isLeaf()
-
isNode
public boolean isNode()
(non-Javadoc).- Specified by:
isNode
in interfaceITreeNode<T>
- Returns:
- true, if is node
- See Also:
ITreeNode.isNode()
-
removeChild
public void removeChild(ITreeNode<T> child)
Removes the child.- Specified by:
removeChild
in interfaceITreeNode<T>
- Parameters:
child
- the child
-
removeChildAt
public void removeChildAt(int index) throws java.lang.IndexOutOfBoundsException
Removes the child.- Specified by:
removeChildAt
in interfaceITreeNode<T>
- Parameters:
index
- the index- Throws:
java.lang.IndexOutOfBoundsException
- the index out of bounds exception
-
setChildren
public void setChildren(java.util.List<ITreeNode<T>> children)
Sets the children.- Specified by:
setChildren
in interfaceITreeNode<T>
- Parameters:
children
- the new children
-
setValue
public void setValue(T value)
Sets the value.
-
-