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/Argument.cs | 8 ++++---- DSACore/Auxiliary/Calculator/ISolvable.cs | 2 +- DSACore/Auxiliary/Calculator/Operator.cs | 2 +- DSACore/Auxiliary/Calculator/Ops.cs | 2 +- DSACore/Auxiliary/Calculator/StringSolver.cs | 21 +++++++++------------ 5 files changed, 16 insertions(+), 19 deletions(-) (limited to 'DSACore/Auxiliary/Calculator') diff --git a/DSACore/Auxiliary/Calculator/Argument.cs b/DSACore/Auxiliary/Calculator/Argument.cs index 14982aa..5ed9ee3 100644 --- a/DSACore/Auxiliary/Calculator/Argument.cs +++ b/DSACore/Auxiliary/Calculator/Argument.cs @@ -1,9 +1,9 @@ -namespace DSACore.Auxiliary.Calculator -{ - using System; +using System; +namespace DSACore.Auxiliary.Calculator +{ /// - /// Provides an ISolvable class to save numbers. The class handles Argument checking and conversion from string to int. + /// Provides an ISolvable class to save numbers. The class handles Argument checking and conversion from string to int. /// public class Argument : ISolvable { diff --git a/DSACore/Auxiliary/Calculator/ISolvable.cs b/DSACore/Auxiliary/Calculator/ISolvable.cs index 2acbd11..7be4d19 100644 --- a/DSACore/Auxiliary/Calculator/ISolvable.cs +++ b/DSACore/Auxiliary/Calculator/ISolvable.cs @@ -1,7 +1,7 @@ namespace DSACore.Auxiliary.Calculator { /// - /// Object has to be able to return an integer as it's value + /// Object has to be able to return an integer as it's value /// public interface ISolvable { diff --git a/DSACore/Auxiliary/Calculator/Operator.cs b/DSACore/Auxiliary/Calculator/Operator.cs index ed46186..31b2a9b 100644 --- a/DSACore/Auxiliary/Calculator/Operator.cs +++ b/DSACore/Auxiliary/Calculator/Operator.cs @@ -4,7 +4,7 @@ using DSACorev.Auxiliary.Calculator; namespace DSACore.Auxiliary.Calculator { /// - /// The Operator Class represents a binary operator with tow Arguments and an Operation type + /// The Operator Class represents a binary operator with tow Arguments and an Operation type /// public class Operator : ISolvable { diff --git a/DSACore/Auxiliary/Calculator/Ops.cs b/DSACore/Auxiliary/Calculator/Ops.cs index c804257..a5c9a2d 100644 --- a/DSACore/Auxiliary/Calculator/Ops.cs +++ b/DSACore/Auxiliary/Calculator/Ops.cs @@ -1,7 +1,7 @@ namespace DSACorev.Auxiliary.Calculator { /// - /// The Different Operations, witch can be performed in execution-order + /// The Different Operations, witch can be performed in execution-order /// public enum Ops { 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-70-g09d2