101 |
|
|
102 |
|
/** |
103 |
|
* Creates a new ParallelLongArray using the given executor and |
104 |
< |
* an array of the given size |
104 |
> |
* an array of the given size. |
105 |
|
* @param size the array size |
106 |
|
* @param executor the executor |
107 |
|
*/ |
194 |
|
} |
195 |
|
|
196 |
|
/** |
197 |
< |
* Returns the executor used for computations |
197 |
> |
* Returns the executor used for computations. |
198 |
|
* @return the executor |
199 |
|
*/ |
200 |
|
public ForkJoinPool getExecutor() { return ex; } |
201 |
|
|
202 |
|
/** |
203 |
< |
* Applies the given procedure to elements |
203 |
> |
* Applies the given procedure to elements. |
204 |
|
* @param procedure the procedure |
205 |
|
*/ |
206 |
|
public void apply(LongProcedure procedure) { |
208 |
|
} |
209 |
|
|
210 |
|
/** |
211 |
< |
* Returns reduction of elements |
211 |
> |
* Returns reduction of elements. |
212 |
|
* @param reducer the reducer |
213 |
|
* @param base the result for an empty array |
214 |
|
* @return reduction |
218 |
|
} |
219 |
|
|
220 |
|
/** |
221 |
< |
* Returns a new ParallelLongArray holding all elements |
221 |
> |
* Returns a new ParallelLongArray holding all elements. |
222 |
|
* @return a new ParallelLongArray holding all elements |
223 |
|
*/ |
224 |
|
public ParallelLongArray all() { |
249 |
|
|
250 |
|
/** |
251 |
|
* Replaces elements with the results of applying the given |
252 |
< |
* mapping to each index and current element value |
252 |
> |
* mapping to each index and current element value. |
253 |
|
* @param op the op |
254 |
|
* @return this (to simplify use in expressions) |
255 |
|
*/ |
262 |
|
* Replaces elements with the results of applying the given |
263 |
|
* generator. For example, to fill the array with uniform random |
264 |
|
* values, use |
265 |
< |
* <tt>replaceWithGeneratedValue(Ops.longRandom())</tt> |
265 |
> |
* {@code replaceWithGeneratedValue(Ops.longRandom())}. |
266 |
|
* @param generator the generator |
267 |
|
* @return this (to simplify use in expressions) |
268 |
|
*/ |
283 |
|
|
284 |
|
/** |
285 |
|
* Replaces elements with results of applying |
286 |
< |
* <tt>op(thisElement, otherElement)</tt> |
286 |
> |
* {@code op(thisElement, otherElement)}. |
287 |
|
* @param other the other array |
288 |
|
* @param combiner the combiner |
289 |
|
* @return this (to simplify use in expressions) |
297 |
|
|
298 |
|
/** |
299 |
|
* Replaces elements with results of applying |
300 |
< |
* <tt>op(thisElement, otherElement)</tt> |
300 |
> |
* {@code op(thisElement, otherElement)}. |
301 |
|
* @param other the other array |
302 |
|
* @param combiner the combiner |
303 |
|
* @return this (to simplify use in expressions) |
304 |
|
* @throws ArrayIndexOutOfBoundsException if other array has |
305 |
< |
* fewer elements than this array. |
305 |
> |
* fewer elements than this array |
306 |
|
*/ |
307 |
|
public ParallelLongArray replaceWithMapping(BinaryLongOp combiner, |
308 |
|
long[] other) { |
312 |
|
|
313 |
|
/** |
314 |
|
* Returns the index of some element equal to given target, or -1 |
315 |
< |
* if not present |
315 |
> |
* if not present. |
316 |
|
* @param target the element to search for |
317 |
|
* @return the index or -1 if not present |
318 |
|
*/ |
401 |
|
/** |
402 |
|
* Replaces each element with the running cumulation of applying |
403 |
|
* the given reducer. For example, if the contents are the numbers |
404 |
< |
* <tt>1, 2, 3</tt>, and the reducer operation adds numbers, then |
405 |
< |
* after invocation of this method, the contents would be <tt>1, |
406 |
< |
* 3, 6</tt> (that is, <tt>1, 1+2, 1+2+3</tt>); |
404 |
> |
* {@code 1, 2, 3}, and the reducer operation adds numbers, then |
405 |
> |
* after invocation of this method, the contents would be {@code 1, |
406 |
> |
* 3, 6} (that is, {@code 1, 1+2, 1+2+3}). |
407 |
|
* @param reducer the reducer |
408 |
|
* @param base the result for an empty array |
409 |
|
* @return this (to simplify use in expressions) |
416 |
|
/** |
417 |
|
* Replaces each element with the cumulation of applying the given |
418 |
|
* reducer to all previous values, and returns the total |
419 |
< |
* reduction. For example, if the contents are the numbers <tt>1, |
420 |
< |
* 2, 3</tt>, and the reducer operation adds numbers, then after |
421 |
< |
* invocation of this method, the contents would be <tt>0, 1, |
422 |
< |
* 3</tt> (that is, <tt>0, 0+1, 0+1+2</tt>, and the return value |
423 |
< |
* would be 6 (that is, <tt> 1+2+3</tt>); |
419 |
> |
* reduction. For example, if the contents are the numbers {@code 1, |
420 |
> |
* 2, 3}, and the reducer operation adds numbers, then after |
421 |
> |
* invocation of this method, the contents would be {@code 0, 1, |
422 |
> |
* 3} (that is, {@code 0, 0+1, 0+1+2}, and the return value |
423 |
> |
* would be 6 (that is, {@code 1+2+3}). |
424 |
|
* @param reducer the reducer |
425 |
|
* @param base the result for an empty array |
426 |
|
* @return the total reduction |
445 |
|
* Sorts the array, assuming all elements are Comparable. Unlike |
446 |
|
* Arrays.sort, this sort does not guarantee that elements |
447 |
|
* with equal keys maintain their relative position in the array. |
448 |
– |
* @throws ClassCastException if any element is not Comparable |
448 |
|
* @return this (to simplify use in expressions) |
449 |
+ |
* @throws ClassCastException if any element is not Comparable |
450 |
|
*/ |
451 |
|
public ParallelLongArray sort() { |
452 |
|
super.sort(); |
478 |
|
} |
479 |
|
|
480 |
|
/** |
481 |
< |
* Equivalent to <tt>asList().addAll</tt> but specialized for array |
481 |
> |
* Equivalent to {@code asList().addAll} but specialized for array |
482 |
|
* arguments and likely to be more efficient. |
483 |
|
* @param other the elements to add |
484 |
|
* @return this (to simplify use in expressions) |
835 |
|
* Returns an iterator stepping through each element of the array |
836 |
|
* up to the current limit. This iterator does <em>not</em> |
837 |
|
* support the remove operation. However, a full |
838 |
< |
* <tt>ListIterator</tt> supporting add, remove, and set |
838 |
> |
* {@code ListIterator} supporting add, remove, and set |
839 |
|
* operations is available via {@link #asList}. |
840 |
|
* @return an iterator stepping through each element |
841 |
|
*/ |
909 |
|
public void set(int i, long x) { array[i] = x; } |
910 |
|
|
911 |
|
/** |
912 |
< |
* Equivalent to <tt>asList().toString()</tt> |
912 |
> |
* Equivalent to {@code asList().toString()}. |
913 |
|
* @return a string representation |
914 |
|
*/ |
915 |
|
public String toString() { |