com.hazelcast.jet.aggregate

## Interface AggregateOperation3<T0,T1,T2,A,R>

- Type Parameters:
    `T0` - the type of item in stream-0
    `T1` - the type of item in stream-1
    `T2` - the type of item in stream-2
    `A` - the type of the accumulator
    `R` - the type of the aggregation result
  All Superinterfaces:
    AggregateOperation<A,R>, Serializable

      public interface AggregateOperation3<T0,T1,T2,A,R>
      extends AggregateOperation<A,R>

  Specialization of `AggregateOperation` (refer to its extensive documentation) to the "arity-3" case with three data streams being aggregated over. `AggregateOperations` contains factories for the built-in implementations and you can create your own using the aggregate operation builder.

  This example constructs an operation that sums up `long` values from three streams:

       AggregateOperation3<Long, Long, Long, LongAccumulator, Long> aggrOp = AggregateOperation
           .withCreate(LongAccumulator::new)
           .<Long>andAccumulate0(LongAccumulator::add)
           .<Long>andAccumulate1(LongAccumulator::add)
           .<Long>andAccumulate2(LongAccumulator::add)
           .andFinish(LongAccumulator::get);

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `DistributedBiConsumer<? super A,? super T0>` | `accumulateFn0()` A primitive that updates the accumulator state to account for a new item coming from stream-0.
    `DistributedBiConsumer<? super A,? super T1>` | `accumulateFn1()` A primitive that updates the accumulator state to account for a new item coming from stream-1.
    `DistributedBiConsumer<? super A,? super T2>` | `accumulateFn2()` A primitive that updates the accumulator state to account for a new item coming from stream-2.
    `<R_NEW> AggregateOperation3<T0,T1,T2,A,R_NEW>` | `andThen(DistributedFunction<? super R,? extends R_NEW> thenFn)` Returns a copy of this aggregate operation, but with the `export` and `finish` primitives composed with the supplied `thenFn`.
    `<T0_NEW> AggregateOperation3<T0_NEW,T1,T2,A,R>` | `withAccumulateFn0(DistributedBiConsumer<? super A,? super T0_NEW> newAccFn0)` Returns a copy of this aggregate operation, but with the `accumulate` primitive at index 0 replaced with the one supplied here.
    `<T1_NEW> AggregateOperation3<T0,T1_NEW,T2,A,R>` | `withAccumulateFn1(DistributedBiConsumer<? super A,? super T1_NEW> newAccFn1)` Returns a copy of this aggregate operation, but with the `accumulate` primitive at index 1 replaced with the one supplied here.
    `<T2_NEW> AggregateOperation3<T0,T1,T2_NEW,A,R>` | `withAccumulateFn2(DistributedBiConsumer<? super A,? super T2_NEW> newAccFn2)` Returns a copy of this aggregate operation, but with the `accumulate` primitive at index 2 replaced with the one supplied here.
    `AggregateOperation3<T0,T1,T2,A,A>` | `withIdentityFinish()` Returns a copy of this aggregate operation, but with the `finish` primitive replaced with the identity function.

    - ### Methods inherited from interface com.hazelcast.jet.aggregate.AggregateOperation

      `accumulateFn, accumulateFn, arity, combineFn, createFn, deductFn, exportFn, finishFn, withAccumulateFns, withCombiningAccumulateFn, withCreate`

- - ### Method Detail

    - #### accumulateFn0

          @Nonnull
          DistributedBiConsumer<? super A,? super T0> accumulateFn0()

      A primitive that updates the accumulator state to account for a new item coming from stream-0.

    - #### accumulateFn1

          @Nonnull
          DistributedBiConsumer<? super A,? super T1> accumulateFn1()

      A primitive that updates the accumulator state to account for a new item coming from stream-1.

    - #### accumulateFn2

          @Nonnull
          DistributedBiConsumer<? super A,? super T2> accumulateFn2()

      A primitive that updates the accumulator state to account for a new item coming from stream-2.

    - #### withAccumulateFn0

          @Nonnull
          <T0_NEW> AggregateOperation3<T0_NEW,T1,T2,A,R> withAccumulateFn0(@Nonnull
                                                                                    DistributedBiConsumer<? super A,? super T0_NEW> newAccFn0)

      Returns a copy of this aggregate operation, but with the `accumulate` primitive at index 0 replaced with the one supplied here.

    - #### withAccumulateFn1

          @Nonnull
          <T1_NEW> AggregateOperation3<T0,T1_NEW,T2,A,R> withAccumulateFn1(@Nonnull
                                                                                    DistributedBiConsumer<? super A,? super T1_NEW> newAccFn1)

      Returns a copy of this aggregate operation, but with the `accumulate` primitive at index 1 replaced with the one supplied here.

    - #### withAccumulateFn2

          @Nonnull
          <T2_NEW> AggregateOperation3<T0,T1,T2_NEW,A,R> withAccumulateFn2(@Nonnull
                                                                                    DistributedBiConsumer<? super A,? super T2_NEW> newAccFn2)

      Returns a copy of this aggregate operation, but with the `accumulate` primitive at index 2 replaced with the one supplied here.

    - #### withIdentityFinish

          @Nonnull
          AggregateOperation3<T0,T1,T2,A,A> withIdentityFinish()

      Description copied from interface: `AggregateOperation`
      Returns a copy of this aggregate operation, but with the `finish` primitive replaced with the identity function. It will return the accumulator object as-is. The returned aggregate operation does not support the `export` primitive.
      Specified by:
        `withIdentityFinish` in interface `AggregateOperation<A,R>`

    - #### andThen

          @Nonnull
          <R_NEW> AggregateOperation3<T0,T1,T2,A,R_NEW> andThen(DistributedFunction<? super R,? extends R_NEW> thenFn)

      Description copied from interface: `AggregateOperation`
      Returns a copy of this aggregate operation, but with the `export` and `finish` primitives composed with the supplied `thenFn`. This replaces `exportFn` with `exportFn.andThen(thenFn)`, same for `finishFn`. The main use case is to transform the result of an existing (library-provided) aggregate operation.
      Specified by:
        `andThen` in interface `AggregateOperation<A,R>`
      Type Parameters:
        `R_NEW` - the type of the returned aggregate operation's result
      Parameters:
        `thenFn` - the function to apply to the results of `export` and `finish` primitives

Copyright © 2018. All rights reserved.