5 |
|
*/ |
6 |
|
|
7 |
|
package extra166y; |
8 |
+ |
|
9 |
|
import jsr166y.*; |
10 |
|
import static extra166y.Ops.*; |
11 |
|
import java.util.*; |
263 |
|
* Replaces elements with the results of applying the given |
264 |
|
* generator. For example, to fill the array with uniform random |
265 |
|
* values, use |
266 |
< |
* <tt>replaceWithGeneratedValue(Ops.longRandom())</tt>. |
266 |
> |
* {@code replaceWithGeneratedValue(Ops.longRandom())}. |
267 |
|
* @param generator the generator |
268 |
|
* @return this (to simplify use in expressions) |
269 |
|
*/ |
284 |
|
|
285 |
|
/** |
286 |
|
* Replaces elements with results of applying |
287 |
< |
* <tt>op(thisElement, otherElement)</tt>. |
287 |
> |
* {@code op(thisElement, otherElement)}. |
288 |
|
* @param other the other array |
289 |
|
* @param combiner the combiner |
290 |
|
* @return this (to simplify use in expressions) |
298 |
|
|
299 |
|
/** |
300 |
|
* Replaces elements with results of applying |
301 |
< |
* <tt>op(thisElement, otherElement)</tt>. |
301 |
> |
* {@code op(thisElement, otherElement)}. |
302 |
|
* @param other the other array |
303 |
|
* @param combiner the combiner |
304 |
|
* @return this (to simplify use in expressions) |
305 |
|
* @throws ArrayIndexOutOfBoundsException if other array has |
306 |
< |
* fewer elements than this array. |
306 |
> |
* fewer elements than this array |
307 |
|
*/ |
308 |
|
public ParallelLongArray replaceWithMapping(BinaryLongOp combiner, |
309 |
|
long[] other) { |
402 |
|
/** |
403 |
|
* Replaces each element with the running cumulation of applying |
404 |
|
* the given reducer. For example, if the contents are the numbers |
405 |
< |
* <tt>1, 2, 3</tt>, and the reducer operation adds numbers, then |
406 |
< |
* after invocation of this method, the contents would be <tt>1, |
407 |
< |
* 3, 6</tt> (that is, <tt>1, 1+2, 1+2+3</tt>); |
405 |
> |
* {@code 1, 2, 3}, and the reducer operation adds numbers, then |
406 |
> |
* after invocation of this method, the contents would be {@code 1, |
407 |
> |
* 3, 6} (that is, {@code 1, 1+2, 1+2+3}). |
408 |
|
* @param reducer the reducer |
409 |
|
* @param base the result for an empty array |
410 |
|
* @return this (to simplify use in expressions) |
417 |
|
/** |
418 |
|
* Replaces each element with the cumulation of applying the given |
419 |
|
* reducer to all previous values, and returns the total |
420 |
< |
* reduction. For example, if the contents are the numbers <tt>1, |
421 |
< |
* 2, 3</tt>, and the reducer operation adds numbers, then after |
422 |
< |
* invocation of this method, the contents would be <tt>0, 1, |
423 |
< |
* 3</tt> (that is, <tt>0, 0+1, 0+1+2</tt>, and the return value |
424 |
< |
* would be 6 (that is, <tt> 1+2+3</tt>); |
420 |
> |
* reduction. For example, if the contents are the numbers {@code 1, |
421 |
> |
* 2, 3}, and the reducer operation adds numbers, then after |
422 |
> |
* invocation of this method, the contents would be {@code 0, 1, |
423 |
> |
* 3} (that is, {@code 0, 0+1, 0+1+2}, and the return value |
424 |
> |
* would be 6 (that is, {@code 1+2+3}). |
425 |
|
* @param reducer the reducer |
426 |
|
* @param base the result for an empty array |
427 |
|
* @return the total reduction |
446 |
|
* Sorts the array, assuming all elements are Comparable. Unlike |
447 |
|
* Arrays.sort, this sort does not guarantee that elements |
448 |
|
* with equal keys maintain their relative position in the array. |
448 |
– |
* @throws ClassCastException if any element is not Comparable |
449 |
|
* @return this (to simplify use in expressions) |
450 |
+ |
* @throws ClassCastException if any element is not Comparable |
451 |
|
*/ |
452 |
|
public ParallelLongArray sort() { |
453 |
|
super.sort(); |
479 |
|
} |
480 |
|
|
481 |
|
/** |
482 |
< |
* Equivalent to <tt>asList().addAll</tt> but specialized for array |
482 |
> |
* Equivalent to {@code asList().addAll} but specialized for array |
483 |
|
* arguments and likely to be more efficient. |
484 |
|
* @param other the elements to add |
485 |
|
* @return this (to simplify use in expressions) |
836 |
|
* Returns an iterator stepping through each element of the array |
837 |
|
* up to the current limit. This iterator does <em>not</em> |
838 |
|
* support the remove operation. However, a full |
839 |
< |
* <tt>ListIterator</tt> supporting add, remove, and set |
839 |
> |
* {@code ListIterator} supporting add, remove, and set |
840 |
|
* operations is available via {@link #asList}. |
841 |
|
* @return an iterator stepping through each element |
842 |
|
*/ |
910 |
|
public void set(int i, long x) { array[i] = x; } |
911 |
|
|
912 |
|
/** |
913 |
< |
* Equivalent to <tt>asList().toString()</tt> |
913 |
> |
* Equivalent to {@code asList().toString()}. |
914 |
|
* @return a string representation |
915 |
|
*/ |
916 |
|
public String toString() { |