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

Comparing jsr166/src/extra166y/AbstractParallelAnyArray.java (file contents):
Revision 1.1 by dl, Tue Jan 6 14:30:57 2009 UTC vs.
Revision 1.8 by jsr166, Sat May 7 19:06:27 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   package extra166y;
# Line 86 | Line 86 | public abstract class AbstractParallelAn
86       */
87      public int anyIndex() {
88          if (!hasFilter())
89 <            return (origin < fence)? origin : -1;
89 >            return (origin < fence) ? origin : -1;
90          AtomicInteger result = new AtomicInteger(-1);
91          PAS.FJSelectAny f = new PAS.FJSelectAny
92              (this, origin, fence, null, result);
# Line 118 | Line 118 | public abstract class AbstractParallelAn
118       */
119      final int getThreshold() {
120          int t = threshold;
121 <        if (t == 0)
121 >        if (t == 0)
122              t = computeThreshold();
123          return t;
124      }
# Line 1133 | Line 1133 | public abstract class AbstractParallelAn
1133          }
1134      }
1135  
1136 +    static final class AndPredicate<T> implements Predicate<T> {
1137 +        final Predicate<? super T> first;
1138 +        final Predicate<? super T> second;
1139 +        AndPredicate(Predicate<? super T> first,
1140 +                     Predicate<? super T> second) {
1141 +            this.first = first; this.second = second;
1142 +        }
1143 +        public final boolean op(T x) { return first.op(x) && second.op(x); }
1144 +    }
1145 +
1146      // Filtered (but unmapped) classes
1147      static final class OFPap<T> extends ParallelArrayWithFilter<T> {
1148          final Predicate<? super T> selector;
# Line 1149 | Line 1159 | public abstract class AbstractParallelAn
1159          public ParallelArrayWithFilter<T> withFilter
1160              (Predicate<? super T> selector) {
1161              return new OFPap<T>(ex, origin, fence, array,
1162 <                                CommonOps.andPredicate(this.selector, selector));
1162 >                                new AndPredicate(this.selector, selector));
1163          }
1164  
1165          public ParallelArrayWithFilter<T> withIndexedFilter
# Line 2383 | Line 2393 | public abstract class AbstractParallelAn
2393          }
2394  
2395          public ParallelDoubleArrayWithDoubleMapping withMapping
2396 <            (ObjectToDouble<? super U> op){
2396 >            (ObjectToDouble<? super U> op) {
2397              return new DUDMPap(ex, origin, fence, array,
2398                                 CommonOps.compoundOp(this.op, op));
2399          }
# Line 4893 | Line 4903 | public abstract class AbstractParallelAn
4903          }
4904  
4905          public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) {
4906 <            return new DFLCPap (ex, origin, fence, array, selector,
4907 <                                compoundIndexedOp(this.op, op));
4906 >            return new DFLCPap(ex, origin, fence, array, selector,
4907 >                               compoundIndexedOp(this.op, op));
4908          }
4909  
4910          public <U> ParallelDoubleArrayWithMapping< U> withMapping
# Line 5131 | Line 5141 | public abstract class AbstractParallelAn
5141          }
5142  
5143          public ParallelDoubleArrayWithLongMapping withMapping(DoubleToLong op) {
5144 <            return new DRLCPap (ex, origin, fence, array, selector,
5145 <                                compoundIndexedOp(this.op, op));
5144 >            return new DRLCPap(ex, origin, fence, array, selector,
5145 >                               compoundIndexedOp(this.op, op));
5146          }
5147  
5148          public <U> ParallelDoubleArrayWithMapping< U> withMapping

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines