author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Thu, 30 Oct 2014 21:30:10 +0100 | |
changeset 409 | 40cabcdcd2be |
permissions | -rw-r--r-- |
jtulach@325 | 1 |
package org.apidesign.sidemeanings.math; |
jtulach@325 | 2 |
|
jtulach@325 | 3 |
/** |
jtulach@325 | 4 |
*/ |
jtulach@325 | 5 |
// BEGIN: design.sidemeanings.arith.factorial |
jtulach@325 | 6 |
public final class Factorial extends Arithmetica { |
jtulach@325 | 7 |
public int factorial(int n) { |
jtulach@325 | 8 |
return sumRange(1, n); |
jtulach@325 | 9 |
} |
jtulach@325 | 10 |
|
jtulach@325 | 11 |
@Override |
jtulach@325 | 12 |
protected int overridableSumTwo(int one, int second) { |
jtulach@325 | 13 |
return one * second; |
jtulach@325 | 14 |
} |
jtulach@325 | 15 |
|
jtulach@325 | 16 |
@Override |
jtulach@325 | 17 |
protected int overridableSumAll(int... numbers) { |
jtulach@325 | 18 |
return defaultSumAll(numbers); |
jtulach@325 | 19 |
} |
jtulach@325 | 20 |
|
jtulach@325 | 21 |
@Override |
jtulach@325 | 22 |
protected int overridableSumRange(int from, int to) { |
jtulach@325 | 23 |
return defaultSumRange(from, to); |
jtulach@325 | 24 |
} |
jtulach@325 | 25 |
} |
jtulach@325 | 26 |
// END: design.sidemeanings.arith.factorial |
jtulach@325 | 27 |