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.4 by jsr166, Wed Sep 1 07:24:06 2010 UTC vs.
Revision 1.7 by dl, Sat May 7 13:11:42 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 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines