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

Comparing jsr166/src/test/extra166y/LongSetOpsDemo.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 LongSetOpsDemo {
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          ParallelLongArray pa = ParallelLongArray.createUsingHandoff(a, fjpool);
# Line 44 | Line 44 | class LongSetOpsDemo {
44      }
45  
46      static class Evens implements Ops.IntToLong {
47 <        public long op(int i) {
47 >        public long op(int i) {
48              return ((long)(i << 1));
49          }
50      }
# Line 249 | Line 249 | class LongSetOpsDemo {
249          System.out.printf("Seq index time :      %7.3f\n", de);
250      }
251  
252 <    static void seqRemoveAll(ParallelLongArray pa,
252 >    static void seqRemoveAll(ParallelLongArray pa,
253                               Ops.LongPredicate selector) {
254          long[] a = pa.getArray();
255          int n = pa.size();
# Line 262 | Line 262 | class LongSetOpsDemo {
262          pa.setLimit(k);
263      }
264  
265 <    static ArrayList<Long> seqSelectAll(ParallelLongArray pa,
265 >    static ArrayList<Long> seqSelectAll(ParallelLongArray pa,
266                                          Ops.LongPredicate selector) {
267          ArrayList<Long> al = new ArrayList<Long>();
268          long[] a = pa.getArray();
# Line 278 | Line 278 | class LongSetOpsDemo {
278      static long[] seqUnique(long[] a) {
279          int n = a.length;
280          HashSet<Long> m = new HashSet<Long>(n);
281 <        for (int i = 0; i < n; ++i)
281 >        for (int i = 0; i < n; ++i)
282              m.add(Long.valueOf(a[i]));
283          int ul = m.size();
284          long[] u = new long[ul];
# Line 287 | Line 287 | class LongSetOpsDemo {
287              u[k++] = e;
288          return u;
289      }
290 <    
291 <    static void checkSorted (ParallelLongArray pa)  {
290 >
291 >    static void checkSorted(ParallelLongArray pa) {
292          int n = pa.size();
293          for (int i = 0; i < n - 1; i++) {
294              if (pa.get(i) >= pa.get(i+1)) {
# Line 296 | Line 296 | class LongSetOpsDemo {
296              }
297          }
298      }
299 <    
299 >
300  
301   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines