From c4d046858e0822b7c2c540ac2368b2c0e88e7a26 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sun, 19 May 2019 17:00:02 +0200 Subject: general refectoring added 42 as dummy Token --- DSACore/Auxiliary/Calculator/StringSolver.cs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'DSACore/Auxiliary/Calculator/StringSolver.cs') diff --git a/DSACore/Auxiliary/Calculator/StringSolver.cs b/DSACore/Auxiliary/Calculator/StringSolver.cs index 212f812..b2a7d83 100644 --- a/DSACore/Auxiliary/Calculator/StringSolver.cs +++ b/DSACore/Auxiliary/Calculator/StringSolver.cs @@ -5,28 +5,20 @@ using DSACorev.Auxiliary.Calculator; namespace DSACore.Auxiliary.Calculator { - using System; - using System.Collections.Generic; - using System.Linq; - /// - /// The StringSolver divides the calculation string into operations and SubStringSolvers if the string contains parentheses + /// The StringSolver divides the calculation string into operations and SubStringSolvers if the string contains + /// parentheses /// public class StringSolver : ISolvable { - private readonly string input; private readonly List arguments = new List(); + private readonly string input; public StringSolver(string input) { this.input = input; } - public override string ToString() - { - return "(0+" + input.Replace(" ", string.Empty).ToLower() + ")"; - } - public int Solve() { var workInput = "0+" + input.Replace(" ", string.Empty).ToLower(); @@ -42,6 +34,11 @@ namespace DSACore.Auxiliary.Calculator return ((ISolvable) arguments.First()).Solve(); } + public override string ToString() + { + return "(0+" + input.Replace(" ", string.Empty).ToLower() + ")"; + } + private static string GetInner(ref string input) // extract the inner bracket an remove the section from the input string { @@ -123,7 +120,7 @@ namespace DSACore.Auxiliary.Calculator switch (c) { case ')': - throw new ArgumentException($"Unmögliche Anordnung von Klammern"); + throw new ArgumentException("Unmögliche Anordnung von Klammern"); case '(': arguments.Add(new StringSolver(GetInner(ref workInput))); index = -1; -- cgit v1.2.3-54-g00ecf