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

Comparing jsr166/src/test/extra166y/CombineDemo.java (file contents):
Revision 1.1 by dl, Sun Nov 1 22:00:35 2009 UTC vs.
Revision 1.5 by jsr166, Tue Mar 15 19:47:04 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   import jsr166y.*;
# Line 16 | Line 16 | class CombineDemo {
16      static int reps = 16;
17      static final long maxValue = 1 << 12;
18  
19 <    public static void main (String[] args) throws Exception {
19 >    public static void main(String[] args) throws Exception {
20          int n = 1 << 20;
21          Long[] a = new Long[n];
22          ParallelArray<Long> pa = ParallelArray.createUsingHandoff(a, fjpool);
# Line 45 | Line 45 | class CombineDemo {
45      }
46  
47      static class Evens implements Ops.IntToObject<Long> {
48 <        public Long op(int i) {
48 >        public Long op(int i) {
49              return Long.valueOf((long)(i << 1));
50          }
51      }
# Line 250 | Line 250 | class CombineDemo {
250  
251      // ............
252  
253 <    static void seqRemoveAll(ParallelArray<Long> pa,
253 >    static void seqRemoveAll(ParallelArray<Long> pa,
254                               Ops.Predicate<Long> selector) {
255          Long[] a = pa.getArray();
256          int n = pa.size();
# Line 265 | Line 265 | class CombineDemo {
265          pa.setLimit(k);
266      }
267  
268 <    static ArrayList<Long> seqSelectAll(ParallelArray<Long> pa,
268 >    static ArrayList<Long> seqSelectAll(ParallelArray<Long> pa,
269                                          Ops.Predicate<Long> selector) {
270          ArrayList<Long> al = new ArrayList<Long>();
271          Long[] a = pa.getArray();
# Line 281 | Line 281 | class CombineDemo {
281      static Long[] seqUnique(Long[] a) {
282          int n = a.length;
283          HashSet<Long> m = new HashSet<Long>(n);
284 <        for (int i = 0; i < n; ++i)
284 >        for (int i = 0; i < n; ++i)
285              m.add(a[i]);
286          int ul = m.size();
287          Long[] u = new Long[ul];
# Line 290 | Line 290 | class CombineDemo {
290              u[k++] = e;
291          return u;
292      }
293 <    
294 <    static void checkSorted (ParallelArray<Long> pa)  {
293 >
294 >    static void checkSorted(ParallelArray<Long> pa) {
295          int n = pa.size();
296          for (int i = 0; i < n - 1; i++) {
297              if (pa.get(i).compareTo(pa.get(i+1)) >= 0) {
# Line 299 | Line 299 | class CombineDemo {
299              }
300          }
301      }
302 <    
302 >
303      static final class RandomLongGenerator implements Ops.Generator<Long> {
304          public Long op() {
305              return new Long(ThreadLocalRandom.current().nextLong(maxValue));

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines