--- jsr166/src/extra166y/ParallelDoubleArray.java 2009/01/06 14:30:58 1.1 +++ jsr166/src/extra166y/ParallelDoubleArray.java 2012/12/30 02:05:53 1.8 @@ -1,7 +1,7 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ package extra166y; @@ -61,7 +61,7 @@ public class ParallelDoubleArray extends /** * Creates a new ParallelDoubleArray using the given executor and - * an array of the given size + * an array of the given size. * @param size the array size * @param executor the executor */ @@ -137,30 +137,30 @@ public class ParallelDoubleArray extends * mapped ParallelDoubleArray. */ public static interface SummaryStatistics { - /** Return the number of elements */ + /** Returns the number of elements */ public int size(); - /** Return the minimum element, or Double.MAX_VALUE if empty */ + /** Returns the minimum element, or Double.MAX_VALUE if empty */ public double min(); - /** Return the maximum element, or -Double.MAX_VALUE if empty */ + /** Returns the maximum element, or -Double.MAX_VALUE if empty */ public double max(); - /** Return the index of the minimum element, or -1 if empty */ + /** Returns the index of the minimum element, or -1 if empty */ public int indexOfMin(); - /** Return the index of the maximum element, or -1 if empty */ + /** Returns the index of the maximum element, or -1 if empty */ public int indexOfMax(); - /** Return the sum of all elements */ + /** Returns the sum of all elements */ public double sum(); - /** Return the arithmetic average of all elements */ + /** Returns the arithmetic average of all elements */ public double average(); } /** - * Returns the executor used for computations + * Returns the executor used for computations. * @return the executor */ public ForkJoinPool getExecutor() { return ex; } /** - * Applies the given procedure to elements + * Applies the given procedure to elements. * @param procedure the procedure */ public void apply(DoubleProcedure procedure) { @@ -168,7 +168,7 @@ public class ParallelDoubleArray extends } /** - * Returns reduction of elements + * Returns reduction of elements. * @param reducer the reducer * @param base the result for an empty array * @return reduction @@ -178,7 +178,7 @@ public class ParallelDoubleArray extends } /** - * Returns a new ParallelDoubleArray holding all elements + * Returns a new ParallelDoubleArray holding all elements. * @return a new ParallelDoubleArray holding all elements */ public ParallelDoubleArray all() { @@ -191,7 +191,7 @@ public class ParallelDoubleArray extends * @param op the op * @return this (to simplify use in expressions) */ - public ParallelDoubleArray replaceWithMapping(DoubleOp op) { + public ParallelDoubleArray replaceWithMapping(DoubleOp op) { super.replaceWithMapping(op); return this; } @@ -209,7 +209,7 @@ public class ParallelDoubleArray extends /** * Replaces elements with the results of applying the given - * mapping to each index and current element value + * mapping to each index and current element value. * @param op the op * @return this (to simplify use in expressions) */ @@ -222,7 +222,7 @@ public class ParallelDoubleArray extends * Replaces elements with the results of applying the given * generator. For example, to fill the array with uniform random * values, use - * replaceWithGeneratedValue(Ops.doubleRandom()) + * replaceWithGeneratedValue(Ops.doubleRandom()). * @param generator the generator * @return this (to simplify use in expressions) */ @@ -243,7 +243,7 @@ public class ParallelDoubleArray extends /** * Replaces elements with results of applying - * op(thisElement, otherElement) + * op(thisElement, otherElement). * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) @@ -258,7 +258,7 @@ public class ParallelDoubleArray extends /** * Replaces elements with results of applying - * op(thisElement, otherElement) + * op(thisElement, otherElement). * @param other the other array * @param combiner the combiner * @return this (to simplify use in expressions) @@ -273,7 +273,7 @@ public class ParallelDoubleArray extends /** * Returns the index of some element equal to given target, or -1 - * if not present + * if not present. * @param target the element to search for * @return the index or -1 if not present */ @@ -310,7 +310,7 @@ public class ParallelDoubleArray extends * to locate minimum and maximum elements. * @param comparator the comparator to use for * locating minimum and maximum elements - * @return the summary. + * @return the summary */ public ParallelDoubleArray.SummaryStatistics summary (DoubleComparator comparator) { @@ -318,15 +318,15 @@ public class ParallelDoubleArray extends } /** - * Returns summary statistics, using natural comparator - * @return the summary. + * Returns summary statistics, using natural comparator. + * @return the summary */ public ParallelDoubleArray.SummaryStatistics summary() { return super.summary(); } /** - * Returns the minimum element, or Double.MAX_VALUE if empty + * Returns the minimum element, or Double.MAX_VALUE if empty. * @param comparator the comparator * @return minimum element, or Double.MAX_VALUE if empty */ @@ -335,7 +335,7 @@ public class ParallelDoubleArray extends } /** - * Returns the minimum element, or Double.MAX_VALUE if empty, + * Returns the minimum element, or Double.MAX_VALUE if empty. * @return minimum element, or Double.MAX_VALUE if empty */ public double min() { @@ -343,7 +343,7 @@ public class ParallelDoubleArray extends } /** - * Returns the maximum element, or -Double.MAX_VALUE if empty + * Returns the maximum element, or -Double.MAX_VALUE if empty. * @param comparator the comparator * @return maximum element, or -Double.MAX_VALUE if empty */ @@ -352,7 +352,7 @@ public class ParallelDoubleArray extends } /** - * Returns the maximum element, or -Double.MAX_VALUE if empty + * Returns the maximum element, or -Double.MAX_VALUE if empty. * @return maximum element, or -Double.MAX_VALUE if empty */ public double max() { @@ -406,7 +406,7 @@ public class ParallelDoubleArray extends * Sorts the array, assuming all elements are Comparable. Unlike * Arrays.sort, this sort does not guarantee that elements * with equal keys maintain their relative position in the array. - * @throws ClassCastException if any element is not Comparable. + * @throws ClassCastException if any element is not Comparable * @return this (to simplify use in expressions) */ public ParallelDoubleArray sort() { @@ -502,6 +502,7 @@ public class ParallelDoubleArray extends removeSlotsAt(f.offset, fence); return this; } + /** * Returns true if all elements at the same relative positions * of this and other array are equal. @@ -514,7 +515,7 @@ public class ParallelDoubleArray extends } /** - * Returns the sum of elements + * Returns the sum of elements. * @return the sum of elements */ public double sum() { @@ -522,7 +523,7 @@ public class ParallelDoubleArray extends } /** - * Replaces each element with the running sum + * Replaces each element with the running sum. * @return this (to simplify use in expressions) */ public ParallelDoubleArray cumulateSum() { @@ -531,7 +532,7 @@ public class ParallelDoubleArray extends } /** - * Replaces each element with its prefix sum + * Replaces each element with its prefix sum. * @return the total sum */ public double precumulateSum() { @@ -554,7 +555,7 @@ public class ParallelDoubleArray extends /** * Returns an operation prefix that causes a method to operate * only on the elements of the array for which the given selector - * returns true + * returns true. * @param selector the selector * @return operation prefix */ @@ -565,7 +566,7 @@ public class ParallelDoubleArray extends /** * Returns an operation prefix that causes a method to operate * only on elements for which the given binary selector returns - * true + * true. * @param selector the selector * @return operation prefix */ @@ -578,7 +579,7 @@ public class ParallelDoubleArray extends /** * Returns an operation prefix that causes a method to operate * only on elements for which the given indexed selector returns - * true + * true. * @param selector the selector * @return operation prefix */ @@ -625,7 +626,7 @@ public class ParallelDoubleArray extends * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a - * filtered view (all filters must precede all mappings). + * filtered view (all filters must precede all mappings) */ public ParallelDoubleArrayWithMapping withMapping (DoubleAndObjectToObject combiner, @@ -640,7 +641,7 @@ public class ParallelDoubleArray extends * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a - * filtered view (all filters must precede all mappings). + * filtered view (all filters must precede all mappings) */ public ParallelDoubleArrayWithMapping withMapping (DoubleAndDoubleToObject combiner, @@ -655,7 +656,7 @@ public class ParallelDoubleArray extends * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a - * filtered view (all filters must precede all mappings). + * filtered view (all filters must precede all mappings) */ public ParallelDoubleArrayWithMapping withMapping (DoubleAndLongToObject combiner, @@ -670,7 +671,7 @@ public class ParallelDoubleArray extends * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a - * filtered view (all filters must precede all mappings). + * filtered view (all filters must precede all mappings) */ public ParallelDoubleArrayWithDoubleMapping withMapping (DoubleAndObjectToDouble combiner, @@ -685,7 +686,7 @@ public class ParallelDoubleArray extends * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a - * filtered view (all filters must precede all mappings). + * filtered view (all filters must precede all mappings) */ public ParallelDoubleArrayWithDoubleMapping withMapping (BinaryDoubleOp combiner, @@ -700,7 +701,7 @@ public class ParallelDoubleArray extends * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a - * filtered view (all filters must precede all mappings). + * filtered view (all filters must precede all mappings) */ public ParallelDoubleArrayWithDoubleMapping withMapping (DoubleAndLongToDouble combiner, @@ -715,7 +716,7 @@ public class ParallelDoubleArray extends * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a - * filtered view (all filters must precede all mappings). + * filtered view (all filters must precede all mappings) */ public ParallelDoubleArrayWithLongMapping withMapping (DoubleAndObjectToLong combiner, @@ -730,7 +731,7 @@ public class ParallelDoubleArray extends * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a - * filtered view (all filters must precede all mappings). + * filtered view (all filters must precede all mappings) */ public ParallelDoubleArrayWithLongMapping withMapping (DoubleAndDoubleToLong combiner, @@ -745,7 +746,7 @@ public class ParallelDoubleArray extends * @param other the other array * @return operation prefix * @throws IllegalArgumentException if other array is a - * filtered view (all filters must precede all mappings). + * filtered view (all filters must precede all mappings) */ public ParallelDoubleArrayWithLongMapping withMapping (DoubleAndLongToLong combiner, @@ -798,7 +799,7 @@ public class ParallelDoubleArray extends * support the remove operation. However, a full * ListIterator supporting add, remove, and set * operations is available via {@link #asList}. - * @return an iterator stepping through each element. + * @return an iterator stepping through each element */ public Iterator iterator() { return new ParallelDoubleArrayIterator(array, fence); @@ -851,27 +852,27 @@ public class ParallelDoubleArray extends public int size() { return fence; } /** - * Returns the underlying array used for computations + * Returns the underlying array used for computations. * @return the array */ public double[] getArray() { return array; } /** - * Returns the element of the array at the given index + * Returns the element of the array at the given index. * @param i the index * @return the element of the array at the given index */ public double get(int i) { return array[i]; } /** - * Sets the element of the array at the given index to the given value + * Sets the element of the array at the given index to the given value. * @param i the index * @param x the value */ public void set(int i, double x) { array[i] = x; } /** - * Equivalent to asList().toString() + * Equivalent to asList().toString(). * @return a string representation */ public String toString() { @@ -885,7 +886,7 @@ public class ParallelDoubleArray extends * than the length of the underlying array, causes computations to * ignore elements past the given limit. * @param newLimit the new upper bound - * @throws IllegalArgumentException if newLimit less than zero. + * @throws IllegalArgumentException if newLimit less than zero */ public final void setLimit(int newLimit) { if (newLimit < 0) @@ -922,7 +923,7 @@ public class ParallelDoubleArray extends } /** - * Make len slots available at index + * Makes len slots available at index. */ final void insertSlotsAt(int index, int len) { if (len <= 0) @@ -1164,4 +1165,3 @@ public class ParallelDoubleArray extends } } -