Package com.helger.tree
Interface ITreeItem<DATATYPE,ITEMTYPE extends ITreeItem<DATATYPE,ITEMTYPE>>
-
- Type Parameters:
DATATYPE- tree item value typeITEMTYPE- tree item implementation type
- All Superinterfaces:
IBasicTreeItem<DATATYPE,ITEMTYPE>,com.helger.commons.traits.IGenericImplTrait<ITEMTYPE>,com.helger.commons.hierarchy.IHasChildren<ITEMTYPE>,com.helger.commons.hierarchy.IHasChildrenRecursive<ITEMTYPE>,com.helger.commons.hierarchy.IHasChildrenSorted<ITEMTYPE>,com.helger.commons.hierarchy.IHasParent<ITEMTYPE>
- All Known Implementing Classes:
BasicTreeItem,DefaultTreeItem
public interface ITreeItem<DATATYPE,ITEMTYPE extends ITreeItem<DATATYPE,ITEMTYPE>> extends IBasicTreeItem<DATATYPE,ITEMTYPE>
Base interface for simple tree items- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ITEMTYPEcreateChildItem(DATATYPE aData)Add a child item to this item.ITreeItemFactory<DATATYPE,ITEMTYPE>getFactory()com.helger.commons.state.EChangeinternalAddChild(ITEMTYPE aChild)Add an existing child to this tree item.com.helger.commons.state.EChangeremoveChild(ITEMTYPE aChild)Remove the passed node as a child node from this node.voidreorderChildItems(Comparator<? super ITEMTYPE> aComparator)Reorder the child items based on the item itself.-
Methods inherited from interface com.helger.tree.IBasicTreeItem
changeParent, getAllChildDatas, getData, getLevel, getParentData, isRootItem, isSameOrChildOf, setData
-
Methods inherited from interface com.helger.commons.hierarchy.IHasChildren
forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getChildCount, getChildren, hasChildren, hasNoChildren
-
Methods inherited from interface com.helger.commons.hierarchy.IHasChildrenRecursive
forAllChildrenRecursive, forAllChildrenRecursive
-
-
-
-
Method Detail
-
getFactory
@Nonnull ITreeItemFactory<DATATYPE,ITEMTYPE> getFactory()
- Returns:
- The factory used to create instances of this interface.
-
internalAddChild
@Nonnull com.helger.commons.state.EChange internalAddChild(@Nonnull ITEMTYPE aChild)
Add an existing child to this tree item. Use only internally!- Parameters:
aChild- The child to be added. May not benull.- Returns:
EChange.UNCHANGEDif the child is already contained,EChange.CHANGEDupon success.
-
createChildItem
@Nonnull ITEMTYPE createChildItem(@Nullable DATATYPE aData)
Add a child item to this item.- Parameters:
aData- the data associated with this item- Returns:
- the created TreeItem object
-
removeChild
@Nonnull com.helger.commons.state.EChange removeChild(@Nonnull ITEMTYPE aChild)
Remove the passed node as a child node from this node.- Parameters:
aChild- The child to be removed. May not benull.- Returns:
EChange.CHANGEDif the removal succeeded,EChange.UNCHANGEDotherwise
-
reorderChildItems
void reorderChildItems(@Nonnull Comparator<? super ITEMTYPE> aComparator)
Reorder the child items based on the item itself.- Parameters:
aComparator- The comparator use. May not benull.
-
-