1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-12-22 15:30:09 -08:00

Add comments for FUNCTION_SIN and intFactorial in StandardPlugin.

This commit is contained in:
Arthur Drobot 2017-08-02 15:13:04 -07:00
parent cf953da40a
commit 9b71f9aaf4

View File

@ -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>());