-
Notifications
You must be signed in to change notification settings - Fork 0
ParseTree #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ParseTree #7
Conversation
feat: add constructor for ParseTree class(probably doesn't work)
Create ParseTreeFile project
refactor: add some new exceptions
feat: add User Interface
/// <summary> | ||
/// Interface of the node, that performs operation element. | ||
/// </summary> | ||
public interface IOperandNode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Операция и операнд носят определенный семантический смысл.
Судя по описанию к интерфейсу и по тому, что класс Operation у вас реализует интерфейс IOperandNode, вы не понимаете какой :) Однако реализация решения говорит, что все-таки понимаете.
Интерфейс стоит как-то иначе назвать, чтобы не вводить читающего код в заблужление
/// Calculate divide operation. | ||
/// </summary> | ||
/// <returns>Result of calculation.</returns> | ||
/// <exception cref="InvalidOperationException">SecondOperand can't be 0.</exception> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вы же исключение другого типа выкидываете :)
if (currentIndex > expression.Length || expression[currentIndex] != ' ') | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (currentIndex > expression.Length || expression[currentIndex] != ' ') | |
{ | |
if (currentIndex >= expression.Length || expression[currentIndex] != ' ') | |
{ |
if (!ParseTreeUtils.AreParanthesisBalanced(expression) | ||
|| !expression.Any((x) => x == '(')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
При переносе выражения на новую строку соблюдайте отступ в 8 пробелов
/// <exception cref="ArgumentException">If index out of string.</exception> | ||
public static void IsInRange(string expression, int index) | ||
{ | ||
if (index > expression.Length || index < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (index > expression.Length || index < 0) | |
if (index >= expression.Length || index < 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не хватает тестов для случаев где в качестве expression
будет передаваться null или пустая строка
No description provided.