forked from Lunya-sh/Evil_Calculator
you don't need to use 'ref' with reference types
This commit is contained in:
@@ -200,7 +200,7 @@
|
|||||||
currentOperandTextBox.ForeColor = Color.White;
|
currentOperandTextBox.ForeColor = Color.White;
|
||||||
CalculatorPanel.Controls.Add(currentOperandTextBox);
|
CalculatorPanel.Controls.Add(currentOperandTextBox);
|
||||||
|
|
||||||
equationManager.AcquireOutputLabels(ref equationTextBox, ref currentOperandTextBox);
|
equationManager.AcquireOutputLabels(equationTextBox, currentOperandTextBox);
|
||||||
|
|
||||||
CalculatorPanel.Show();
|
CalculatorPanel.Show();
|
||||||
|
|
||||||
|
|||||||
@@ -145,12 +145,12 @@
|
|||||||
{
|
{
|
||||||
if (currentOperand != "") equation.Add(new Token(Token.TokenType.Operand, currentOperand));
|
if (currentOperand != "") equation.Add(new Token(Token.TokenType.Operand, currentOperand));
|
||||||
buttonEquals.Text = "#";
|
buttonEquals.Text = "#";
|
||||||
currentOperand = reverseNotationSolver.Solve(ref equation);
|
currentOperand = reverseNotationSolver.Solve(equation);
|
||||||
UpdateLabels();
|
UpdateLabels();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AcquireOutputLabels(ref Label equationTextBox, ref Label currentOperandTextBox)
|
public void AcquireOutputLabels(Label equationTextBox, Label currentOperandTextBox)
|
||||||
{
|
{
|
||||||
outerEquationLabel = equationTextBox;
|
outerEquationLabel = equationTextBox;
|
||||||
outerOperandLabel = currentOperandTextBox;
|
outerOperandLabel = currentOperandTextBox;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
List<Token> equation = new();
|
List<Token> equation = new();
|
||||||
|
|
||||||
public string ToReverseNotation(ref List<Token> equation)
|
public string ToReverseNotation(List<Token> equation)
|
||||||
{
|
{
|
||||||
List<Token> TEMP = new List<Token>();
|
List<Token> TEMP = new List<Token>();
|
||||||
Stack<Token> OPERATORS = new Stack<Token>();
|
Stack<Token> OPERATORS = new Stack<Token>();
|
||||||
@@ -47,9 +47,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string Solve(ref List<Token> equation)
|
public string Solve(List<Token> equation)
|
||||||
{
|
{
|
||||||
ToReverseNotation(ref equation);
|
ToReverseNotation(equation);
|
||||||
Stack<Token> stack = new Stack<Token>();
|
Stack<Token> stack = new Stack<Token>();
|
||||||
foreach (Token token in this.equation)
|
foreach (Token token in this.equation)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user