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

Comparing jsr166/src/extra166y/ParallelArray.java (file contents):
Revision 1.9 by jsr166, Wed Jan 16 00:51:11 2013 UTC vs.
Revision 1.18 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 133 | Line 134 | import java.lang.reflect.Array;
134   *     public boolean op(Student s) { return s.credits > 90; }
135   *   }
136   *   static final IsSenior isSenior = new IsSenior();
137 < *   static final class GpaField implements ObjectToDouble&lt;Student&gt {
137 > *   static final class GpaField implements ObjectToDouble&lt;Student&gt; {
138   *     public double op(Student s) { return s.gpa; }
139   *   }
140   *   static final GpaField gpaField = new GpaField();
# Line 509 | Line 510 | public class ParallelArray<T> extends Ab
510       * the given reducer. For example, if the contents are the numbers
511       * {@code 1, 2, 3}, and the reducer operation adds numbers, then
512       * after invocation of this method, the contents would be {@code 1,
513 <     * 3, 6} (that is, {@code 1, 1+2, 1+2+3});
513 >     * 3, 6} (that is, {@code 1, 1+2, 1+2+3}).
514       * @param reducer the reducer
515       * @param base the result for an empty array
516       * @return this (to simplify use in expressions)
# Line 526 | Line 527 | public class ParallelArray<T> extends Ab
527       * 2, 3}, and the reducer operation adds numbers, then after
528       * invocation of this method, the contents would be {@code 0, 1,
529       * 3} (that is, {@code 0, 0+1, 0+1+2}, and the return value
530 <     * would be 6 (that is, {@code  1+2+3});
530 >     * would be 6 (that is, {@code 1+2+3}).
531       * @param reducer the reducer
532       * @param base the result for an empty array
533       * @return the total reduction
534       */
535      public T precumulate(Reducer<T> reducer, T base) {
536 <        return (T)(super.precumulate(reducer, base));
536 >        return super.precumulate(reducer, base);
537      }
538  
539      /**
# Line 551 | Line 552 | public class ParallelArray<T> extends Ab
552       * Sorts the array, assuming all elements are Comparable. Unlike
553       * Arrays.sort, this sort does not guarantee that elements
554       * with equal keys maintain their relative position in the array.
554     * @throws ClassCastException if any element is not Comparable
555       * @return this (to simplify use in expressions)
556 +     * @throws ClassCastException if any element is not Comparable
557       */
558      public ParallelArray<T> sort() {
559          super.sort();
# Line 755 | Line 756 | public class ParallelArray<T> extends Ab
756       * @param op the op
757       * @return operation prefix
758       */
759 <    public <U> ParallelArrayWithMapping<T, U> withMapping
759 >    public <U> ParallelArrayWithMapping<T,U> withMapping
760          (Op<? super T, ? extends U> op) {
761          return super.withMapping(op);
762      }
# Line 1037 | Line 1038 | public class ParallelArray<T> extends Ab
1038      public T[] getArray() { return array; }
1039  
1040      /**
1041 <     * Equivalent to {@code asList().toString()}
1041 >     * Equivalent to {@code asList().toString()}.
1042       * @return a string representation
1043       */
1044      public String toString() {
# Line 1352 | Line 1353 | public class ParallelArray<T> extends Ab
1353              return a;
1354          }
1355  
1356 <        public <V> V[] toArray(V a[]) {
1356 >        public <V> V[] toArray(V[] a) {
1357              int len = fence;
1358              if (a.length < len) {
1359                  Class elementType = a.getClass().getComponentType();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines