summaryrefslogtreecommitdiff
path: root/DSACore/Auxiliary/Calculator
diff options
context:
space:
mode:
Diffstat (limited to 'DSACore/Auxiliary/Calculator')
-rw-r--r--DSACore/Auxiliary/Calculator/Argument.cs8
-rw-r--r--DSACore/Auxiliary/Calculator/ISolvable.cs2
-rw-r--r--DSACore/Auxiliary/Calculator/Operator.cs2
-rw-r--r--DSACore/Auxiliary/Calculator/Ops.cs2
-rw-r--r--DSACore/Auxiliary/Calculator/StringSolver.cs21
5 files changed, 16 insertions, 19 deletions
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
+{
/// <summary>
- /// 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.
/// </summary>
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
{
/// <summary>
- /// 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
/// </summary>
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
{
/// <summary>
- /// 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
/// </summary>
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
{
/// <summary>
- /// The Different Operations, witch can be performed in execution-order
+ /// The Different Operations, witch can be performed in execution-order
/// </summary>
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;
-
/// <summary>
- /// 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
/// </summary>
public class StringSolver : ISolvable
{
- private readonly string input;
private readonly List<object> arguments = new List<object>();
+ 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;