jdk/src/java.base/share/classes/java/util/ArrayPrefixHelpers.java
changeset 32991 b27c76b82713
parent 30655 d83f50188ca9
--- a/jdk/src/java.base/share/classes/java/util/ArrayPrefixHelpers.java	Tue Oct 13 16:35:22 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/ArrayPrefixHelpers.java	Tue Oct 13 16:45:35 2015 -0700
@@ -1,5 +1,4 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,20 +21,26 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-package java.util;
 
 /*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
  * Written by Doug Lea with assistance from members of JCP JSR-166
  * Expert Group and released to the public domain, as explained at
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-import java.util.concurrent.ForkJoinPool;
+package java.util;
+
 import java.util.concurrent.CountedCompleter;
+import java.util.concurrent.ForkJoinPool;
 import java.util.function.BinaryOperator;
+import java.util.function.DoubleBinaryOperator;
 import java.util.function.IntBinaryOperator;
 import java.util.function.LongBinaryOperator;
-import java.util.function.DoubleBinaryOperator;
 
 /**
  * ForkJoin tasks to perform Arrays.parallelPrefix operations.
@@ -44,7 +49,7 @@
  * @since 1.8
  */
 class ArrayPrefixHelpers {
-    private ArrayPrefixHelpers() {}; // non-instantiable
+    private ArrayPrefixHelpers() {} // non-instantiable
 
     /*
      * Parallel prefix (aka cumulate, scan) task classes
@@ -113,8 +118,8 @@
             this.lo = this.origin = lo; this.hi = this.fence = hi;
             int p;
             this.threshold =
-                    (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
-                    <= MIN_PARTITION ? MIN_PARTITION : p;
+                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
+                <= MIN_PARTITION ? MIN_PARTITION : p;
         }
 
         /** Subtask constructor */
@@ -141,9 +146,9 @@
                     if (lt == null) {                // first pass
                         int mid = (l + h) >>> 1;
                         f = rt = t.right =
-                                new CumulateTask<T>(t, fn, a, org, fnc, th, mid, h);
-                        t = lt = t.left  =
-                                new CumulateTask<T>(t, fn, a, org, fnc, th, l, mid);
+                            new CumulateTask<T>(t, fn, a, org, fnc, th, mid, h);
+                        t = lt = t.left =
+                            new CumulateTask<T>(t, fn, a, org, fnc, th, l, mid);
                     }
                     else {                           // possibly refork
                         T pin = t.in;
@@ -183,7 +188,7 @@
                     for (int b;;) {
                         if (((b = t.getPendingCount()) & FINISHED) != 0)
                             break outer;                      // already done
-                        state = ((b & CUMULATE) != 0? FINISHED :
+                        state = ((b & CUMULATE) != 0 ? FINISHED :
                                  (l > org) ? SUMMED : (SUMMED|FINISHED));
                         if (t.compareAndSetPendingCount(b, b|state))
                             break;
@@ -265,8 +270,8 @@
             this.lo = this.origin = lo; this.hi = this.fence = hi;
             int p;
             this.threshold =
-                    (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
-                    <= MIN_PARTITION ? MIN_PARTITION : p;
+                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
+                <= MIN_PARTITION ? MIN_PARTITION : p;
         }
 
         /** Subtask constructor */
@@ -293,9 +298,9 @@
                     if (lt == null) {                // first pass
                         int mid = (l + h) >>> 1;
                         f = rt = t.right =
-                                new LongCumulateTask(t, fn, a, org, fnc, th, mid, h);
-                        t = lt = t.left  =
-                                new LongCumulateTask(t, fn, a, org, fnc, th, l, mid);
+                            new LongCumulateTask(t, fn, a, org, fnc, th, mid, h);
+                        t = lt = t.left =
+                            new LongCumulateTask(t, fn, a, org, fnc, th, l, mid);
                     }
                     else {                           // possibly refork
                         long pin = t.in;
@@ -335,7 +340,7 @@
                     for (int b;;) {
                         if (((b = t.getPendingCount()) & FINISHED) != 0)
                             break outer;                      // already done
-                        state = ((b & CUMULATE) != 0? FINISHED :
+                        state = ((b & CUMULATE) != 0 ? FINISHED :
                                  (l > org) ? SUMMED : (SUMMED|FINISHED));
                         if (t.compareAndSetPendingCount(b, b|state))
                             break;
@@ -415,8 +420,8 @@
             this.lo = this.origin = lo; this.hi = this.fence = hi;
             int p;
             this.threshold =
-                    (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
-                    <= MIN_PARTITION ? MIN_PARTITION : p;
+                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
+                <= MIN_PARTITION ? MIN_PARTITION : p;
         }
 
         /** Subtask constructor */
@@ -443,9 +448,9 @@
                     if (lt == null) {                // first pass
                         int mid = (l + h) >>> 1;
                         f = rt = t.right =
-                                new DoubleCumulateTask(t, fn, a, org, fnc, th, mid, h);
-                        t = lt = t.left  =
-                                new DoubleCumulateTask(t, fn, a, org, fnc, th, l, mid);
+                            new DoubleCumulateTask(t, fn, a, org, fnc, th, mid, h);
+                        t = lt = t.left =
+                            new DoubleCumulateTask(t, fn, a, org, fnc, th, l, mid);
                     }
                     else {                           // possibly refork
                         double pin = t.in;
@@ -485,7 +490,7 @@
                     for (int b;;) {
                         if (((b = t.getPendingCount()) & FINISHED) != 0)
                             break outer;                      // already done
-                        state = ((b & CUMULATE) != 0? FINISHED :
+                        state = ((b & CUMULATE) != 0 ? FINISHED :
                                  (l > org) ? SUMMED : (SUMMED|FINISHED));
                         if (t.compareAndSetPendingCount(b, b|state))
                             break;
@@ -565,8 +570,8 @@
             this.lo = this.origin = lo; this.hi = this.fence = hi;
             int p;
             this.threshold =
-                    (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
-                    <= MIN_PARTITION ? MIN_PARTITION : p;
+                (p = (hi - lo) / (ForkJoinPool.getCommonPoolParallelism() << 3))
+                <= MIN_PARTITION ? MIN_PARTITION : p;
         }
 
         /** Subtask constructor */
@@ -593,9 +598,9 @@
                     if (lt == null) {                // first pass
                         int mid = (l + h) >>> 1;
                         f = rt = t.right =
-                                new IntCumulateTask(t, fn, a, org, fnc, th, mid, h);
-                        t = lt = t.left  =
-                                new IntCumulateTask(t, fn, a, org, fnc, th, l, mid);
+                            new IntCumulateTask(t, fn, a, org, fnc, th, mid, h);
+                        t = lt = t.left =
+                            new IntCumulateTask(t, fn, a, org, fnc, th, l, mid);
                     }
                     else {                           // possibly refork
                         int pin = t.in;
@@ -635,7 +640,7 @@
                     for (int b;;) {
                         if (((b = t.getPendingCount()) & FINISHED) != 0)
                             break outer;                      // already done
-                        state = ((b & CUMULATE) != 0? FINISHED :
+                        state = ((b & CUMULATE) != 0 ? FINISHED :
                                  (l > org) ? SUMMED : (SUMMED|FINISHED));
                         if (t.compareAndSetPendingCount(b, b|state))
                             break;