package org.nwapw.abacus.number;

import java.util.HashMap;

public class FunctionDatabase {

    private HashMap<String, Function> functions;

    private void registerDefault(){

    }

    public FunctionDatabase(){
        functions = new HashMap<>();
    }

    public Function getFunction(String name){
        return functions.get(name);
    }

}

@@ -174,16 +174,1710 @@
 ult()%7B%0A%0A
+        functions.put(%22+%22, new Function() %7B%0A            @Override%0A            protected boolean matchesParams(Number%5B%5D params) %7B%0A                return params.length %3E= 1;%0A            %7D%0A%0A            @Override%0A            protected Number applyInternal(Number%5B%5D params) %7B%0A                Number sum = params%5B0%5D;%0A                for(int i = 1; i %3C params.length; i++)%7B%0A                    sum = sum.add(params%5Bi%5D);%0A                %7D%0A                return sum;%0A            %7D%0A        %7D);%0A%0A        functions.put(%22-%22, new Function() %7B%0A            @Override%0A            protected boolean matchesParams(Number%5B%5D params) %7B%0A                return params.length == 2;%0A            %7D%0A%0A            @Override%0A            protected Number applyInternal(Number%5B%5D params) %7B%0A                return params%5B0%5D.subtract(params%5B1%5D);%0A            %7D%0A        %7D);%0A%0A        functions.put(%22*%22, new Function() %7B%0A            @Override%0A            protected boolean matchesParams(Number%5B%5D params) %7B%0A                return params.length %3E= 1;%0A            %7D%0A%0A            @Override%0A            protected Number applyInternal(Number%5B%5D params) %7B%0A                Number product = params%5B1%5D;%0A                for(int i = 1; i %3C params.length; i++)%7B%0A                    product = product.multiply(params%5Bi%5D);%0A                %7D%0A                return product;%0A            %7D%0A        %7D);%0A%0A        functions.put(%22/%22, new Function() %7B%0A            @Override%0A            protected boolean matchesParams(Number%5B%5D params) %7B%0A                return params.length == 2;%0A            %7D%0A%0A            @Override%0A            protected Number applyInternal(Number%5B%5D params) %7B%0A                return params%5B0%5D.divide(params%5B1%5D);%0A            %7D%0A        %7D);%0A
     %7D%0A%0A 
@@ -1943,16 +1943,43 @@
 ap%3C%3E();%0A
+        registerDefault();%0A
     %7D%0A%0A 

Add the four external essential functions.