forked from Lunya-sh/Evil_Calculator
removed unnecessary this. and .ToString and type specifying
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
{
|
||||
class EquationManager
|
||||
{
|
||||
private ReverseNotationSolver reverseNotationSolver = new ReverseNotationSolver();
|
||||
private ReverseNotationSolver reverseNotationSolver = new();
|
||||
|
||||
List<Token> equation = new List<Token>();
|
||||
List<Token> equation = new();
|
||||
string currentOperand = "";
|
||||
Label? outerEquationLabel;
|
||||
Label? outerOperandLabel;
|
||||
@@ -24,11 +24,8 @@
|
||||
|
||||
public void ProcessButtonInput(object? sender, EventArgs e)
|
||||
{
|
||||
Button? buttonPressed = sender as Button;
|
||||
if (buttonPressed != null)
|
||||
if (sender is Button buttonPressed)
|
||||
{
|
||||
|
||||
|
||||
switch (buttonPressed.Text)
|
||||
{
|
||||
//CLEAR
|
||||
@@ -136,26 +133,26 @@
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateLabels();
|
||||
}
|
||||
}
|
||||
|
||||
public void EqualsButtonPressed(object? sender, EventArgs e)
|
||||
{
|
||||
Button? buttonEquals = sender as Button;
|
||||
if (buttonEquals != null)
|
||||
if (sender is Button buttonEquals)
|
||||
{
|
||||
if (currentOperand != "") equation.Add(new Token(Token.TokenType.Operand, currentOperand));
|
||||
buttonEquals.Text = "#";
|
||||
this.currentOperand = reverseNotationSolver.Solve(ref equation);
|
||||
currentOperand = reverseNotationSolver.Solve(ref equation);
|
||||
UpdateLabels();
|
||||
}
|
||||
}
|
||||
|
||||
public void AcquireOutputLabels(ref Label equationTextBox, ref Label currentOperandTextBox)
|
||||
{
|
||||
this.outerEquationLabel = equationTextBox;
|
||||
this.outerOperandLabel = currentOperandTextBox;
|
||||
outerEquationLabel = equationTextBox;
|
||||
outerOperandLabel = currentOperandTextBox;
|
||||
}
|
||||
|
||||
public string equationToString()
|
||||
@@ -163,7 +160,7 @@
|
||||
string equationString = "";
|
||||
foreach (Token token in equation)
|
||||
{
|
||||
equationString += token.value.ToString() + " ";
|
||||
equationString += token.value + " ";
|
||||
}
|
||||
return equationString;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user