Interface IHierarchyVisitorCallback<DATATYPE>
- Type Parameters:
DATATYPE- The type of object to be iterated.
- All Superinterfaces:
ICallback
- All Known Implementing Classes:
DefaultHierarchyVisitorCallback
Base interface with callbacks for visiting a hierarchy.
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidbegin()Called before the tree walking starts.default voidend()Called after the tree walking ended.intgetLevel()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.default voidCalled before the tree walker descends into the next tree level.default voidCalled after the tree walker ascends into the previous tree level.
-
Method Details
-
begin
default void begin()Called before the tree walking starts. -
getLevel
- Returns:
- The level of the current node within the hierarchy. Always ≥ 0. The root item has level 0.
-
onLevelDown
default void onLevelDown()Called before the tree walker descends into the next tree level. After this callgetLevel()should return a value increased by 1. -
onLevelUp
default void onLevelUp()Called after the tree walker ascends into the previous tree level. After this callgetLevel()should return a value decreased by 1. -
onItemBeforeChildren
Called before children of the current item are visited. This method is also to be called if no children are present at all.- Parameters:
aItem- The current item. May benull.- Returns:
- A non-
nullstatus code that determines how to continue iteration.
-
onItemAfterChildren
Called 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 ifonItemBeforeChildren(Object)was called.- Parameters:
aItem- The current item. May benull.- Returns:
- A non-
nullstatus code that determines how to continue iteration.
-
end
default void end()Called after the tree walking ended.
-