1
0
mirror of https://github.com/DanilaFe/abacus synced 2024-12-23 07:50:09 -08:00

Add a number provider cache.

This commit is contained in:
Danila Fedorin 2017-08-03 10:25:10 -07:00
parent 22f1b7543a
commit 7c0f0046f8

View File

@ -2,6 +2,7 @@ package org.nwapw.abacus.plugin;
import org.nwapw.abacus.function.Function;
import org.nwapw.abacus.function.Operator;
import org.nwapw.abacus.number.NaiveNumber;
import org.nwapw.abacus.number.NumberInterface;
import java.lang.reflect.InvocationTargetException;
@ -36,6 +37,11 @@ public class PluginManager {
* been cached, that is, found in a plugin and returned.
*/
private Map<String, Class<? extends NumberInterface>> cachedNumbers;
/**
* List of registered constant providers for every
* number class.
*/
private Map<Class<?>, java.util.function.Function<String, NaiveNumber>> cachedConstantProviders;
/**
* List of all functions loaded by the plugins.
*/
@ -62,6 +68,7 @@ public class PluginManager {
cachedFunctions = new HashMap<>();
cachedOperators = new HashMap<>();
cachedNumbers = new HashMap<>();
cachedConstantProviders = new HashMap<>();
allFunctions = new HashSet<>();
allOperators = new HashSet<>();
allNumbers = new HashSet<>();