mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 07:20:09 -08:00
Precompute Pi, and do not store documentation on access.
This commit is contained in:
parent
00f8475044
commit
8975bfdb99
|
@ -141,6 +141,7 @@ public class PluginManager {
|
||||||
registeredNumberImplementations.put(name, implementation);
|
registeredNumberImplementations.put(name, implementation);
|
||||||
interfaceImplementationNames.put(implementation.getImplementation(), name);
|
interfaceImplementationNames.put(implementation.getImplementation(), name);
|
||||||
interfaceImplementations.put(implementation.getImplementation(), implementation);
|
interfaceImplementations.put(implementation.getImplementation(), implementation);
|
||||||
|
cachedPi.put(implementation.getImplementation(), implementation.instanceForPi());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -218,10 +219,6 @@ public class PluginManager {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (toReturn == null) {
|
|
||||||
toReturn = new Documentation(name, "", "", "", type);
|
|
||||||
registerDocumentation(toReturn);
|
|
||||||
}
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,14 +249,7 @@ public class PluginManager {
|
||||||
* @return pi
|
* @return pi
|
||||||
*/
|
*/
|
||||||
public NumberInterface piFor(Class<? extends NumberInterface> forClass) {
|
public NumberInterface piFor(Class<? extends NumberInterface> forClass) {
|
||||||
if (cachedPi.containsKey(forClass)) return cachedPi.get(forClass);
|
return cachedPi.get(forClass);
|
||||||
NumberImplementation implementation = interfaceImplementationFor(forClass);
|
|
||||||
NumberInterface generatedPi = null;
|
|
||||||
if (implementation != null) {
|
|
||||||
generatedPi = implementation.instanceForPi();
|
|
||||||
}
|
|
||||||
cachedPi.put(forClass, generatedPi);
|
|
||||||
return generatedPi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -363,7 +363,12 @@ public class AbacusController implements PluginListener {
|
||||||
enabledPlugins.add(plugin);
|
enabledPlugins.add(plugin);
|
||||||
}
|
}
|
||||||
PluginManager pluginManager = abacus.getPluginManager();
|
PluginManager pluginManager = abacus.getPluginManager();
|
||||||
functionList.addAll(manager.getAllFunctions().stream().map(name -> pluginManager.documentationFor(name, DocumentationType.FUNCTION))
|
functionList.addAll(manager.getAllFunctions().stream().map(name -> {
|
||||||
|
Documentation documentationInstance = pluginManager.documentationFor(name, DocumentationType.FUNCTION);
|
||||||
|
if(documentationInstance == null)
|
||||||
|
documentationInstance = new Documentation(name, "", "", "", DocumentationType.FUNCTION);
|
||||||
|
return documentationInstance;
|
||||||
|
})
|
||||||
.collect(Collectors.toCollection(ArrayList::new)));
|
.collect(Collectors.toCollection(ArrayList::new)));
|
||||||
functionList.addAll(manager.getAllTreeValueFunctions().stream().map(name -> pluginManager.documentationFor(name, DocumentationType.TREE_VALUE_FUNCTION))
|
functionList.addAll(manager.getAllTreeValueFunctions().stream().map(name -> pluginManager.documentationFor(name, DocumentationType.TREE_VALUE_FUNCTION))
|
||||||
.collect(Collectors.toCollection(ArrayList::new)));
|
.collect(Collectors.toCollection(ArrayList::new)));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user