DATATYPE - Data type of the items.ITEMTYPE - tree item typepublic interface IBasicTreeItem<DATATYPE,ITEMTYPE extends IBasicTreeItem<DATATYPE,ITEMTYPE>>
extends com.helger.commons.hierarchy.IHasParent<ITEMTYPE>, com.helger.commons.hierarchy.IHasChildrenSorted<ITEMTYPE>, com.helger.commons.hierarchy.IHasChildrenRecursive<ITEMTYPE>, com.helger.commons.traits.IGenericImplTrait<ITEMTYPE>
| Modifier and Type | Method and Description |
|---|---|
com.helger.commons.state.ESuccess |
changeParent(ITEMTYPE aNewParent)
Change the parent node of this node to another node (subordination).
|
com.helger.commons.collection.impl.ICommonsList<DATATYPE> |
getAllChildDatas()
Get the data values of all contained children.
|
DATATYPE |
getData() |
int |
getLevel() |
DATATYPE |
getParentData() |
boolean |
isRootItem() |
boolean |
isSameOrChildOf(ITEMTYPE aParent)
Check if this item is the same or a child of the passed item.
|
void |
setData(DATATYPE aData)
Change the data associated with this node.
|
findFirstChild, findFirstChildMapped, getAllChildren, getChildAtIndex, getFirstChild, getLastChildforAllChildrenRecursive, forAllChildrenRecursive@Nullable DATATYPE getParentData()
null.
This is like a shortcut for getParent().getData() with
implicit null handling.@Nonnegative int getLevel()
@Nullable com.helger.commons.collection.impl.ICommonsList<DATATYPE> getAllChildDatas()
null if this item does not have children. Use
IHasChildren.hasChildren() to check for the existence.void setData(@Nullable DATATYPE aData)
aData - The data associated with this node. May be null.IllegalArgumentException - If the data is not valid (depending on any custom validator).boolean isRootItem()
true if this is the internal root item without a
parent, false if this is a public item.boolean isSameOrChildOf(@Nonnull ITEMTYPE aParent)
aParent - The parent item to check whether this is a child of it. May not be
null.true if this is the same or a child of
aParent.@Nonnull com.helger.commons.state.ESuccess changeParent(@Nonnull ITEMTYPE aNewParent)
aNewParent - The new parent to use. May not be null. To make it a
root item, pass the owning tree's root item.ESuccessCopyright © 2014–2021 Philip Helger. All rights reserved.