--- jsr166/src/test/loops/BinaryAsyncAction.java 2012/01/28 04:41:18 1.5 +++ jsr166/src/test/loops/BinaryAsyncAction.java 2012/11/26 05:59:05 1.11 @@ -1,7 +1,7 @@ /* * 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.*; @@ -15,11 +15,11 @@ import java.util.concurrent.atomic.*; * BinaryAsyncActions are simpler to use and have less overhead in * typical uasges but are restricted to binary computation trees. * - *

Upon construction, an BinaryAsyncAction does not bear any + *

Upon construction, a BinaryAsyncAction does not bear any * linkages. For non-root tasks, links must be established using * method linkSubtasks before use. * - *

Sample Usage. A version of Fibonacci: + *

Sample Usage. A version of Fibonacci: *

  * class Fib extends BinaryAsyncAction {
  *   final int n;
@@ -27,14 +27,14 @@ import java.util.concurrent.atomic.*;
  *   Fib(int n) { this.n = n; }
  *   protected void compute() {
  *     if (n > 1) {
- *        linkAndForkSubtasks(new Fib(n-1), new Fib(n-2));
+ *       linkAndForkSubtasks(new Fib(n-1), new Fib(n-2));
  *     else {
- *        result = n; // fib(0)==0; fib(1)==1
- *        complete();
+ *       result = n; // fib(0)==0; fib(1)==1
+ *       complete();
  *     }
  *   }
  *   protected void onComplete(BinaryAsyncAction x, BinaryAsyncAction y) {
- *      result = ((Fib)x).result + ((Fib)y).result;
+ *     result = ((Fib)x).result + ((Fib)y).result;
  *   }
  * }
  * 
@@ -44,11 +44,11 @@ import java.util.concurrent.atomic.*; * protected void compute() { * Fib f = this; * while (f.n > 1) { - * Fib left = new Fib(f.n - 1); - * Fib right = new Fib(f.n - 2); - * f.linkSubtasks(left, right); - * right.fork(); // fork right - * f = left; // loop on left + * Fib left = new Fib(f.n - 1); + * Fib right = new Fib(f.n - 2); + * f.linkSubtasks(left, right); + * right.fork(); // fork right + * f = left; // loop on left * } * f.result = f.n; * f.complete(); @@ -120,7 +120,7 @@ public abstract class BinaryAsyncAction * default version of this method does nothing and returns * true. * @return true if this task's exception should be propagated to - * this tasks parent. + * this task's parent. */ protected boolean onException() { return true;