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.

  • 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 specified ValueReducer. This method is designed to be used from AttributeLoader.Aggregate. Reduction can be performed over any subtree and it's assumed that every ReductionStrategy 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 by AttributeLoader.Aggregate.loadValue
      reducer - instance that is responsible for reducing but can ignore actual form of handled subtree
      Returns:
      reduced subtree value