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

Comparing jsr166/src/test/extra166y/MapReduceDemo.java (file contents):
Revision 1.1 by dl, Sun Nov 1 22:00:35 2009 UTC vs.
Revision 1.2 by jsr166, Mon Nov 16 04:16:43 2009 UTC

# Line 22 | Line 22 | public class MapReduceDemo {
22                                   U base) {
23          int n = array.length;
24          U x = base;
25 <        for (int i = 0; i < n; ++i)
25 >        for (int i = 0; i < n; ++i)
26              x = reducer.op(x, mapper.op(array[i]));
27          return x;
28      }
29  
30 <    
30 >
31  
32      // sample functions
33      static final class GetNext implements Ops.Op<Rand, Long> {
34 <        public Long op(Rand x) {
34 >        public Long op(Rand x) {
35              return x.next();
36          }
37      }
# Line 51 | Line 51 | public class MapReduceDemo {
51          int n = 1 << 18;
52          int reps = 1 << 8;
53          Rand[] array = new Rand[n];
54 <        for (int i = 0; i < n; ++i)
54 >        for (int i = 0; i < n; ++i)
55              array[i] = new Rand(i+1);
56          ForkJoinPool fjp = new ForkJoinPool(1);
57          ParallelArray<Rand> pa = ParallelArray.createUsingHandoff(array, fjp);
# Line 130 | Line 130 | public class MapReduceDemo {
130          }
131          public long next() {
132              long x = seed;
133 <            x ^= x << 13;
134 <            x ^= x >>> 7;
133 >            x ^= x << 13;
134 >            x ^= x >>> 7;
135              x ^= (x << 17);
136              seed = x;
137              return x;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines