mirror of
https://github.com/DanilaFe/abacus
synced 2024-12-22 15:30:09 -08:00
Get rid of unnecessary supplier.
This commit is contained in:
parent
9efe9be5b4
commit
467d5d4145
|
@ -12,8 +12,6 @@ import org.nwapw.abacus.plugin.StandardPlugin;
|
|||
import org.nwapw.abacus.tree.NumberReducer;
|
||||
import org.nwapw.abacus.tree.TreeNode;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* The main calculator class. This is responsible
|
||||
* for piecing together all of the components, allowing
|
||||
|
@ -49,10 +47,10 @@ public class Abacus {
|
|||
/**
|
||||
* Creates a new instance of the Abacus calculator.
|
||||
*/
|
||||
public Abacus(Supplier<Configuration> configurationSupplier) {
|
||||
public Abacus(Configuration configuration) {
|
||||
pluginManager = new PluginManager(this);
|
||||
numberReducer = new NumberReducer(this);
|
||||
configuration = configurationSupplier.get();
|
||||
this.configuration = new Configuration(configuration);
|
||||
LexerTokenizer lexerTokenizer = new LexerTokenizer();
|
||||
ShuntingYardParser shuntingYardParser = new ShuntingYardParser(this);
|
||||
treeBuilder = new TreeBuilder<>(lexerTokenizer, shuntingYardParser);
|
||||
|
|
|
@ -39,6 +39,15 @@ public class Configuration {
|
|||
*/
|
||||
private Set<String> disabledPlugins = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Creates a new configuration form the given configuration.
|
||||
*
|
||||
* @param copyFrom the configuration to copy.
|
||||
*/
|
||||
public Configuration(Configuration copyFrom){
|
||||
copyFrom(copyFrom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new configuration with the given values.
|
||||
*
|
||||
|
|
|
@ -180,7 +180,7 @@ public class AbacusController implements PluginListener {
|
|||
if (oldValue.equals(settingsTab)) alertIfApplyNeeded(true);
|
||||
});
|
||||
|
||||
abacus = new Abacus(() -> new Configuration(new java.io.File("config.toml")));
|
||||
abacus = new Abacus(new Configuration(CONFIG_FILE));
|
||||
PluginManager abacusPluginManager = abacus.getPluginManager();
|
||||
abacusPluginManager.addListener(this);
|
||||
abacusPluginManager.addInstantiated(new StandardPlugin(abacus.getPluginManager()));
|
||||
|
|
Loading…
Reference in New Issue
Block a user