Package com.helger.tree.withid.unique
Interface ITreeWithGlobalUniqueID<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>
-
- Type Parameters:
KEYTYPE- The type of the key elements for the tree. This is typically String.DATATYPE- The type of the elements contained in the tree. This is the generic type to be stored in the tree.ITEMTYPE- The type of the tree item that will be stored in this tree.
- All Superinterfaces:
IBasicTree<DATATYPE,ITEMTYPE>,com.helger.commons.hierarchy.IChildrenProvider<ITEMTYPE>,com.helger.commons.hierarchy.IChildrenProviderWithID<KEYTYPE,ITEMTYPE>,com.helger.commons.hierarchy.IHasChildren<ITEMTYPE>,ITreeWithID<KEYTYPE,DATATYPE,ITEMTYPE>
- All Known Subinterfaces:
IFolderTree<KEYTYPE,DATATYPE,COLLTYPE,ITEMTYPE>,ITreeWithUniqueIDProxy<KEYTYPE,VALUETYPE>
- All Known Implementing Classes:
AbstractGlobalSingletonTreeWithUniqueID,AbstractRequestSingletonTreeWithUniqueID,AbstractSessionSingletonTreeWithUniqueID,BasicFolderTree,BasicTreeWithGlobalUniqueID,DefaultFolderTree,DefaultTreeWithGlobalUniqueID,FileSystemFolderTree
public interface ITreeWithGlobalUniqueID<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>> extends ITreeWithID<KEYTYPE,DATATYPE,ITEMTYPE>, com.helger.commons.hierarchy.IChildrenProviderWithID<KEYTYPE,ITEMTYPE>
A specialized version of the tree, where each item is required to have a unique ID so that item searching can be performed with little runtime effort.- Author:
- Philip Helger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontainsItemWithID(KEYTYPE aDataID)Check if a tree item corresponding to the given ID is present.com.helger.commons.collection.impl.ICommonsCollection<DATATYPE>getAllItemDatas()com.helger.commons.collection.impl.ICommonsCollection<ITEMTYPE>getAllItems()intgetItemCount()DATATYPEgetItemDataWithID(KEYTYPE aDataID)Get the data of the tree item that corresponds to the given ID.ITEMTYPEgetItemWithID(KEYTYPE aDataID)Get theITreeItemWithIDthat corresponds to the given ID.booleanisItemSameOrDescendant(KEYTYPE aParentItemID, KEYTYPE aChildItemID)Check if one item is equal or a child of the other item.com.helger.commons.state.EChangeremoveItemWithID(KEYTYPE aDataID)Remove the item with the specified ID-
Methods inherited from interface com.helger.tree.IBasicTree
getRootItem
-
Methods inherited from interface com.helger.commons.hierarchy.IChildrenProvider
getAllChildren, getChildCount, hasChildren, hasNoChildren
-
-
-
-
Method Detail
-
containsItemWithID
boolean containsItemWithID(@Nullable KEYTYPE aDataID)
Check if a tree item corresponding to the given ID is present.- Parameters:
aDataID- The ID of the tree item to search.- Returns:
trueif such an item is present
-
getItemWithID
@Nullable ITEMTYPE getItemWithID(@Nullable KEYTYPE aDataID)
Get theITreeItemWithIDthat corresponds to the given ID.- Parameters:
aDataID- The ID of the tree item to search.- Returns:
nullif no such tree item exists.
-
getItemDataWithID
@Nullable DATATYPE getItemDataWithID(@Nullable KEYTYPE aDataID)
Get the data of the tree item that corresponds to the given ID.- Parameters:
aDataID- The ID of the tree item to search.- Returns:
nullif no such tree item exists.
-
getItemCount
@Nonnegative int getItemCount()
- Returns:
- The number of all contained items. Always ≥ 0.
-
getAllItems
@Nonnull com.helger.commons.collection.impl.ICommonsCollection<ITEMTYPE> getAllItems()
- Returns:
- A non-
nullcollection of all items.
-
getAllItemDatas
@Nonnull com.helger.commons.collection.impl.ICommonsCollection<DATATYPE> getAllItemDatas()
- Returns:
- A non-
nullcollection of all item datas.
-
removeItemWithID
@Nonnull com.helger.commons.state.EChange removeItemWithID(@Nullable KEYTYPE aDataID)
Remove the item with the specified ID- Parameters:
aDataID- The ID of the item to be removed- Returns:
EChange.CHANGEDif the item was removed,EChange.UNCHANGEDotherwise. Nevernull.
-
isItemSameOrDescendant
boolean isItemSameOrDescendant(@Nullable KEYTYPE aParentItemID, @Nullable KEYTYPE aChildItemID)
Check if one item is equal or a child of the other item. This relationship is checked not only for direct children but for all levels.- Parameters:
aParentItemID- The parent item ID to a validate.aChildItemID- The item ID to check whether it is a child of the passed parent folder.- Returns:
trueif the child item is the same or a child of the parent item,falseif one of the IDs could not be resolved or they are not in a parent-child-relationship.
-
-