Class ReduceTask<V>

  • Type Parameters:
    V - the type of values processed
    All Implemented Interfaces:
    Serializable, Future<V>

    class ReduceTask<V>
    extends RecursiveTask<V>
    Task for simulating the reduce operation of parallel streams including log information.
    Author:
    Herbert Praehofer
    • Field Detail

      • spltr

        private final Spliterator<V> spltr
        The spliterator for this task
      • identity

        private final V identity
        The identity value for the reduction
      • accu

        private final BinaryOperator<V> accu
        The binary operator for the reduction
      • comb

        private final BinaryOperator<V> comb
        The binary operator for the reduction
      • result

        V result
        The reduction value
    • Constructor Detail

      • ReduceTask

        public ReduceTask​(Spliterator<V> spltr,
                          V identity,
                          BinaryOperator<V> accu,
                          BinaryOperator<V> comb)
        Constructor initializing the task.
        Parameters:
        spltr - the spliterator
        identity - the identity value for the reduction
        accu - the accumulator function for the sequential reduction
        comb - the combiner function for the reduction
    • Method Detail

      • compute

        protected V compute()
        Executes this task. Either splits or does a sequential reduction.
        Specified by:
        compute in class RecursiveTask<V>
        Returns:
        the reduced value