5 |
|
*/ |
6 |
|
|
7 |
|
package java.util; |
8 |
< |
import java.util.concurrent.ForkJoinPool; |
8 |
> |
|
9 |
|
import java.util.concurrent.CountedCompleter; |
10 |
+ |
import java.util.concurrent.ForkJoinPool; |
11 |
|
import java.util.function.BinaryOperator; |
12 |
+ |
import java.util.function.DoubleBinaryOperator; |
13 |
|
import java.util.function.IntBinaryOperator; |
14 |
|
import java.util.function.LongBinaryOperator; |
13 |
– |
import java.util.function.DoubleBinaryOperator; |
15 |
|
|
16 |
|
/** |
17 |
|
* ForkJoin tasks to perform Arrays.parallelPrefix operations. |
20 |
|
* @since 1.8 |
21 |
|
*/ |
22 |
|
class ArrayPrefixHelpers { |
23 |
< |
private ArrayPrefixHelpers() {}; // non-instantiable |
23 |
> |
private ArrayPrefixHelpers() {} // non-instantiable |
24 |
|
|
25 |
|
/* |
26 |
|
* Parallel prefix (aka cumulate, scan) task classes |
384 |
|
|
385 |
|
/** Root task constructor */ |
386 |
|
public DoubleCumulateTask(DoubleCumulateTask parent, |
387 |
< |
DoubleBinaryOperator function, |
388 |
< |
double[] array, int lo, int hi) { |
387 |
> |
DoubleBinaryOperator function, |
388 |
> |
double[] array, int lo, int hi) { |
389 |
|
super(parent); |
390 |
|
this.function = function; this.array = array; |
391 |
|
this.lo = this.origin = lo; this.hi = this.fence = hi; |
397 |
|
|
398 |
|
/** Subtask constructor */ |
399 |
|
DoubleCumulateTask(DoubleCumulateTask parent, DoubleBinaryOperator function, |
400 |
< |
double[] array, int origin, int fence, int threshold, |
401 |
< |
int lo, int hi) { |
400 |
> |
double[] array, int origin, int fence, int threshold, |
401 |
> |
int lo, int hi) { |
402 |
|
super(parent); |
403 |
|
this.function = function; this.array = array; |
404 |
|
this.origin = origin; this.fence = fence; |
534 |
|
|
535 |
|
/** Root task constructor */ |
536 |
|
public IntCumulateTask(IntCumulateTask parent, |
537 |
< |
IntBinaryOperator function, |
538 |
< |
int[] array, int lo, int hi) { |
537 |
> |
IntBinaryOperator function, |
538 |
> |
int[] array, int lo, int hi) { |
539 |
|
super(parent); |
540 |
|
this.function = function; this.array = array; |
541 |
|
this.lo = this.origin = lo; this.hi = this.fence = hi; |
547 |
|
|
548 |
|
/** Subtask constructor */ |
549 |
|
IntCumulateTask(IntCumulateTask parent, IntBinaryOperator function, |
550 |
< |
int[] array, int origin, int fence, int threshold, |
551 |
< |
int lo, int hi) { |
550 |
> |
int[] array, int origin, int fence, int threshold, |
551 |
> |
int lo, int hi) { |
552 |
|
super(parent); |
553 |
|
this.function = function; this.array = array; |
554 |
|
this.origin = origin; this.fence = fence; |