Package com.helger.tree.withid
Class BasicTreeWithID<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>
- java.lang.Object
-
- com.helger.tree.withid.BasicTreeWithID<KEYTYPE,DATATYPE,ITEMTYPE>
-
- Type Parameters:
KEYTYPE- tree item key typeDATATYPE- tree item value typeITEMTYPE- tree item implementation type
- All Implemented Interfaces:
com.helger.commons.hierarchy.IHasChildren<ITEMTYPE>,IBasicTree<DATATYPE,ITEMTYPE>,ITreeWithID<KEYTYPE,DATATYPE,ITEMTYPE>
- Direct Known Subclasses:
BasicTreeWithGlobalUniqueID,DefaultTreeWithID
@NotThreadSafe public class BasicTreeWithID<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>> extends Object implements ITreeWithID<KEYTYPE,DATATYPE,ITEMTYPE>
Base class for a tree having items with IDs. This implementation is independent of the item implementation class. The elements of the tree are not sorted by any means.- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description BasicTreeWithID(ITreeItemWithIDFactory<KEYTYPE,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
-
BasicTreeWithID
public BasicTreeWithID(@Nonnull ITreeItemWithIDFactory<KEYTYPE,DATATYPE,ITEMTYPE> aFactory)
-
-
Method Detail
-
hasChildren
public final boolean hasChildren()
- Specified by:
hasChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<KEYTYPE>
-
getChildCount
@Nonnegative public final int getChildCount()
- Specified by:
getChildCountin interfacecom.helger.commons.hierarchy.IHasChildren<KEYTYPE>
-
getAllChildren
@Nonnull @ReturnsMutableCopy public final com.helger.commons.collection.impl.ICommonsCollection<ITEMTYPE> getAllChildren()
- Specified by:
getAllChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<KEYTYPE>
-
getChildren
@Nonnull public final com.helger.commons.collection.impl.ICommonsIterable<ITEMTYPE> getChildren()
- Specified by:
getChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<KEYTYPE>
-
forAllChildren
public final void forAllChildren(@Nonnull Consumer<? super ITEMTYPE> aConsumer)
- Specified by:
forAllChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<KEYTYPE>
-
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<KEYTYPE>
-
forAllChildren
public final void forAllChildren(@Nonnull Predicate<? super ITEMTYPE> aFilter, @Nonnull Consumer<? super ITEMTYPE> aConsumer)
- Specified by:
forAllChildrenin interfacecom.helger.commons.hierarchy.IHasChildren<KEYTYPE>
-
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<KEYTYPE>
-
getRootItem
@Nonnull public final ITEMTYPE getRootItem()
- Specified by:
getRootItemin interfaceIBasicTree<KEYTYPE,DATATYPE>- 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.
-
-