diff options
author | Dennis Kobert <d-kobert@web.de> | 2019-05-19 17:58:42 +0200 |
---|---|---|
committer | Dennis Kobert <d-kobert@web.de> | 2019-05-19 17:58:42 +0200 |
commit | 2ab4051c6fe720dc47e99b0c305a0d779ee02d51 (patch) | |
tree | 9510ddbb174a54474934adf7991a5ba2aa39f818 /DSACore/Auxiliary/Calculator/Operator.cs | |
parent | c4d046858e0822b7c2c540ac2368b2c0e88e7a26 (diff) |
Moved Gamelogic to DSALib
Diffstat (limited to 'DSACore/Auxiliary/Calculator/Operator.cs')
-rw-r--r-- | DSACore/Auxiliary/Calculator/Operator.cs | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/DSACore/Auxiliary/Calculator/Operator.cs b/DSACore/Auxiliary/Calculator/Operator.cs deleted file mode 100644 index 31b2a9b..0000000 --- a/DSACore/Auxiliary/Calculator/Operator.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using DSACorev.Auxiliary.Calculator; - -namespace DSACore.Auxiliary.Calculator -{ - /// <summary> - /// The Operator Class represents a binary operator with tow Arguments and an Operation type - /// </summary> - public class Operator : ISolvable - { - private readonly ISolvable arg1, arg2; - - public Operator(ISolvable arg1, ISolvable arg2, Ops operatorType) - { - this.arg1 = arg1; - this.arg2 = arg2; - OperatorType = operatorType; - } - - public Ops OperatorType { get; set; } - - public int Solve() - { - int result; - switch (OperatorType) - { - case Ops.Dice: - result = Dice.Roll(arg1.Solve(), arg2.Solve()); - break; - case Ops.Multiply: - result = arg1.Solve() * arg2.Solve(); - break; - case Ops.Add: - result = arg1.Solve() + arg2.Solve(); - break; - case Ops.Subtract: - result = arg1.Solve() - arg2.Solve(); - break; - default: - throw new ArgumentOutOfRangeException(); - } - - return result; - } - - public override string ToString() - { - return $"({arg1} {OperatorType} {arg2})"; - } - } -}
\ No newline at end of file |