Class DefaultHierarchyVisitorCallback<DATATYPE>
java.lang.Object
com.helger.commons.hierarchy.visit.DefaultHierarchyVisitorCallback<DATATYPE>
- Type Parameters:
DATATYPE- The type of object in the hierarchy to be iterated
- All Implemented Interfaces:
ICallback,IHierarchyVisitorCallback<DATATYPE>
public class DefaultHierarchyVisitorCallback<DATATYPE>
extends Object
implements IHierarchyVisitorCallback<DATATYPE>
The default implementation of the
IHierarchyVisitorCallback interface
doing nothing except counting levels.- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetLevel()onItemAfterChildren(DATATYPE aItem) Called after eventual children of the current item were visited.onItemBeforeChildren(DATATYPE aItem) Called before children of the current item are visited.voidCalled before the tree walker descends into the next tree level.voidCalled after the tree walker ascends into the previous tree level.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.helger.commons.hierarchy.visit.IHierarchyVisitorCallback
begin, end
-
Constructor Details
-
DefaultHierarchyVisitorCallback
public DefaultHierarchyVisitorCallback() -
DefaultHierarchyVisitorCallback
public DefaultHierarchyVisitorCallback(int nInitialLevel)
-
-
Method Details
-
getLevel
- Specified by:
getLevelin interfaceIHierarchyVisitorCallback<DATATYPE>- Returns:
- The level of the current node within the hierarchy. Always ≥ 0. The root item has level 0.
-
onLevelDown
Description copied from interface:IHierarchyVisitorCallbackCalled before the tree walker descends into the next tree level. After this callIHierarchyVisitorCallback.getLevel()should return a value increased by 1.- Specified by:
onLevelDownin interfaceIHierarchyVisitorCallback<DATATYPE>
-
onLevelUp
Description copied from interface:IHierarchyVisitorCallbackCalled after the tree walker ascends into the previous tree level. After this callIHierarchyVisitorCallback.getLevel()should return a value decreased by 1.- Specified by:
onLevelUpin interfaceIHierarchyVisitorCallback<DATATYPE>
-
onItemBeforeChildren
Description copied from interface:IHierarchyVisitorCallbackCalled before children of the current item are visited. This method is also to be called if no children are present at all.- Specified by:
onItemBeforeChildrenin interfaceIHierarchyVisitorCallback<DATATYPE>- Parameters:
aItem- The current item. May benull.- Returns:
- A non-
nullstatus code that determines how to continue iteration.
-
onItemAfterChildren
Description copied from interface:IHierarchyVisitorCallbackCalled after eventual children of the current item were visited. This method is also to be called if no children are present at all. This method has always to be called ifIHierarchyVisitorCallback.onItemBeforeChildren(Object)was called.- Specified by:
onItemAfterChildrenin interfaceIHierarchyVisitorCallback<DATATYPE>- Parameters:
aItem- The current item. May benull.- Returns:
- A non-
nullstatus code that determines how to continue iteration.
-