Package com.helger.tree
Class BasicTree<DATATYPE,ITEMTYPE extends ITreeItem<DATATYPE,ITEMTYPE>>
- java.lang.Object
-
- com.helger.tree.BasicTree<DATATYPE,ITEMTYPE>
-
- Type Parameters:
DATATYPE- tree item value typeITEMTYPE- tree item implementation type
- All Implemented Interfaces:
com.helger.commons.hierarchy.IHasChildren<ITEMTYPE>,IBasicTree<DATATYPE,ITEMTYPE>,ITree<DATATYPE,ITEMTYPE>
- Direct Known Subclasses:
DefaultTree
@NotThreadSafe public class BasicTree<DATATYPE,ITEMTYPE extends ITreeItem<DATATYPE,ITEMTYPE>> extends Object implements ITree<DATATYPE,ITEMTYPE>
Root class for a simple tree. The elements of the tree are not sorted by any means.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description BasicTree(ITreeItemFactory<DATATYPE,ITEMTYPE> aFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)voidforAllChildren(Consumer<? super ITEMTYPE> aConsumer)voidforAllChildren(Predicate<? super ITEMTYPE> aFilter, Consumer<? super ITEMTYPE> aConsumer)com.helger.commons.state.EContinueforAllChildrenBreakable(Function<? super ITEMTYPE,com.helger.commons.state.EContinue> aConsumer)<DSTTYPE> voidforAllChildrenMapped(Predicate<? super ITEMTYPE> aFilter, Function<? super ITEMTYPE,? extends DSTTYPE> aMapper, Consumer<? super DSTTYPE> aConsumer)com.helger.commons.collection.impl.ICommonsCollection<ITEMTYPE>getAllChildren()intgetChildCount()com.helger.commons.collection.impl.ICommonsIterable<ITEMTYPE>getChildren()ITEMTYPEgetRootItem()booleanhasChildren()inthashCode()StringtoString()
-
-
-
Constructor Detail
-
BasicTree
public BasicTree(@Nonnull ITreeItemFactory<DATATYPE,ITEMTYPE> aFactory)
-
-
Method Detail
-
hasChildren
public final boolean hasChildren()
- Specified by:
hasChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<DATATYPE>
-
getChildCount
@Nonnegative public final int getChildCount()
- Specified by:
getChildCountin interfacecom.helger.commons.hierarchy.IHasChildren<DATATYPE>
-
getAllChildren
@Nonnull @ReturnsMutableCopy public final com.helger.commons.collection.impl.ICommonsCollection<ITEMTYPE> getAllChildren()
- Specified by:
getAllChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<DATATYPE>
-
getChildren
@Nonnull public final com.helger.commons.collection.impl.ICommonsIterable<ITEMTYPE> getChildren()
- Specified by:
getChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<DATATYPE>
-
forAllChildren
public final void forAllChildren(@Nonnull Consumer<? super ITEMTYPE> aConsumer)
- Specified by:
forAllChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<DATATYPE>
-
forAllChildrenBreakable
@Nonnull public final com.helger.commons.state.EContinue forAllChildrenBreakable(@Nonnull Function<? super ITEMTYPE,com.helger.commons.state.EContinue> aConsumer)
- Specified by:
forAllChildrenBreakablein interfacecom.helger.commons.hierarchy.IHasChildren<DATATYPE>
-
forAllChildren
public final void forAllChildren(@Nonnull Predicate<? super ITEMTYPE> aFilter, @Nonnull Consumer<? super ITEMTYPE> aConsumer)
- Specified by:
forAllChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<DATATYPE>
-
forAllChildrenMapped
public final <DSTTYPE> void forAllChildrenMapped(@Nonnull Predicate<? super ITEMTYPE> aFilter, @Nonnull Function<? super ITEMTYPE,? extends DSTTYPE> aMapper, @Nonnull Consumer<? super DSTTYPE> aConsumer)
- Specified by:
forAllChildrenMappedin interfacecom.helger.commons.hierarchy.IHasChildren<DATATYPE>
-
getRootItem
@Nonnull public final ITEMTYPE getRootItem()
- Specified by:
getRootItemin interfaceIBasicTree<DATATYPE,ITEMTYPE extends ITreeItem<DATATYPE,ITEMTYPE>>- Returns:
- The root item of the tree. Never
null. The root item should not be displayed but it is the parent node of all displayed root items and therefore cannot be removed.
-
-