From 4eff4760e53471d7a21970499c5d7ca929ce394e Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 27 Jul 2017 10:58:11 -0700 Subject: [PATCH] Add comments and clear appropriate cache. --- src/org/nwapw/abacus/plugin/PluginManager.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/org/nwapw/abacus/plugin/PluginManager.java b/src/org/nwapw/abacus/plugin/PluginManager.java index ddfe4a4..7442b17 100644 --- a/src/org/nwapw/abacus/plugin/PluginManager.java +++ b/src/org/nwapw/abacus/plugin/PluginManager.java @@ -35,6 +35,19 @@ public class PluginManager { cachedFunctions = new HashMap<>(); } + /** + * Searches the plugin list for a certain value, retrieving the Plugin's + * list of items of the type using the setFunction and getting the value + * of it is available via getFunction. If the value is contained + * in the cache, it returns the cached value instead. + * @param plugins the plugin list to search. + * @param cache the cache to use + * @param setFunction the function to retrieve a set of available T's from the plugin + * @param getFunction the function to get the T value under the given name + * @param name the name to search for + * @param the type of element being search + * @return the retrieved element, or null if it was not found. + */ private static T searchCached(Collection plugins, Map cache, java.util.function.Function> setFunction, java.util.function.BiFunction getFunction, @@ -77,6 +90,7 @@ public class PluginManager { public void addInstantiated(Plugin plugin){ plugin.load(); cachedFunctions.clear(); + cachedOperators.clear(); plugins.add(plugin); }