1
0
mirror of https://github.com/DanilaFe/abacus synced 2026-01-27 09:05:19 +00:00

Remove old reference to the promotion system and the number class map.

This commit is contained in:
2017-08-03 20:50:39 -07:00
parent 0f02867a4e
commit 44c52b412c
4 changed files with 0 additions and 181 deletions

View File

@@ -2,7 +2,6 @@ package org.nwapw.abacus.plugin;
import org.nwapw.abacus.function.Function;
import org.nwapw.abacus.function.Operator;
import org.nwapw.abacus.number.NumberInterface;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
@@ -31,16 +30,6 @@ public class PluginManager {
* that is, found in a plugin and returned.
*/
private Map<String, Operator> cachedOperators;
/**
* List of registered number implementations that have
* 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, NumberInterface>> cachedConstantProviders;
/**
* List of all functions loaded by the plugins.
*/
@@ -49,14 +38,6 @@ public class PluginManager {
* List of all operators loaded by the plugins.
*/
private Set<String> allOperators;
/**
* List of all numbers loaded by the plugins.
*/
private Set<String> allNumbers;
/**
* List of all the constant providers loaded by the plugins.
*/
private Set<Class<?>> allConstantProviders;
/**
* The list of plugin listeners attached to this instance.
*/
@@ -70,12 +51,8 @@ public class PluginManager {
plugins = new HashSet<>();
cachedFunctions = new HashMap<>();
cachedOperators = new HashMap<>();
cachedNumbers = new HashMap<>();
cachedConstantProviders = new HashMap<>();
allFunctions = new HashSet<>();
allOperators = new HashSet<>();
allNumbers = new HashSet<>();
allConstantProviders = new HashSet<>();
listeners = new HashSet<>();
}
@@ -132,25 +109,6 @@ public class PluginManager {
return searchCached(plugins, cachedOperators, Plugin::providedOperators, Plugin::getOperator, name);
}
/**
* Gets a numer implementation under the given name.
*
* @param name the name of the implementation.
* @return the implementation class
*/
public Class<? extends NumberInterface> numberFor(String name) {
return searchCached(plugins, cachedNumbers, Plugin::providedNumbers, Plugin::getNumber, name);
}
/**
* Gets the constant provider for the given class.
* @param forClass the class to get the provider for.
* @return the provider.
*/
public java.util.function.Function<String, NumberInterface> constantProviderFor(Class<?> forClass){
return searchCached(plugins, cachedConstantProviders, Plugin::providedConstantProviders, Plugin::getConstantProvider, forClass);
}
/**
* Adds an instance of Plugin that already has been instantiated.
*
@@ -185,8 +143,6 @@ public class PluginManager {
for (Plugin plugin : plugins) {
allFunctions.addAll(plugin.providedFunctions());
allOperators.addAll(plugin.providedOperators());
allNumbers.addAll(plugin.providedNumbers());
allConstantProviders.addAll(plugin.providedConstantProviders());
}
listeners.forEach(e -> e.onLoad(this));
}
@@ -198,8 +154,6 @@ public class PluginManager {
for (Plugin plugin : plugins) plugin.disable();
allFunctions.clear();
allOperators.clear();
allNumbers.clear();
allConstantProviders.clear();
listeners.forEach(e -> e.onUnload(this));
}
@@ -229,23 +183,6 @@ public class PluginManager {
return allOperators;
}
/**
* Gets all the number implementations loaded by the Plugin Manager
*
* @return the set of all implementations that were loaded
*/
public Set<String> getAllNumbers() {
return allNumbers;
}
/**
* Gets all the constant providers loaded by the Plugin Manager.
* @return the set of all constant providers that were loaded.
*/
public Set<Class<?>> getAllConstantProviders() {
return allConstantProviders;
}
/**
* Adds a plugin change listener to this plugin manager.
*