Class ReductionStrategy.ChildrenReductionStrategy<T>
Object
ReductionStrategy.AbstractReductionStrategy<T>
ChildrenReductionStrategy<T>
- All Implemented Interfaces:
ReductionStrategy<T>
- Enclosing interface:
- ReductionStrategy<T>
public static class ReductionStrategy.ChildrenReductionStrategy<T>
extends ReductionStrategy.AbstractReductionStrategy<T>
Main value: the aggregation based only on children.
Additional data: AttributeValue<T>
that contains only self value of the row.
Calculation idea: sum the additional values from all children.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ReductionStrategy
ReductionStrategy.AbstractReductionStrategy<T>, ReductionStrategy.ChildrenReductionStrategy<T>, ReductionStrategy.LeavesReductionStrategy<T>, ReductionStrategy.StrictReductionStrategy<T>, ReductionStrategy.SubtreeReductionStrategy<T>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply
(Supplier<AttributeValue<T>> selfSupplier, List<AttributeValue<T>> children, ValueReducer<T> reducer) Reduce value of the current node and children values to the single value using the specifiedValueReducer
.
-
Constructor Details
-
ChildrenReductionStrategy
public ChildrenReductionStrategy()
-
-
Method Details
-
apply
@NotNull public AttributeValue<T> apply(@NotNull Supplier<AttributeValue<T>> selfSupplier, @NotNull List<AttributeValue<T>> children, @NotNull ValueReducer<T> reducer) Description copied from interface:ReductionStrategy
Reduce value of the current node and children values to the single value using the specifiedValueReducer
. This method is designed to be used fromAttributeLoader.Aggregate
. Reduction can be performed over any subtree and it's assumed that everyReductionStrategy
describes in this method a reduction for a single known subtree type.- Parameters:
selfSupplier
- supplier for value of current row. Supplier can be or be not called from this method depending on type of subtree this strategy describes. It's assumed that calling supplier can be heavy operation so it shouldn't be called more than once for each row from this method.children
- values of direct children rows supplied byAttributeLoader.Aggregate.loadValue
reducer
- instance that is responsible for reducing but can ignore actual form of handled subtree- Returns:
- reduced subtree value
-