ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/extra166y/ParallelDoubleArray.java
(Generate patch)

Comparing jsr166/src/extra166y/ParallelDoubleArray.java (file contents):
Revision 1.7 by jsr166, Sat Dec 29 23:55:19 2012 UTC vs.
Revision 1.14 by jsr166, Sun Jan 18 20:17:32 2015 UTC

# Line 5 | Line 5
5   */
6  
7   package extra166y;
8 +
9   import jsr166y.*;
10   import static extra166y.Ops.*;
11   import java.util.*;
# Line 61 | Line 62 | public class ParallelDoubleArray extends
62  
63      /**
64       * Creates a new ParallelDoubleArray using the given executor and
65 <     * an array of the given size
65 >     * an array of the given size.
66       * @param size the array size
67       * @param executor the executor
68       */
# Line 154 | Line 155 | public class ParallelDoubleArray extends
155      }
156  
157      /**
158 <     * Returns the executor used for computations
158 >     * Returns the executor used for computations.
159       * @return the executor
160       */
161      public ForkJoinPool getExecutor() { return ex; }
162  
163      /**
164 <     * Applies the given procedure to elements
164 >     * Applies the given procedure to elements.
165       * @param procedure the procedure
166       */
167      public void apply(DoubleProcedure procedure) {
# Line 168 | Line 169 | public class ParallelDoubleArray extends
169      }
170  
171      /**
172 <     * Returns reduction of elements
172 >     * Returns reduction of elements.
173       * @param reducer the reducer
174       * @param base the result for an empty array
175       * @return reduction
# Line 178 | Line 179 | public class ParallelDoubleArray extends
179      }
180  
181      /**
182 <     * Returns a new ParallelDoubleArray holding all elements
182 >     * Returns a new ParallelDoubleArray holding all elements.
183       * @return a new ParallelDoubleArray holding all elements
184       */
185      public ParallelDoubleArray all() {
# Line 209 | Line 210 | public class ParallelDoubleArray extends
210  
211      /**
212       * Replaces elements with the results of applying the given
213 <     * mapping to each index and current element value
213 >     * mapping to each index and current element value.
214       * @param op the op
215       * @return this (to simplify use in expressions)
216       */
# Line 222 | Line 223 | public class ParallelDoubleArray extends
223       * Replaces elements with the results of applying the given
224       * generator. For example, to fill the array with uniform random
225       * values, use
226 <     * <tt>replaceWithGeneratedValue(Ops.doubleRandom())</tt>
226 >     * {@code replaceWithGeneratedValue(Ops.doubleRandom())}.
227       * @param generator the generator
228       * @return this (to simplify use in expressions)
229       */
# Line 243 | Line 244 | public class ParallelDoubleArray extends
244  
245      /**
246       * Replaces elements with results of applying
247 <     * <tt>op(thisElement, otherElement)</tt>
247 >     * {@code op(thisElement, otherElement)}.
248       * @param other the other array
249       * @param combiner the combiner
250       * @return this (to simplify use in expressions)
251       * @throws ArrayIndexOutOfBoundsException if other array has
252 <     * fewer elements than this array.
252 >     * fewer elements than this array
253       */
254      public ParallelDoubleArray replaceWithMapping
255          (BinaryDoubleOp combiner, ParallelDoubleArrayWithDoubleMapping other) {
# Line 258 | Line 259 | public class ParallelDoubleArray extends
259  
260      /**
261       * Replaces elements with results of applying
262 <     * <tt>op(thisElement, otherElement)</tt>
262 >     * {@code op(thisElement, otherElement)}.
263       * @param other the other array
264       * @param combiner the combiner
265       * @return this (to simplify use in expressions)
266       * @throws ArrayIndexOutOfBoundsException if other array has
267 <     * fewer elements than this array.
267 >     * fewer elements than this array
268       */
269      public ParallelDoubleArray replaceWithMapping(BinaryDoubleOp combiner,
270                                                    double[] other) {
# Line 273 | Line 274 | public class ParallelDoubleArray extends
274  
275      /**
276       * Returns the index of some element equal to given target, or -1
277 <     * if not present
277 >     * if not present.
278       * @param target the element to search for
279       * @return the index or -1 if not present
280       */
# Line 362 | Line 363 | public class ParallelDoubleArray extends
363      /**
364       * Replaces each element with the running cumulation of applying
365       * the given reducer. For example, if the contents are the numbers
366 <     * <tt>1, 2, 3</tt>, and the reducer operation adds numbers, then
367 <     * after invocation of this method, the contents would be <tt>1,
368 <     * 3, 6</tt> (that is, <tt>1, 1+2, 1+2+3</tt>);
366 >     * {@code 1, 2, 3}, and the reducer operation adds numbers, then
367 >     * after invocation of this method, the contents would be {@code 1,
368 >     * 3, 6} (that is, {@code 1, 1+2, 1+2+3}).
369       * @param reducer the reducer
370       * @param base the result for an empty array
371       * @return this (to simplify use in expressions)
# Line 377 | Line 378 | public class ParallelDoubleArray extends
378      /**
379       * Replaces each element with the cumulation of applying the given
380       * reducer to all previous values, and returns the total
381 <     * reduction. For example, if the contents are the numbers <tt>1,
382 <     * 2, 3</tt>, and the reducer operation adds numbers, then after
383 <     * invocation of this method, the contents would be <tt>0, 1,
384 <     * 3</tt> (that is, <tt>0, 0+1, 0+1+2</tt>, and the return value
385 <     * would be 6 (that is, <tt> 1+2+3</tt>);
381 >     * reduction. For example, if the contents are the numbers {@code 1,
382 >     * 2, 3}, and the reducer operation adds numbers, then after
383 >     * invocation of this method, the contents would be {@code 0, 1,
384 >     * 3} (that is, {@code 0, 0+1, 0+1+2}, and the return value
385 >     * would be 6 (that is, {@code 1+2+3}).
386       * @param reducer the reducer
387       * @param base the result for an empty array
388       * @return the total reduction
# Line 406 | Line 407 | public class ParallelDoubleArray extends
407       * Sorts the array, assuming all elements are Comparable. Unlike
408       * Arrays.sort, this sort does not guarantee that elements
409       * with equal keys maintain their relative position in the array.
409     * @throws ClassCastException if any element is not Comparable
410       * @return this (to simplify use in expressions)
411 +     * @throws ClassCastException if any element is not Comparable
412       */
413      public ParallelDoubleArray sort() {
414          super.sort();
# Line 439 | Line 440 | public class ParallelDoubleArray extends
440      }
441  
442      /**
443 <     * Equivalent to <tt>asList().addAll</tt> but specialized for
443 >     * Equivalent to {@code asList().addAll} but specialized for
444       * array arguments and likely to be more efficient.
445       * @param other the elements to add
446       * @return this (to simplify use in expressions)
# Line 797 | Line 798 | public class ParallelDoubleArray extends
798       * Returns an iterator stepping through each element of the array
799       * up to the current limit. This iterator does <em>not</em>
800       * support the remove operation. However, a full
801 <     * <tt>ListIterator</tt> supporting add, remove, and set
801 >     * {@code ListIterator} supporting add, remove, and set
802       * operations is available via {@link #asList}.
803       * @return an iterator stepping through each element
804       */
# Line 852 | Line 853 | public class ParallelDoubleArray extends
853      public int size() { return fence; }
854  
855      /**
856 <     * Returns the underlying array used for computations
856 >     * Returns the underlying array used for computations.
857       * @return the array
858       */
859      public double[] getArray() { return array; }
860  
861      /**
862 <     * Returns the element of the array at the given index
862 >     * Returns the element of the array at the given index.
863       * @param i the index
864       * @return the element of the array at the given index
865       */
866      public double get(int i) { return array[i]; }
867  
868      /**
869 <     * Sets the element of the array at the given index to the given value
869 >     * Sets the element of the array at the given index to the given value.
870       * @param i the index
871       * @param x the value
872       */
873      public void set(int i, double x) { array[i] = x; }
874  
875      /**
876 <     * Equivalent to <tt>asList().toString()</tt>
876 >     * Equivalent to {@code asList().toString()}.
877       * @return a string representation
878       */
879      public String toString() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines