CHILD
- is the generic type of the children
.PARENT
- is the generic type of the parent
.public interface GenericTreeNode<CHILD extends Node<PARENT>,PARENT extends GenericTreeNode<CHILD,PARENT>> extends Node<PARENT>
node
in the tree that has no parent
. GenericTreeNode
is generic and allows different types for <CHILD> and <PARENT> (e.g.
to implement a folder that can only have a folder as parent but can have any resource as
child that is of type folder or file). For a regular simple tree node you can use TreeNode
.Modifier and Type | Method and Description |
---|---|
List<? extends CHILD> |
getChildren()
This method gets the
List containing all children of this GenericTreeNode . |
PARENT |
getParent()
This method gets the parent of this
GenericTreeNode . |
boolean |
isAncestor(PARENT node)
This method determines if this
GenericTreeNode is an ancestor of the given node . |
boolean |
isDescendant(CHILD node)
This method determines if this
GenericTreeNode is a descendant of the given node . |
PARENT getParent()
GenericTreeNode
.getParent
in interface Node<PARENT extends GenericTreeNode<CHILD,PARENT>>
GenericTreeNode
or null
if this is the root- GenericTreeNode
.List<? extends CHILD> getChildren()
List
containing all children of this GenericTreeNode
. The List
may be
empty
- in such case we call this GenericTreeNode
a leaf . Each item of the
returned List
is called a child or child-node. It should return this
GenericTreeNode
as parent
.List
containing all children of this GenericTreeNode
.boolean isDescendant(CHILD node)
GenericTreeNode
is a descendant of the given node
. In other words
this method checks if this GenericTreeNode
is the direct or indirect child
of the
given node
.node
- is the GenericTreeNode
to check (the potential ancestor
).true
if this GenericTreeNode
is an descendant of the given node
.boolean isAncestor(PARENT node)
GenericTreeNode
is an ancestor of the given node
. In other words
this method checks if this GenericTreeNode
is the direct or indirect parent
of the
given node
.node
- is the GenericTreeNode
to check (the potential descendant
).true
if this GenericTreeNode
is an ancestor of the given node
.Copyright © 2001–2016 mmm-Team. All rights reserved.