--- jsr166/src/extra166y/ParallelArrayWithMapping.java 2009/01/06 14:30:58 1.1 +++ jsr166/src/extra166y/ParallelArrayWithMapping.java 2015/01/18 20:17:32 1.7 @@ -1,10 +1,11 @@ /* * 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; + import jsr166y.*; import static extra166y.Ops.*; import java.util.*; @@ -24,7 +25,7 @@ public abstract class ParallelArrayWithM } /** - * Applies the given procedure to elements + * Applies the given procedure to elements. * @param procedure the procedure */ public void apply(Procedure procedure) { @@ -32,7 +33,7 @@ public abstract class ParallelArrayWithM } /** - * Returns reduction of elements + * Returns reduction of elements. * @param reducer the reducer * @param base the result for an empty array * @return reduction @@ -47,15 +48,15 @@ public abstract class ParallelArrayWithM /** * Returns some element matching bound and filter * constraints, or null if none. - * @return an element, or null if none. + * @return an element, or null if none */ public U any() { int i = anyIndex(); - return (i < 0)? null : (U)oget(i); + return (i < 0) ? null : (U)oget(i); } /** - * Returns the minimum element, or null if empty + * Returns the minimum element, or null if empty. * @param comparator the comparator * @return minimum element, or null if empty */ @@ -65,16 +66,16 @@ public abstract class ParallelArrayWithM /** * Returns the minimum element, or null if empty, - * assuming that all elements are Comparables + * assuming that all elements are Comparables. * @return minimum element, or null if empty - * @throws ClassCastException if any element is not Comparable. + * @throws ClassCastException if any element is not Comparable */ public U min() { return reduce((Reducer)(CommonOps.castedMinReducer()), null); } /** - * Returns the maximum element, or null if empty + * Returns the maximum element, or null if empty. * @param comparator the comparator * @return maximum element, or null if empty */ @@ -83,10 +84,10 @@ public abstract class ParallelArrayWithM } /** - * Returns the maximum element, or null if empty - * assuming that all elements are Comparables + * Returns the maximum element, or null if empty, + * assuming that all elements are Comparables. * @return maximum element, or null if empty - * @throws ClassCastException if any element is not Comparable. + * @throws ClassCastException if any element is not Comparable */ public U max() { return reduce((Reducer)(CommonOps.castedMaxReducer()), null); @@ -97,7 +98,7 @@ public abstract class ParallelArrayWithM * 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 ParallelArray.SummaryStatistics summary (Comparator comparator) { @@ -109,15 +110,15 @@ public abstract class ParallelArrayWithM /** * Returns summary statistics, assuming that all elements are - * Comparables - * @return the summary. + * Comparables. + * @return the summary */ public ParallelArray.SummaryStatistics summary() { return summary((Comparator)(CommonOps.castedComparator())); } /** - * Returns a new ParallelArray holding elements + * Returns a new ParallelArray holding elements. * @return a new ParallelArray holding elements */ public ParallelArray all() { @@ -126,7 +127,7 @@ public abstract class ParallelArrayWithM /** * Returns a new ParallelArray with the given element type - * holding elements + * holding elements. * @param elementType the type of the elements * @return a new ParallelArray holding elements */ @@ -137,17 +138,17 @@ public abstract class ParallelArrayWithM /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op - * applied to current op's results + * applied to current op's results. * @param op the op * @return operation prefix */ - public abstract ParallelArrayWithMapping withMapping + public abstract ParallelArrayWithMapping withMapping (Op op); /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op - * applied to current op's results + * applied to current op's results. * @param op the op * @return operation prefix */ @@ -157,7 +158,7 @@ public abstract class ParallelArrayWithM /** * Returns an operation prefix that causes a method to operate * on mapped elements of the array using the given op - * applied to current op's results + * applied to current op's results. * @param op the op * @return operation prefix */ @@ -171,7 +172,7 @@ public abstract class ParallelArrayWithM * @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 ParallelArrayWithMapping withMapping (BinaryOp combiner, @@ -188,7 +189,7 @@ public abstract class ParallelArrayWithM * @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 ParallelArrayWithMapping withMapping (ObjectAndDoubleToObject combiner, @@ -205,7 +206,7 @@ public abstract class ParallelArrayWithM * @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 ParallelArrayWithMapping withMapping (ObjectAndLongToObject combiner, @@ -222,7 +223,7 @@ public abstract class ParallelArrayWithM * @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 ParallelArrayWithDoubleMapping withMapping (ObjectAndObjectToDouble combiner, @@ -239,7 +240,7 @@ public abstract class ParallelArrayWithM * @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 ParallelArrayWithDoubleMapping withMapping (ObjectAndDoubleToDouble combiner, @@ -256,7 +257,7 @@ public abstract class ParallelArrayWithM * @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 ParallelArrayWithDoubleMapping withMapping (ObjectAndLongToDouble combiner, @@ -273,7 +274,7 @@ public abstract class ParallelArrayWithM * @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 ParallelArrayWithLongMapping withMapping (ObjectAndObjectToLong combiner, @@ -290,7 +291,7 @@ public abstract class ParallelArrayWithM * @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 ParallelArrayWithLongMapping withMapping (ObjectAndDoubleToLong combiner, @@ -307,7 +308,7 @@ public abstract class ParallelArrayWithM * @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 ParallelArrayWithLongMapping withMapping (ObjectAndLongToLong combiner, @@ -356,7 +357,7 @@ public abstract class ParallelArrayWithM /** * Returns an Iterable view to sequentially step through mapped * elements also obeying bound and filter constraints, without - * performing computations to evaluate them in parallel + * performing computations to evaluate them in parallel. * @return the Iterable view */ public Iterable sequentially() { @@ -364,4 +365,3 @@ public abstract class ParallelArrayWithM } } -