From 22f8a48195c60f969161dc92bdcb3d7344daf7b1 Mon Sep 17 00:00:00 2001 From: Arthur Drobot Date: Thu, 27 Jul 2017 13:39:19 -0700 Subject: [PATCH] Begin working on memoization for factorial. (Commented out for now.) --- src/org/nwapw/abacus/plugin/StandardPlugin.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/org/nwapw/abacus/plugin/StandardPlugin.java b/src/org/nwapw/abacus/plugin/StandardPlugin.java index d48beb7..76d7826 100755 --- a/src/org/nwapw/abacus/plugin/StandardPlugin.java +++ b/src/org/nwapw/abacus/plugin/StandardPlugin.java @@ -5,6 +5,8 @@ import org.nwapw.abacus.number.NaiveNumber; import org.nwapw.abacus.number.NumberInterface; import javax.print.attribute.standard.MediaSize; +import java.util.ArrayList; +import java.util.HashMap; import java.util.function.BiFunction; /** @@ -76,7 +78,7 @@ public class StandardPlugin extends Plugin { }); registerFunction("!", new Function() { - //private ArrayLi + //private HashMap, ArrayList> storedList = new HashMap, ArrayList>(); @Override protected boolean matchesParams(NumberInterface[] params) { return params.length == 1; @@ -94,6 +96,11 @@ public class StandardPlugin extends Plugin { factorial = factorial.multiply(multiplier); } return factorial; + /*if(!storedList.containsKey(params[0].getClass())){ + storedList.put(params[0].getClass(), new ArrayList()); + storedList.get(params[0].getClass()).add(NaiveNumber.ONE.promoteTo(params[0].getClass())); + storedList.get(params[0].getClass()).add(NaiveNumber.ONE.promoteTo(params[0].getClass())); + }*/ } });