mirror of
https://github.com/DanilaFe/abacus
synced 2026-01-23 07:15:19 +00:00
Add comments for FUNCTION_SIN and intFactorial in StandardPlugin.
This commit is contained in:
@@ -282,6 +282,9 @@ public class StandardPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sine function (the argument is interpreted in radians).
|
||||||
|
*/
|
||||||
public static final Function FUNCTION_SIN = new Function() {
|
public static final Function FUNCTION_SIN = new Function() {
|
||||||
@Override
|
@Override
|
||||||
protected boolean matchesParams(NumberInterface[] params) {
|
protected boolean matchesParams(NumberInterface[] params) {
|
||||||
@@ -359,6 +362,13 @@ public class StandardPlugin extends Plugin {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A factorial function that uses memoization for each number class; it efficiently
|
||||||
|
* computes factorials of non-negative integers.
|
||||||
|
* @param numberClass type of number to return.
|
||||||
|
* @param n non-negative integer.
|
||||||
|
* @return a number of numClass with value n factorial.
|
||||||
|
*/
|
||||||
public static NumberInterface factorial(Class<? extends NumberInterface> numberClass, int n){
|
public static NumberInterface factorial(Class<? extends NumberInterface> numberClass, int n){
|
||||||
if(!factorialLists.containsKey(numberClass)){
|
if(!factorialLists.containsKey(numberClass)){
|
||||||
factorialLists.put(numberClass, new ArrayList<NumberInterface>());
|
factorialLists.put(numberClass, new ArrayList<NumberInterface>());
|
||||||
|
|||||||
Reference in New Issue
Block a user