1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/samples/composition/src-test/api/Factorial.java Sat Jun 14 10:04:45 2008 +0200
1.3 @@ -0,0 +1,18 @@
1.4 +package api;
1.5 +
1.6 +/** Class showing inventive, non-expected use of
1.7 + * Arithmetica methods to do multiplication instead of
1.8 + * addition.
1.9 + */
1.10 +//BEGIN: design.composition.arith.factorial
1.11 +public final class Factorial extends Arithmetica {
1.12 + public static int factorial(int n) {
1.13 + return new Factorial().sumRange(1, n);
1.14 + }
1.15 + @Override
1.16 + public int sumTwo(int one, int second) {
1.17 + return one * second;
1.18 + }
1.19 +}
1.20 +//END: design.composition.arith.factorial
1.21 +