KEYTYPE - The key type.DATATYPE - The value type to be contained in tree items.ITEMTYPE - tree item type@NotThreadSafe public abstract class AbstractTreeItemWithUniqueIDFactory<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>> extends Object implements ITreeItemWithUniqueIDFactory<KEYTYPE,DATATYPE,ITEMTYPE>
| Constructor and Description |
|---|
AbstractTreeItemWithUniqueIDFactory() |
AbstractTreeItemWithUniqueIDFactory(Map<KEYTYPE,ITEMTYPE> aItemStore) |
| Modifier and Type | Method and Description |
|---|---|
protected ITEMTYPE |
addToItemStore(KEYTYPE aDataID,
ITEMTYPE aItem) |
boolean |
containsItemWithDataID(KEYTYPE aDataID)
Check if an item with the given ID is contained.
|
ITEMTYPE |
create(ITEMTYPE aParent,
KEYTYPE aDataID)
Create an object of the desired type.
|
boolean |
equals(Object o) |
List<DATATYPE> |
getAllItemDatas() |
List<ITEMTYPE> |
getAllItems() |
int |
getItemCount() |
ITEMTYPE |
getItemOfDataID(KEYTYPE aDataID)
Try to retrieve the stored item with the given ID.
|
int |
hashCode() |
protected abstract ITEMTYPE |
internalCreate(ITEMTYPE aParent,
KEYTYPE aDataID) |
protected KEYTYPE |
internalGetItemID(ITEMTYPE aItem)
Get the ID of the passed tree item to use for internal storage.
|
void |
onAddItem(ITEMTYPE aTreeItem)
To be called once a tree item is added to the owning tree.
|
void |
onRemoveItem(ITEMTYPE aTreeItem)
To be called once a tree item is removed from the owning tree.
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitcreateRoot@Nonnull protected final ITEMTYPE addToItemStore(@Nonnull KEYTYPE aDataID, @Nonnull ITEMTYPE aItem)
@Nonnull protected abstract ITEMTYPE internalCreate(@Nonnull ITEMTYPE aParent, @Nonnull KEYTYPE aDataID)
@Nonnull @OverrideOnDemand protected KEYTYPE internalGetItemID(@Nonnull ITEMTYPE aItem)
aItem - The item who's ID is to be resolved.@Nonnull public final ITEMTYPE create(@Nonnull ITEMTYPE aParent, @Nonnull KEYTYPE aDataID)
ITreeItemWithIDFactorycreate in interface IFactoryWithTwoParameters<ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>,KEYTYPE>create in interface IHierarchicalFactoryWithParameter<ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>,KEYTYPE>create in interface ITreeItemWithIDFactory<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>aParent - The parent item to use. May be null depending on the
implementation.aDataID - The parameter to be passed. May be null depending on
the implementation.null depending on the
implementation.public final void onRemoveItem(@Nonnull ITEMTYPE aTreeItem)
ITreeItemWithIDFactoryonRemoveItem in interface ITreeItemWithIDFactory<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>aTreeItem - The item that was removed.public final void onAddItem(@Nonnull ITEMTYPE aTreeItem)
ITreeItemWithIDFactoryonAddItem in interface ITreeItemWithIDFactory<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>aTreeItem - The item that was added.public final boolean containsItemWithDataID(@Nullable KEYTYPE aDataID)
ITreeItemWithUniqueIDFactorycontainsItemWithDataID in interface ITreeItemWithUniqueIDFactory<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>aDataID - The data ID to look up.true if such an item is contained, false
otherwise.@Nullable public final ITEMTYPE getItemOfDataID(@Nullable KEYTYPE aDataID)
ITreeItemWithUniqueIDFactorygetItemOfDataID in interface ITreeItemWithUniqueIDFactory<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>aDataID - The data ID to look up.null if no such item is contained, the item otherwise.@Nonnegative public final int getItemCount()
getItemCount in interface ITreeItemWithUniqueIDFactory<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>@Nonnull @ReturnsMutableCopy public final List<ITEMTYPE> getAllItems()
getAllItems in interface ITreeItemWithUniqueIDFactory<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>@Nonnull @ReturnsMutableCopy public final List<DATATYPE> getAllItemDatas()
getAllItemDatas in interface ITreeItemWithUniqueIDFactory<KEYTYPE,DATATYPE,ITEMTYPE extends ITreeItemWithID<KEYTYPE,DATATYPE,ITEMTYPE>>Copyright © 2014–2016 Philip Helger. All rights reserved.