Interface ForestParentChildrenClosure<T,C>
- Type Parameters:
T- the type of the result of processing one rowC- 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 TypeMethodDescriptioncombine(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
Used to combine values returned by {#visitRow} calls to every sub-row of a single parent.- Parameters:
fold- fold controlvalue- the value returned byvisitRow()carry- the carry value returned by previous call tocombine()on a result of processing the successor row under the same parent row, ornullfor 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 controlrow- the row idchildren- the sub-rows, or empty list if it's a leafcarry- the combined carry value (result of callingcombine(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
-