samples/composition/src-api2.0/api/Arithmetica.java
changeset 321 06bf3a32eaa0
parent 320 9ad0cc253aa9
child 322 c12a563d36a4
     1.1 --- a/samples/composition/src-api2.0/api/Arithmetica.java	Thu Feb 12 11:00:41 2009 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,30 +0,0 @@
     1.4 -package api;
     1.5 -
     1.6 -/** Class to simplify arithmetical operations, improved version to compute
     1.7 - * the sum for ranges.
     1.8 - *
     1.9 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.10 - * @version 2.0
    1.11 - */
    1.12 -public class Arithmetica {
    1.13 -    public int sumTwo(int one, int second) {
    1.14 -        return one + second;
    1.15 -    }
    1.16 -    
    1.17 -    public int sumAll(int... numbers) {
    1.18 -        if (numbers.length == 0) {
    1.19 -            return 0;
    1.20 -        }
    1.21 -        int sum = numbers[0];
    1.22 -        for (int i = 1; i < numbers.length; i++) {
    1.23 -            sum = sumTwo(sum, numbers[i]);
    1.24 -        }
    1.25 -        return sum;
    1.26 -    }
    1.27 -    
    1.28 -// BEGIN: design.composition.arith2.0
    1.29 -    public int sumRange(int from, int to) {
    1.30 -        return (from + to) * (Math.abs(to - from) + 1) / 2;
    1.31 -    }
    1.32 -// END: design.composition.arith2.0
    1.33 -}