mirror of
https://github.com/DanilaFe/abacus
synced 2025-01-08 23:39:26 -08:00
Add promotion manager to Abacus.
This commit is contained in:
parent
ecb5139e70
commit
f7c07ca04d
@ -1,7 +1,10 @@
|
||||
package org.nwapw.abacus;
|
||||
|
||||
import org.nwapw.abacus.config.Configuration;
|
||||
import org.nwapw.abacus.number.NaiveNumber;
|
||||
import org.nwapw.abacus.number.NumberInterface;
|
||||
import org.nwapw.abacus.number.PreciseNumber;
|
||||
import org.nwapw.abacus.number.PromotionManager;
|
||||
import org.nwapw.abacus.parsing.LexerTokenizer;
|
||||
import org.nwapw.abacus.parsing.ShuntingYardParser;
|
||||
import org.nwapw.abacus.parsing.TreeBuilder;
|
||||
@ -11,6 +14,8 @@ import org.nwapw.abacus.plugin.StandardPlugin;
|
||||
import org.nwapw.abacus.tree.NumberReducer;
|
||||
import org.nwapw.abacus.tree.TreeNode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* The main calculator class. This is responsible
|
||||
* for piecing together all of the components, allowing
|
||||
@ -42,6 +47,10 @@ public class Abacus {
|
||||
* from a string.
|
||||
*/
|
||||
private TreeBuilder treeBuilder;
|
||||
/**
|
||||
* Promotion manager responsible for the promotion system.
|
||||
*/
|
||||
private PromotionManager promotionManager;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the Abacus calculator.
|
||||
@ -55,11 +64,20 @@ public class Abacus {
|
||||
LexerTokenizer lexerTokenizer = new LexerTokenizer();
|
||||
ShuntingYardParser shuntingYardParser = new ShuntingYardParser();
|
||||
treeBuilder = new TreeBuilder<>(lexerTokenizer, shuntingYardParser);
|
||||
promotionManager = new PromotionManager(this);
|
||||
|
||||
pluginManager.addListener(shuntingYardParser);
|
||||
pluginManager.addListener(lexerTokenizer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the promotion manager.
|
||||
* @return the promotion manager.
|
||||
*/
|
||||
public PromotionManager getPromotionManager() {
|
||||
return promotionManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current tree builder.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user