From 50ede6460c2458aa17b1604f4609db585d1260e8 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 18 Aug 2017 15:57:48 -0700 Subject: [PATCH] Remove Abacus dependency from ShuntingYardParser. --- core/src/main/java/org/nwapw/abacus/Abacus.java | 2 +- .../org/nwapw/abacus/parsing/ShuntingYardParser.java | 12 ++---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/core/src/main/java/org/nwapw/abacus/Abacus.java b/core/src/main/java/org/nwapw/abacus/Abacus.java index 826f266..113bda8 100644 --- a/core/src/main/java/org/nwapw/abacus/Abacus.java +++ b/core/src/main/java/org/nwapw/abacus/Abacus.java @@ -53,7 +53,7 @@ public class Abacus { numberReducer = new NumberReducer(this); this.configuration = new Configuration(configuration); LexerTokenizer lexerTokenizer = new LexerTokenizer(); - ShuntingYardParser shuntingYardParser = new ShuntingYardParser(this); + ShuntingYardParser shuntingYardParser = new ShuntingYardParser(); treeBuilder = new TreeBuilder<>(lexerTokenizer, shuntingYardParser); pluginManager.addListener(shuntingYardParser); diff --git a/core/src/main/java/org/nwapw/abacus/parsing/ShuntingYardParser.java b/core/src/main/java/org/nwapw/abacus/parsing/ShuntingYardParser.java index 86684ce..c792463 100644 --- a/core/src/main/java/org/nwapw/abacus/parsing/ShuntingYardParser.java +++ b/core/src/main/java/org/nwapw/abacus/parsing/ShuntingYardParser.java @@ -1,6 +1,5 @@ package org.nwapw.abacus.parsing; -import org.nwapw.abacus.Abacus; import org.nwapw.abacus.function.Operator; import org.nwapw.abacus.function.OperatorAssociativity; import org.nwapw.abacus.function.OperatorType; @@ -17,10 +16,6 @@ import java.util.*; */ public class ShuntingYardParser implements Parser>, PluginListener { - /** - * The Abacus instance used to create number instances. - */ - private Abacus abacus; /** * Map of operator precedences, loaded from the plugin operators. */ @@ -35,12 +30,9 @@ public class ShuntingYardParser implements Parser>, PluginListe private Map typeMap; /** - * Creates a new Shunting Yard parser with the given Abacus instance. - * - * @param abacus the abacus instance. + * Creates a new Shunting Yard parser. */ - public ShuntingYardParser(Abacus abacus) { - this.abacus = abacus; + public ShuntingYardParser() { precedenceMap = new HashMap<>(); associativityMap = new HashMap<>(); typeMap = new HashMap<>();