349 |
|
* to locate minimum and maximum elements. |
350 |
|
* @param comparator the comparator to use for |
351 |
|
* locating minimum and maximum elements |
352 |
< |
* @return the summary. |
352 |
> |
* @return the summary |
353 |
|
*/ |
354 |
|
public ParallelLongArray.SummaryStatistics summary |
355 |
|
(LongComparator comparator) { |
357 |
|
} |
358 |
|
|
359 |
|
/** |
360 |
< |
* Returns summary statistics, using natural comparator |
361 |
< |
* @return the summary. |
360 |
> |
* Returns summary statistics, using natural comparator. |
361 |
> |
* @return the summary |
362 |
|
*/ |
363 |
|
public ParallelLongArray.SummaryStatistics summary() { |
364 |
|
return super.summary(); |
365 |
|
} |
366 |
|
|
367 |
|
/** |
368 |
< |
* Returns the minimum element, or Long.MAX_VALUE if empty |
368 |
> |
* Returns the minimum element, or Long.MAX_VALUE if empty. |
369 |
|
* @param comparator the comparator |
370 |
|
* @return minimum element, or Long.MAX_VALUE if empty |
371 |
|
*/ |
374 |
|
} |
375 |
|
|
376 |
|
/** |
377 |
< |
* Returns the minimum element, or Long.MAX_VALUE if empty, |
377 |
> |
* Returns the minimum element, or Long.MAX_VALUE if empty. |
378 |
|
* @return minimum element, or Long.MAX_VALUE if empty |
379 |
|
*/ |
380 |
|
public long min() { |
382 |
|
} |
383 |
|
|
384 |
|
/** |
385 |
< |
* Returns the maximum element, or Long.MIN_VALUE if empty |
385 |
> |
* Returns the maximum element, or Long.MIN_VALUE if empty. |
386 |
|
* @param comparator the comparator |
387 |
|
* @return maximum element, or Long.MIN_VALUE if empty |
388 |
|
*/ |
391 |
|
} |
392 |
|
|
393 |
|
/** |
394 |
< |
* Returns the maximum element, or Long.MIN_VALUE if empty |
394 |
> |
* Returns the maximum element, or Long.MIN_VALUE if empty. |
395 |
|
* @return maximum element, or Long.MIN_VALUE if empty |
396 |
|
*/ |
397 |
|
public long max() { |
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 |
> |
* @throws ClassCastException if any element is not Comparable |
449 |
|
* @return this (to simplify use in expressions) |
450 |
|
*/ |
451 |
|
public ParallelLongArray sort() { |
552 |
|
} |
553 |
|
|
554 |
|
/** |
555 |
< |
* Returns the sum of elements |
555 |
> |
* Returns the sum of elements. |
556 |
|
* @return the sum of elements |
557 |
|
*/ |
558 |
|
public long sum() { |
560 |
|
} |
561 |
|
|
562 |
|
/** |
563 |
< |
* Replaces each element with the running sum |
563 |
> |
* Replaces each element with the running sum. |
564 |
|
* @return this (to simplify use in expressions) |
565 |
|
*/ |
566 |
|
public ParallelLongArray cumulateSum() { |
569 |
|
} |
570 |
|
|
571 |
|
/** |
572 |
< |
* Replaces each element with its prefix sum |
572 |
> |
* Replaces each element with its prefix sum. |
573 |
|
* @return the total sum |
574 |
|
*/ |
575 |
|
public long precumulateSum() { |
592 |
|
/** |
593 |
|
* Returns an operation prefix that causes a method to operate |
594 |
|
* only on the elements of the array for which the given selector |
595 |
< |
* returns true |
595 |
> |
* returns true. |
596 |
|
* @param selector the selector |
597 |
|
* @return operation prefix |
598 |
|
*/ |
603 |
|
/** |
604 |
|
* Returns an operation prefix that causes a method to operate |
605 |
|
* only on elements for which the given binary selector returns |
606 |
< |
* true |
606 |
> |
* true. |
607 |
|
* @param selector the selector |
608 |
|
* @return operation prefix |
609 |
|
*/ |
616 |
|
/** |
617 |
|
* Returns an operation prefix that causes a method to operate |
618 |
|
* only on elements for which the given indexed selector returns |
619 |
< |
* true |
619 |
> |
* true. |
620 |
|
* @param selector the selector |
621 |
|
* @return operation prefix |
622 |
|
*/ |
664 |
|
* @param other the other array |
665 |
|
* @return operation prefix |
666 |
|
* @throws IllegalArgumentException if other array is a |
667 |
< |
* filtered view (all filters must precede all mappings). |
667 |
> |
* filtered view (all filters must precede all mappings) |
668 |
|
*/ |
669 |
|
public <V,W,X> ParallelLongArrayWithMapping<W> withMapping |
670 |
|
(LongAndObjectToObject<? super V, ? extends W> combiner, |
679 |
|
* @param other the other array |
680 |
|
* @return operation prefix |
681 |
|
* @throws IllegalArgumentException if other array is a |
682 |
< |
* filtered view (all filters must precede all mappings). |
682 |
> |
* filtered view (all filters must precede all mappings) |
683 |
|
*/ |
684 |
|
public <V> ParallelLongArrayWithMapping<V> withMapping |
685 |
|
(LongAndDoubleToObject<? extends V> combiner, |
694 |
|
* @param other the other array |
695 |
|
* @return operation prefix |
696 |
|
* @throws IllegalArgumentException if other array is a |
697 |
< |
* filtered view (all filters must precede all mappings). |
697 |
> |
* filtered view (all filters must precede all mappings) |
698 |
|
*/ |
699 |
|
public <V> ParallelLongArrayWithMapping<V> withMapping |
700 |
|
(LongAndLongToObject<? extends V> combiner, |
709 |
|
* @param other the other array |
710 |
|
* @return operation prefix |
711 |
|
* @throws IllegalArgumentException if other array is a |
712 |
< |
* filtered view (all filters must precede all mappings). |
712 |
> |
* filtered view (all filters must precede all mappings) |
713 |
|
*/ |
714 |
|
public <V,W> ParallelLongArrayWithDoubleMapping withMapping |
715 |
|
(LongAndObjectToDouble<? super V> combiner, |
724 |
|
* @param other the other array |
725 |
|
* @return operation prefix |
726 |
|
* @throws IllegalArgumentException if other array is a |
727 |
< |
* filtered view (all filters must precede all mappings). |
727 |
> |
* filtered view (all filters must precede all mappings) |
728 |
|
*/ |
729 |
|
public ParallelLongArrayWithDoubleMapping withMapping |
730 |
|
(LongAndDoubleToDouble combiner, |
739 |
|
* @param other the other array |
740 |
|
* @return operation prefix |
741 |
|
* @throws IllegalArgumentException if other array is a |
742 |
< |
* filtered view (all filters must precede all mappings). |
742 |
> |
* filtered view (all filters must precede all mappings) |
743 |
|
*/ |
744 |
|
public ParallelLongArrayWithDoubleMapping withMapping |
745 |
|
(LongAndLongToDouble combiner, |
754 |
|
* @param other the other array |
755 |
|
* @return operation prefix |
756 |
|
* @throws IllegalArgumentException if other array is a |
757 |
< |
* filtered view (all filters must precede all mappings). |
757 |
> |
* filtered view (all filters must precede all mappings) |
758 |
|
*/ |
759 |
|
public <V,W> ParallelLongArrayWithLongMapping withMapping |
760 |
|
(LongAndObjectToLong<? super V> combiner, |
769 |
|
* @param other the other array |
770 |
|
* @return operation prefix |
771 |
|
* @throws IllegalArgumentException if other array is a |
772 |
< |
* filtered view (all filters must precede all mappings). |
772 |
> |
* filtered view (all filters must precede all mappings) |
773 |
|
*/ |
774 |
|
public ParallelLongArrayWithLongMapping withMapping |
775 |
|
(LongAndDoubleToLong combiner, |
784 |
|
* @param other the other array |
785 |
|
* @return operation prefix |
786 |
|
* @throws IllegalArgumentException if other array is a |
787 |
< |
* filtered view (all filters must precede all mappings). |
787 |
> |
* filtered view (all filters must precede all mappings) |
788 |
|
*/ |
789 |
|
public ParallelLongArrayWithLongMapping withMapping |
790 |
|
(BinaryLongOp combiner, |
837 |
|
* support the remove operation. However, a full |
838 |
|
* <tt>ListIterator</tt> supporting add, remove, and set |
839 |
|
* operations is available via {@link #asList}. |
840 |
< |
* @return an iterator stepping through each element. |
840 |
> |
* @return an iterator stepping through each element |
841 |
|
*/ |
842 |
|
public Iterator<Long> iterator() { |
843 |
|
return new ParallelLongArrayIterator(array, fence); |
889 |
|
public int size() { return fence; } |
890 |
|
|
891 |
|
/** |
892 |
< |
* Returns the underlying array used for computations |
892 |
> |
* Returns the underlying array used for computations. |
893 |
|
* @return the array |
894 |
|
*/ |
895 |
|
public long[] getArray() { return array; } |
896 |
|
|
897 |
|
/** |
898 |
< |
* Returns the element of the array at the given index |
898 |
> |
* Returns the element of the array at the given index. |
899 |
|
* @param i the index |
900 |
|
* @return the element of the array at the given index |
901 |
|
*/ |
902 |
|
public long get(int i) { return array[i]; } |
903 |
|
|
904 |
|
/** |
905 |
< |
* Sets the element of the array at the given index to the given value |
905 |
> |
* Sets the element of the array at the given index to the given value. |
906 |
|
* @param i the index |
907 |
|
* @param x the value |
908 |
|
*/ |
923 |
|
* than the length of the underlying array, causes computations to |
924 |
|
* ignore elements past the given limit. |
925 |
|
* @param newLimit the new upper bound |
926 |
< |
* @throws IllegalArgumentException if newLimit less than zero. |
926 |
> |
* @throws IllegalArgumentException if newLimit less than zero |
927 |
|
*/ |
928 |
|
public final void setLimit(int newLimit) { |
929 |
|
if (newLimit < 0) |