Interface ForestParentChildrenClosure<T,C>

Type Parameters:
T - the type of the result of processing one row
C - the type of the result of processing a number of sub-rows under the same parent
All Known Implementing Classes:
ForestParentChildrenListClosure

public interface ForestParentChildrenClosure<T,C>
Implement this interface to efficiently process a forest in a bottom-up style with Forest.foldUpwards(com.almworks.jira.structure.api.forest.raw.ForestParentChildrenClosure<T, C>).
  • Method Summary

    Modifier and Type
    Method
    Description
    combine(ForestIterationControl fold, T value, C carry)
    Used to combine values returned by {#visitRow} calls to every sub-row of a single parent.
    visitRow(ForestIterationControl fold, long row, LongList children, C carry)
    Process an row using information about children.
  • Method Details

    • combine

      @Nullable C combine(@NotNull ForestIterationControl fold, T value, @Nullable C carry)
      Used to combine values returned by {#visitRow} calls to every sub-row of a single parent.
      Parameters:
      fold - fold control
      value - the value returned by visitRow()
      carry - the carry value returned by previous call to combine() on a result of processing the successor row under the same parent row, or null for the first call
      Returns:
      the combined carry value
    • visitRow

      @Nullable T visitRow(@NotNull ForestIterationControl fold, long row, @NotNull LongList children, @Nullable C carry)
      Process an row using information about children.
      Parameters:
      fold - fold control
      row - the row id
      children - the sub-rows, or empty list if it's a leaf
      carry - the combined carry value (result of calling combine(com.almworks.jira.structure.api.forest.raw.ForestIterationControl, T, C) on every result of child processing, or null if (but not only if) there are no children
      Returns:
      the result of processing