5 |
|
*/ |
6 |
|
|
7 |
|
package extra166y; |
8 |
+ |
|
9 |
|
import jsr166y.*; |
10 |
|
import static extra166y.Ops.*; |
11 |
|
import java.util.*; |
66 |
|
// A few public methods exported across all subclasses |
67 |
|
|
68 |
|
/** |
69 |
< |
* Return the number of elements selected using bound or |
69 |
> |
* Returns the number of elements selected using bound or |
70 |
|
* filter restrictions. Note that this method must evaluate |
71 |
|
* all selectors to return its result. |
72 |
|
* @return the number of elements |
83 |
|
/** |
84 |
|
* Returns the index of some element matching bound and filter |
85 |
|
* constraints, or -1 if none. |
86 |
< |
* @return index of matching element, or -1 if none. |
86 |
> |
* @return index of matching element, or -1 if none |
87 |
|
*/ |
88 |
|
public int anyIndex() { |
89 |
|
if (!hasFilter()) |
96 |
|
} |
97 |
|
|
98 |
|
/** |
99 |
< |
* Returns true if there are no elements |
99 |
> |
* Returns true if there are no elements. |
100 |
|
* @return true if there are no elements |
101 |
|
*/ |
102 |
|
public boolean isEmpty() { |
133 |
|
*/ |
134 |
|
Object[] ogetArray() { return null; } |
135 |
|
double[] dgetArray() { return null; } |
136 |
< |
long[] lgetArray() { return null; } |
136 |
> |
long[] lgetArray() { return null; } |
137 |
|
abstract Object oget(int index); |
138 |
|
abstract double dget(int index); |
139 |
|
abstract long lget(int index); |
146 |
|
* oget, dget, etc. But most are overridden in most concrete |
147 |
|
* classes to avoid per-element dispatching. |
148 |
|
*/ |
149 |
+ |
|
150 |
|
void leafApply(int lo, int hi, Procedure procedure) { |
151 |
|
for (int i = lo; i < hi; ++i) |
152 |
|
if (isSelected(i)) |
276 |
|
/** |
277 |
|
* Shared support for select/map all -- probe filter, map, and |
278 |
|
* type to start selection driver, or do parallel mapping, or |
279 |
< |
* just copy, |
279 |
> |
* just copy. |
280 |
|
*/ |
281 |
|
final Object[] allObjects(Class elementType) { |
282 |
|
if (hasFilter()) { |
405 |
|
int otherOffset, BinaryLongOp combiner) {} |
406 |
|
|
407 |
|
// Base of object ref array classes |
408 |
< |
static abstract class OPap<T> extends AbstractParallelAnyArray { |
408 |
> |
abstract static class OPap<T> extends AbstractParallelAnyArray { |
409 |
|
T[] array; |
410 |
|
OPap(ForkJoinPool ex, int origin, int fence, T[] array) { |
411 |
|
super(ex, origin, fence); |
435 |
|
} |
436 |
|
|
437 |
|
// Base of double array classes |
438 |
< |
static abstract class DPap extends AbstractParallelAnyArray { |
438 |
> |
abstract static class DPap extends AbstractParallelAnyArray { |
439 |
|
double[] array; |
440 |
|
DPap(ForkJoinPool ex, int origin, int fence, double[] array) { |
441 |
|
super(ex, origin, fence); |
465 |
|
} |
466 |
|
|
467 |
|
// Base of long array classes |
468 |
< |
static abstract class LPap extends AbstractParallelAnyArray { |
468 |
> |
abstract static class LPap extends AbstractParallelAnyArray { |
469 |
|
long[] array; |
470 |
|
LPap(ForkJoinPool ex, int origin, int fence, long[] array) { |
471 |
|
super(ex, origin, fence); |
515 |
|
return new ORPap<T>(ex, origin, fence, array, selector); |
516 |
|
} |
517 |
|
|
518 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
518 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
519 |
|
(Op<? super T, ? extends U> op) { |
520 |
|
return new OUOMPap<T,U>(ex, origin, fence, array, op); |
521 |
|
} |
967 |
|
|
968 |
|
public ParallelLongArrayWithLongMapping withIndexedMapping |
969 |
|
(IntAndLongToLong mapper) { |
970 |
< |
return new LULCPap(ex, origin, fence, array, mapper); |
970 |
> |
return new LULCPap(ex, origin, fence, array, mapper); |
971 |
|
} |
972 |
|
|
973 |
|
public int indexOf(long target) { |
1135 |
|
} |
1136 |
|
} |
1137 |
|
|
1138 |
+ |
static final class AndPredicate<T> implements Predicate<T> { |
1139 |
+ |
final Predicate<? super T> first; |
1140 |
+ |
final Predicate<? super T> second; |
1141 |
+ |
AndPredicate(Predicate<? super T> first, |
1142 |
+ |
Predicate<? super T> second) { |
1143 |
+ |
this.first = first; this.second = second; |
1144 |
+ |
} |
1145 |
+ |
public final boolean op(T x) { return first.op(x) && second.op(x); } |
1146 |
+ |
} |
1147 |
+ |
|
1148 |
|
// Filtered (but unmapped) classes |
1149 |
|
static final class OFPap<T> extends ParallelArrayWithFilter<T> { |
1150 |
|
final Predicate<? super T> selector; |
1161 |
|
public ParallelArrayWithFilter<T> withFilter |
1162 |
|
(Predicate<? super T> selector) { |
1163 |
|
return new OFPap<T>(ex, origin, fence, array, |
1164 |
< |
CommonOps.andPredicate(this.selector, selector)); |
1164 |
> |
new AndPredicate(this.selector, selector)); |
1165 |
|
} |
1166 |
|
|
1167 |
|
public ParallelArrayWithFilter<T> withIndexedFilter |
1171 |
|
compoundIndexedSelector(this.selector, selector)); |
1172 |
|
} |
1173 |
|
|
1174 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
1174 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
1175 |
|
(Op<? super T, ? extends U> op) { |
1176 |
|
return new OFOMPap<T,U>(ex, origin, fence, array, selector, op); |
1177 |
|
} |
1201 |
|
return new OFLCPap<T>(ex, origin, fence, array, selector, mapper); |
1202 |
|
} |
1203 |
|
|
1204 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
1204 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
1205 |
|
final Predicate s = selector; |
1206 |
|
final Object[] a = this.array; |
1207 |
|
for (int i = lo; i < hi; ++i) { |
1379 |
|
return new DFLCPap(ex, origin, fence, array, selector, mapper); |
1380 |
|
} |
1381 |
|
|
1382 |
< |
final void leafApply(int lo, int hi, DoubleProcedure procedure) { |
1382 |
> |
final void leafApply(int lo, int hi, DoubleProcedure procedure) { |
1383 |
|
final DoublePredicate s = selector; |
1384 |
|
final double[] a = this.array; |
1385 |
|
for (int i = lo; i < hi; ++i) { |
1559 |
|
return new LFLCPap(ex, origin, fence, array, selector, mapper); |
1560 |
|
} |
1561 |
|
|
1562 |
< |
final void leafApply(int lo, int hi, LongProcedure procedure) { |
1562 |
> |
final void leafApply(int lo, int hi, LongProcedure procedure) { |
1563 |
|
final LongPredicate s = selector; |
1564 |
|
final long[] a = this.array; |
1565 |
|
for (int i = lo; i < hi; ++i) { |
1712 |
|
compoundIndexedSelector(this.selector, selector)); |
1713 |
|
} |
1714 |
|
|
1715 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
1715 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
1716 |
|
(Op<? super T, ? extends U> op) { |
1717 |
|
return new OROMPap<T,U>(ex, origin, fence, array, selector, op); |
1718 |
|
} |
1742 |
|
return new ORLCPap<T>(ex, origin, fence, array, selector, mapper); |
1743 |
|
} |
1744 |
|
|
1745 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
1745 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
1746 |
|
final IntAndObjectPredicate s = selector; |
1747 |
|
final Object[] a = this.array; |
1748 |
|
for (int i = lo; i < hi; ++i) { |
1922 |
|
return new DRLCPap(ex, origin, fence, array, selector, mapper); |
1923 |
|
} |
1924 |
|
|
1925 |
< |
final void leafApply(int lo, int hi, DoubleProcedure procedure) { |
1925 |
> |
final void leafApply(int lo, int hi, DoubleProcedure procedure) { |
1926 |
|
final IntAndDoublePredicate s = selector; |
1927 |
|
final double[] a = this.array; |
1928 |
|
for (int i = lo; i < hi; ++i) { |
2102 |
|
return new LRLCPap(ex, origin, fence, array, selector, mapper); |
2103 |
|
} |
2104 |
|
|
2105 |
< |
final void leafApply(int lo, int hi, LongProcedure procedure) { |
2105 |
> |
final void leafApply(int lo, int hi, LongProcedure procedure) { |
2106 |
|
final IntAndLongPredicate s = selector; |
2107 |
|
final long[] a = this.array; |
2108 |
|
for (int i = lo; i < hi; ++i) { |
2230 |
|
|
2231 |
|
// Object-mapped |
2232 |
|
|
2233 |
< |
static abstract class OOMPap<T,U> extends ParallelArrayWithMapping<T,U> { |
2233 |
> |
abstract static class OOMPap<T,U> extends ParallelArrayWithMapping<T,U> { |
2234 |
|
final Op<? super T, ? extends U> op; |
2235 |
|
OOMPap(ForkJoinPool ex, int origin, int fence, |
2236 |
|
T[] array, |
2260 |
|
} |
2261 |
|
} |
2262 |
|
|
2263 |
< |
static abstract class DOMPap<U> extends ParallelDoubleArrayWithMapping<U> { |
2263 |
> |
abstract static class DOMPap<U> extends ParallelDoubleArrayWithMapping<U> { |
2264 |
|
final DoubleToObject<? extends U> op; |
2265 |
|
DOMPap(ForkJoinPool ex, int origin, int fence, |
2266 |
|
double[] array, DoubleToObject<? extends U> op) { |
2289 |
|
} |
2290 |
|
} |
2291 |
|
|
2292 |
< |
static abstract class LOMPap<U> extends ParallelLongArrayWithMapping<U> { |
2292 |
> |
abstract static class LOMPap<U> extends ParallelLongArrayWithMapping<U> { |
2293 |
|
final LongToObject<? extends U> op; |
2294 |
|
LOMPap(ForkJoinPool ex, int origin, int fence, |
2295 |
|
long[] array, LongToObject<? extends U> op) { |
2326 |
|
super(ex, origin, fence, array, op); |
2327 |
|
} |
2328 |
|
|
2329 |
< |
public <V> ParallelArrayWithMapping<T, V> withMapping |
2329 |
> |
public <V> ParallelArrayWithMapping<T,V> withMapping |
2330 |
|
(Op<? super U, ? extends V> op) { |
2331 |
|
return new OUOMPap<T,V>(ex, origin, fence, array, |
2332 |
|
CommonOps.compoundOp(this.op, op)); |
2362 |
|
compoundIndexedOp(this.op, mapper)); |
2363 |
|
} |
2364 |
|
|
2365 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
2365 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
2366 |
|
final Op f = op; |
2367 |
|
final Object[] a = this.array; |
2368 |
|
for (int i = lo; i < hi; ++i) |
2424 |
|
compoundIndexedOp(this.op, mapper)); |
2425 |
|
} |
2426 |
|
|
2427 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
2427 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
2428 |
|
final double[] a = this.array; |
2429 |
|
final DoubleToObject f = op; |
2430 |
|
for (int i = lo; i < hi; ++i) |
2486 |
|
compoundIndexedOp(this.op, mapper)); |
2487 |
|
} |
2488 |
|
|
2489 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
2489 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
2490 |
|
final long[] a = this.array; |
2491 |
|
final LongToObject f = op; |
2492 |
|
for (int i = lo; i < hi; ++i) |
2520 |
|
boolean hasFilter() { return true; } |
2521 |
|
boolean isSelected(int i) { return selector.op(this.array[i]); } |
2522 |
|
|
2523 |
< |
public <V> ParallelArrayWithMapping<T, V> withMapping |
2523 |
> |
public <V> ParallelArrayWithMapping<T,V> withMapping |
2524 |
|
(Op<? super U, ? extends V> op) { |
2525 |
|
return new OFOMPap<T,V> |
2526 |
|
(ex, origin, fence, array, selector, |
2557 |
|
compoundIndexedOp(this.op, mapper)); |
2558 |
|
} |
2559 |
|
|
2560 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
2560 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
2561 |
|
final Predicate s = selector; |
2562 |
|
final Object[] a = this.array; |
2563 |
|
final Op f = op; |
2645 |
|
compoundIndexedOp(this.op, mapper)); |
2646 |
|
} |
2647 |
|
|
2648 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
2648 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
2649 |
|
final DoublePredicate s = selector; |
2650 |
|
final DoubleToObject f = op; |
2651 |
|
final double[] a = this.array; |
2727 |
|
compoundIndexedOp(this.op, mapper)); |
2728 |
|
} |
2729 |
|
|
2730 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
2730 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
2731 |
|
final LongPredicate s = selector; |
2732 |
|
final LongToObject f = op; |
2733 |
|
final long[] a = this.array; |
2775 |
|
boolean hasFilter() { return true; } |
2776 |
|
boolean isSelected(int i) { return selector.op(i, this.array[i]); } |
2777 |
|
|
2778 |
< |
public <V> ParallelArrayWithMapping<T, V> withMapping |
2778 |
> |
public <V> ParallelArrayWithMapping<T,V> withMapping |
2779 |
|
(Op<? super U, ? extends V> op) { |
2780 |
|
return new OROMPap<T,V> |
2781 |
|
(ex, origin, fence, array, selector, |
2810 |
|
compoundIndexedOp(this.op, mapper)); |
2811 |
|
} |
2812 |
|
|
2813 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
2813 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
2814 |
|
final IntAndObjectPredicate s = selector; |
2815 |
|
final Object[] a = this.array; |
2816 |
|
final Op f = op; |
2898 |
|
compoundIndexedOp(this.op, mapper)); |
2899 |
|
} |
2900 |
|
|
2901 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
2901 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
2902 |
|
final IntAndDoublePredicate s = selector; |
2903 |
|
final DoubleToObject f = op; |
2904 |
|
final double[] a = this.array; |
2980 |
|
compoundIndexedOp(this.op, mapper)); |
2981 |
|
} |
2982 |
|
|
2983 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
2983 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
2984 |
|
final IntAndLongPredicate s = selector; |
2985 |
|
final LongToObject f = op; |
2986 |
|
final long[] a = this.array; |
3015 |
|
|
3016 |
|
// Object-combined |
3017 |
|
|
3018 |
< |
static abstract class OOCPap<T,U> extends ParallelArrayWithMapping<T,U> { |
3018 |
> |
abstract static class OOCPap<T,U> extends ParallelArrayWithMapping<T,U> { |
3019 |
|
final IntAndObjectToObject<? super T, ? extends U> op; |
3020 |
|
OOCPap(ForkJoinPool ex, int origin, int fence, |
3021 |
|
T[] array, |
3047 |
|
} |
3048 |
|
} |
3049 |
|
|
3050 |
< |
static abstract class DOCPap<U> extends ParallelDoubleArrayWithMapping<U> { |
3050 |
> |
abstract static class DOCPap<U> extends ParallelDoubleArrayWithMapping<U> { |
3051 |
|
final IntAndDoubleToObject<? extends U> op; |
3052 |
|
DOCPap(ForkJoinPool ex, int origin, int fence, |
3053 |
|
double[] array, IntAndDoubleToObject<? extends U> op) { |
3078 |
|
} |
3079 |
|
} |
3080 |
|
|
3081 |
< |
static abstract class LOCPap<U> extends ParallelLongArrayWithMapping<U> { |
3081 |
> |
abstract static class LOCPap<U> extends ParallelLongArrayWithMapping<U> { |
3082 |
|
final IntAndLongToObject<? extends U> op; |
3083 |
|
LOCPap(ForkJoinPool ex, int origin, int fence, |
3084 |
|
long[] array, IntAndLongToObject<? extends U> op) { |
3117 |
|
super(ex, origin, fence, array, op); |
3118 |
|
} |
3119 |
|
|
3120 |
< |
public <V> ParallelArrayWithMapping<T, V> withMapping |
3120 |
> |
public <V> ParallelArrayWithMapping<T,V> withMapping |
3121 |
|
(Op<? super U, ? extends V> op) { |
3122 |
|
return new OUOCPap<T,V>(ex, origin, fence, array, |
3123 |
|
compoundIndexedOp(this.op, op)); |
3153 |
|
compoundIndexedOp(this.op, mapper)); |
3154 |
|
} |
3155 |
|
|
3156 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
3156 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
3157 |
|
final IntAndObjectToObject f = op; |
3158 |
|
final Object[] a = this.array; |
3159 |
|
for (int i = lo; i < hi; ++i) |
3215 |
|
compoundIndexedOp(this.op, mapper)); |
3216 |
|
} |
3217 |
|
|
3218 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
3218 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
3219 |
|
final IntAndDoubleToObject f = op; |
3220 |
|
final double[] a = this.array; |
3221 |
|
for (int i = lo; i < hi; ++i) |
3277 |
|
compoundIndexedOp(this.op, mapper)); |
3278 |
|
} |
3279 |
|
|
3280 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
3280 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
3281 |
|
final IntAndLongToObject f = op; |
3282 |
|
final long[] a = this.array; |
3283 |
|
for (int i = lo; i < hi; ++i) |
3299 |
|
|
3300 |
|
// object-combined filtered |
3301 |
|
|
3302 |
< |
static final class OFOCPap<T,U> extends OOCPap<T,U> { |
3302 |
> |
static final class OFOCPap<T,U> extends OOCPap<T,U> { |
3303 |
|
final Predicate<? super T> selector; |
3304 |
|
OFOCPap(ForkJoinPool ex, int origin, int fence, |
3305 |
|
T[] array, Predicate<? super T> selector, |
3311 |
|
boolean hasFilter() { return true; } |
3312 |
|
boolean isSelected(int i) { return selector.op(this.array[i]); } |
3313 |
|
|
3314 |
< |
public <V> ParallelArrayWithMapping<T, V> withMapping |
3314 |
> |
public <V> ParallelArrayWithMapping<T,V> withMapping |
3315 |
|
(Op<? super U, ? extends V> op) { |
3316 |
|
return new OFOCPap<T,V>(ex, origin, fence, array, selector, |
3317 |
|
compoundIndexedOp(this.op, op)); |
3349 |
|
(this.op, mapper)); |
3350 |
|
} |
3351 |
|
|
3352 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
3352 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
3353 |
|
final Predicate s = selector; |
3354 |
|
final Object[] a = this.array; |
3355 |
|
final IntAndObjectToObject f = op; |
3429 |
|
compoundIndexedOp(this.op, mapper)); |
3430 |
|
} |
3431 |
|
|
3432 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
3432 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
3433 |
|
final DoublePredicate s = selector; |
3434 |
|
final double[] a = this.array; |
3435 |
|
final IntAndDoubleToObject f = op; |
3509 |
|
compoundIndexedOp(this.op, mapper)); |
3510 |
|
} |
3511 |
|
|
3512 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
3512 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
3513 |
|
final LongPredicate s = selector; |
3514 |
|
final long[] a = this.array; |
3515 |
|
final IntAndLongToObject f = op; |
3542 |
|
} |
3543 |
|
|
3544 |
|
// Object-combined, relational |
3545 |
< |
static final class OROCPap<T,U> extends OOCPap<T,U> { |
3545 |
> |
static final class OROCPap<T,U> extends OOCPap<T,U> { |
3546 |
|
final IntAndObjectPredicate<? super T> selector; |
3547 |
|
OROCPap(ForkJoinPool ex, int origin, int fence, |
3548 |
|
T[] array, IntAndObjectPredicate<? super T> selector, |
3554 |
|
boolean hasFilter() { return true; } |
3555 |
|
boolean isSelected(int i) { return selector.op(i, this.array[i]); } |
3556 |
|
|
3557 |
< |
public <V> ParallelArrayWithMapping<T, V> withMapping |
3557 |
> |
public <V> ParallelArrayWithMapping<T,V> withMapping |
3558 |
|
(Op<? super U, ? extends V> op) { |
3559 |
|
return new OROCPap<T,V>(ex, origin, fence, array, selector, |
3560 |
|
compoundIndexedOp(this.op, op)); |
3592 |
|
(this.op, mapper)); |
3593 |
|
} |
3594 |
|
|
3595 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
3595 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
3596 |
|
final IntAndObjectPredicate s = selector; |
3597 |
|
final Object[] a = this.array; |
3598 |
|
final IntAndObjectToObject f = op; |
3672 |
|
compoundIndexedOp(this.op, mapper)); |
3673 |
|
} |
3674 |
|
|
3675 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
3675 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
3676 |
|
final IntAndDoublePredicate s = selector; |
3677 |
|
final double[] a = this.array; |
3678 |
|
final IntAndDoubleToObject f = op; |
3752 |
|
compoundIndexedOp(this.op, mapper)); |
3753 |
|
} |
3754 |
|
|
3755 |
< |
void leafApply(int lo, int hi, Procedure procedure) { |
3755 |
> |
void leafApply(int lo, int hi, Procedure procedure) { |
3756 |
|
final IntAndLongPredicate s = selector; |
3757 |
|
final long[] a = this.array; |
3758 |
|
final IntAndLongToObject f = op; |
3786 |
|
|
3787 |
|
// Double-mapped |
3788 |
|
|
3789 |
< |
static abstract class ODMPap<T> extends ParallelArrayWithDoubleMapping<T> { |
3789 |
> |
abstract static class ODMPap<T> extends ParallelArrayWithDoubleMapping<T> { |
3790 |
|
final ObjectToDouble<? super T> op; |
3791 |
|
ODMPap(ForkJoinPool ex, int origin, int fence, |
3792 |
|
T[] array, ObjectToDouble<? super T> op) { |
3816 |
|
|
3817 |
|
} |
3818 |
|
|
3819 |
< |
static abstract class DDMPap extends ParallelDoubleArrayWithDoubleMapping { |
3819 |
> |
abstract static class DDMPap extends ParallelDoubleArrayWithDoubleMapping { |
3820 |
|
final DoubleOp op; |
3821 |
|
DDMPap |
3822 |
|
(ForkJoinPool ex, int origin, int fence, |
3846 |
|
} |
3847 |
|
} |
3848 |
|
|
3849 |
< |
static abstract class LDMPap extends ParallelLongArrayWithDoubleMapping { |
3849 |
> |
abstract static class LDMPap extends ParallelLongArrayWithDoubleMapping { |
3850 |
|
final LongToDouble op; |
3851 |
|
LDMPap(ForkJoinPool ex, int origin, int fence, |
3852 |
|
long[] array, LongToDouble op) { |
3894 |
|
CommonOps.compoundOp(this.op, op)); |
3895 |
|
} |
3896 |
|
|
3897 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
3897 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
3898 |
|
(DoubleToObject<? extends U> op) { |
3899 |
|
return new OUOMPap<T,U>(ex, origin, fence, array, |
3900 |
|
CommonOps.compoundOp(this.op, op)); |
4082 |
|
CommonOps.compoundOp(this.op, op)); |
4083 |
|
} |
4084 |
|
|
4085 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
4085 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
4086 |
|
(DoubleToObject<? extends U> op) { |
4087 |
|
return new OFOMPap<T,U>(ex, origin, fence, array, selector, |
4088 |
|
CommonOps.compoundOp(this.op, op)); |
4318 |
|
CommonOps.compoundOp(this.op, op)); |
4319 |
|
} |
4320 |
|
|
4321 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
4321 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
4322 |
|
(DoubleToObject<? extends U> op) { |
4323 |
|
return new OROMPap<T,U>(ex, origin, fence, array, selector, |
4324 |
|
CommonOps.compoundOp(this.op, op)); |
4532 |
|
} |
4533 |
|
|
4534 |
|
// double-combined |
4535 |
< |
static abstract class ODCPap<T> extends ParallelArrayWithDoubleMapping<T> { |
4535 |
> |
abstract static class ODCPap<T> extends ParallelArrayWithDoubleMapping<T> { |
4536 |
|
final IntAndObjectToDouble<? super T> op; |
4537 |
|
ODCPap(ForkJoinPool ex, int origin, int fence, |
4538 |
|
T[] array, IntAndObjectToDouble<? super T> op) { |
4564 |
|
|
4565 |
|
} |
4566 |
|
|
4567 |
< |
static abstract class DDCPap extends ParallelDoubleArrayWithDoubleMapping { |
4567 |
> |
abstract static class DDCPap extends ParallelDoubleArrayWithDoubleMapping { |
4568 |
|
final IntAndDoubleToDouble op; |
4569 |
|
DDCPap(ForkJoinPool ex, int origin, int fence, |
4570 |
|
double[] array, IntAndDoubleToDouble op) { |
4595 |
|
} |
4596 |
|
} |
4597 |
|
|
4598 |
< |
static abstract class LDCPap extends ParallelLongArrayWithDoubleMapping { |
4598 |
> |
abstract static class LDCPap extends ParallelLongArrayWithDoubleMapping { |
4599 |
|
final IntAndLongToDouble op; |
4600 |
|
LDCPap(ForkJoinPool ex, int origin, int fence, |
4601 |
|
long[] array, IntAndLongToDouble op) { |
4643 |
|
compoundIndexedOp(this.op, op)); |
4644 |
|
} |
4645 |
|
|
4646 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
4646 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
4647 |
|
(DoubleToObject<? extends U> op) { |
4648 |
|
return new OUOCPap<T,U>(ex, origin, fence, array, |
4649 |
|
compoundIndexedOp(this.op, op)); |
4830 |
|
compoundIndexedOp(this.op, op)); |
4831 |
|
} |
4832 |
|
|
4833 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
4833 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
4834 |
|
(DoubleToObject<? extends U> op) { |
4835 |
|
return new OFOCPap<T,U>(ex, origin, fence, array, selector, |
4836 |
|
compoundIndexedOp(this.op, op)); |
5068 |
|
compoundIndexedOp(this.op, op)); |
5069 |
|
} |
5070 |
|
|
5071 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
5071 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
5072 |
|
(DoubleToObject<? extends U> op) { |
5073 |
|
return new OROCPap<T,U>(ex, origin, fence, array, selector, |
5074 |
|
compoundIndexedOp(this.op, op)); |
5283 |
|
} |
5284 |
|
|
5285 |
|
// long-combined |
5286 |
< |
static abstract class OLMPap<T> extends ParallelArrayWithLongMapping<T> { |
5286 |
> |
abstract static class OLMPap<T> extends ParallelArrayWithLongMapping<T> { |
5287 |
|
final ObjectToLong<? super T> op; |
5288 |
|
OLMPap(ForkJoinPool ex, int origin, int fence, |
5289 |
|
T[] array, final ObjectToLong<? super T> op) { |
5312 |
|
} |
5313 |
|
} |
5314 |
|
|
5315 |
< |
static abstract class DLMPap extends ParallelDoubleArrayWithLongMapping { |
5315 |
> |
abstract static class DLMPap extends ParallelDoubleArrayWithLongMapping { |
5316 |
|
final DoubleToLong op; |
5317 |
|
DLMPap(ForkJoinPool ex, int origin, int fence, |
5318 |
|
double[] array, DoubleToLong op) { |
5342 |
|
|
5343 |
|
} |
5344 |
|
|
5345 |
< |
static abstract class LLMPap extends ParallelLongArrayWithLongMapping { |
5345 |
> |
abstract static class LLMPap extends ParallelLongArrayWithLongMapping { |
5346 |
|
final LongOp op; |
5347 |
|
LLMPap(ForkJoinPool ex, int origin, int fence, |
5348 |
|
long[] array, LongOp op) { |
5389 |
|
CommonOps.compoundOp(this.op, op)); |
5390 |
|
} |
5391 |
|
|
5392 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
5392 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
5393 |
|
(LongToObject<? extends U> op) { |
5394 |
|
return new OUOMPap<T,U>(ex, origin, fence, array, |
5395 |
|
CommonOps.compoundOp(this.op, op)); |
5578 |
|
CommonOps.compoundOp(this.op, op)); |
5579 |
|
} |
5580 |
|
|
5581 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
5581 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
5582 |
|
(LongToObject<? extends U> op) { |
5583 |
|
return new OFOMPap<T,U>(ex, origin, fence, array, selector, |
5584 |
|
CommonOps.compoundOp(this.op, op)); |
5818 |
|
CommonOps.compoundOp(this.op, op)); |
5819 |
|
} |
5820 |
|
|
5821 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
5821 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
5822 |
|
(LongToObject<? extends U> op) { |
5823 |
|
return new OROMPap<T,U>(ex, origin, fence, array, selector, |
5824 |
|
CommonOps.compoundOp(this.op, op)); |
6034 |
|
} |
6035 |
|
|
6036 |
|
// long-combined |
6037 |
< |
static abstract class OLCPap<T> extends ParallelArrayWithLongMapping<T> { |
6037 |
> |
abstract static class OLCPap<T> extends ParallelArrayWithLongMapping<T> { |
6038 |
|
final IntAndObjectToLong<? super T> op; |
6039 |
|
OLCPap(ForkJoinPool ex, int origin, int fence, |
6040 |
|
T[] array, IntAndObjectToLong<? super T> op) { |
6065 |
|
} |
6066 |
|
} |
6067 |
|
|
6068 |
< |
static abstract class DLCPap extends ParallelDoubleArrayWithLongMapping { |
6068 |
> |
abstract static class DLCPap extends ParallelDoubleArrayWithLongMapping { |
6069 |
|
final IntAndDoubleToLong op; |
6070 |
|
DLCPap(ForkJoinPool ex, int origin, int fence, |
6071 |
|
double[] array, IntAndDoubleToLong op) { |
6096 |
|
} |
6097 |
|
} |
6098 |
|
|
6099 |
< |
static abstract class LLCPap extends ParallelLongArrayWithLongMapping { |
6099 |
> |
abstract static class LLCPap extends ParallelLongArrayWithLongMapping { |
6100 |
|
final IntAndLongToLong op; |
6101 |
|
LLCPap(ForkJoinPool ex, int origin, int fence, |
6102 |
|
long[] array, IntAndLongToLong op) { |
6144 |
|
compoundIndexedOp(this.op, op)); |
6145 |
|
} |
6146 |
|
|
6147 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
6147 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
6148 |
|
(LongToObject<? extends U> op) { |
6149 |
|
return new OUOCPap<T,U>(ex, origin, fence, array, |
6150 |
|
compoundIndexedOp(this.op, op)); |
6329 |
|
compoundIndexedOp(this.op, op)); |
6330 |
|
} |
6331 |
|
|
6332 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
6332 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
6333 |
|
(LongToObject<? extends U> op) { |
6334 |
|
return new OFOCPap<T,U>(ex, origin, fence, array, |
6335 |
|
selector, |
6571 |
|
compoundIndexedOp(this.op, op)); |
6572 |
|
} |
6573 |
|
|
6574 |
< |
public <U> ParallelArrayWithMapping<T, U> withMapping |
6574 |
> |
public <U> ParallelArrayWithMapping<T,U> withMapping |
6575 |
|
(LongToObject<? extends U> op) { |
6576 |
|
return new OROCPap<T,U>(ex, origin, fence, array, |
6577 |
|
selector, |
6821 |
|
int cursor; |
6822 |
|
FilteredAsDoubleIterator() { |
6823 |
|
cursor = origin; |
6824 |
< |
advance() ; |
6824 |
> |
advance(); |
6825 |
|
} |
6826 |
|
private void advance() { |
6827 |
|
while (cursor < fence) { |
6874 |
|
int cursor; |
6875 |
|
FilteredAsLongIterator() { |
6876 |
|
cursor = origin; |
6877 |
< |
advance() ; |
6877 |
> |
advance(); |
6878 |
|
} |
6879 |
|
private void advance() { |
6880 |
|
while (cursor < fence) { |
6927 |
|
int cursor; |
6928 |
|
FilteredIterator() { |
6929 |
|
cursor = origin; |
6930 |
< |
advance() ; |
6930 |
> |
advance(); |
6931 |
|
} |
6932 |
|
private void advance() { |
6933 |
|
while (cursor < fence) { |
7884 |
|
}; |
7885 |
|
} |
7886 |
|
|
7887 |
< |
static IntAndDoublePredicate compoundIndexedSelector |
7887 |
> |
static IntAndDoublePredicate compoundIndexedSelector |
7888 |
|
(final IntAndDoublePredicate fst, final IntAndDoublePredicate snd) { |
7889 |
|
return new IntAndDoublePredicate() { |
7890 |
|
public boolean op(int i, double a) { return fst.op(i, a) && snd.op(i, a); } |
7891 |
|
}; |
7892 |
|
} |
7893 |
|
|
7894 |
< |
static IntAndDoublePredicate compoundIndexedSelector |
7894 |
> |
static IntAndDoublePredicate compoundIndexedSelector |
7895 |
|
(final IntAndDoublePredicate fst, final DoublePredicate snd) { |
7896 |
|
return new IntAndDoublePredicate() { |
7897 |
|
public boolean op(int i, double a) { return fst.op(i, a) && snd.op(a); } |
7905 |
|
}; |
7906 |
|
} |
7907 |
|
|
7908 |
< |
static IntAndLongPredicate compoundIndexedSelector |
7908 |
> |
static IntAndLongPredicate compoundIndexedSelector |
7909 |
|
(final IntAndLongPredicate fst, final IntAndLongPredicate snd) { |
7910 |
|
return new IntAndLongPredicate() { |
7911 |
|
public boolean op(int i, long a) { return fst.op(i, a) && snd.op(i, a); } |
7912 |
|
}; |
7913 |
|
} |
7914 |
|
|
7915 |
< |
static IntAndLongPredicate compoundIndexedSelector |
7915 |
> |
static IntAndLongPredicate compoundIndexedSelector |
7916 |
|
(final IntAndLongPredicate fst, final LongPredicate snd) { |
7917 |
|
return new IntAndLongPredicate() { |
7918 |
|
public boolean op(int i, long a) { return fst.op(i, a) && snd.op(a); } |