Interface IHierarchyVisitorCallback<DATATYPE>

Type Parameters:
DATATYPE - The type of object to be iterated.
All Superinterfaces:
ICallback
All Known Implementing Classes:
DefaultHierarchyVisitorCallback

public interface IHierarchyVisitorCallback<DATATYPE> extends ICallback
Base interface with callbacks for visiting a hierarchy.
Author:
Philip Helger
  • Method Details

    • begin

      default void begin()
      Called before the tree walking starts.
    • getLevel

      @Nonnegative int 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 call getLevel() should return a value increased by 1.
    • onLevelUp

      default void onLevelUp()
      Called after the tree walker ascends into the previous tree level. After this call getLevel() should return a value decreased by 1.
    • onItemBeforeChildren

      @Nonnull EHierarchyVisitorReturn onItemBeforeChildren(DATATYPE aItem)
      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 be null.
      Returns:
      A non-null status code that determines how to continue iteration.
    • onItemAfterChildren

      @Nonnull EHierarchyVisitorReturn onItemAfterChildren(DATATYPE aItem)
      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 if onItemBeforeChildren(Object) was called.
      Parameters:
      aItem - The current item. May be null.
      Returns:
      A non-null status code that determines how to continue iteration.
    • end

      default void end()
      Called after the tree walking ended.