-
Notifications
You must be signed in to change notification settings - Fork 0
List #10
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
base: main
Are you sure you want to change the base?
Conversation
List/List/List/List/IUniqueList.cs
Outdated
| /// Size property | ||
| /// </summary> | ||
| /// <returns>Number of element on list</returns> | ||
| public int Size { get;} |
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.
| public int Size { get;} | |
| public int Size { get; } |
List/List/List/List/List.cs
Outdated
| /// Сlass representing a list | ||
| /// </summary> | ||
| /// <typeparam name="T"> type of item values in the list </typeparam> | ||
| abstract public class SinglyLinkedList<T> : IUniqueList<T> |
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.
Обычный список не обязан содержать уникальные элементы. Либо у Вас интерфейс неудачно назван, либо иерархия наследования сломана
|
|
||
| private ListElement? head; | ||
| private ListElement? tail; | ||
| public int Size { get; private set; } |
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.
По-хорошему public-свойствам тоже комментарии нужны
List/List/List/List/List.cs
Outdated
| return; | ||
| } | ||
|
|
||
| var newTail = new ListElement(){}; |
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.
| var newTail = new ListElement(){}; | |
| var newTail = new ListElement(); |
List/List/List/List/List.cs
Outdated
| } | ||
|
|
||
| var element = head; | ||
| var copyElement = new ListElement(); |
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.
Для удаления элемента как бы не надо выделять память на куче
List/List/List/List/List.cs
Outdated
| } | ||
|
|
||
| /// <summary> | ||
| /// Аunction to search for an item in the list |
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.
| /// Аunction to search for an item in the list | |
| /// Function to search for an item in the list |
| namespace List; | ||
|
|
||
| /// <summary> | ||
| /// A class for creating custom exceptions |
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.
Комментарий тут и ниже неправдив, надо поправить
| /// </summary> | ||
| public class RemoveNonExistingElementException : Exception | ||
| { | ||
| public RemoveNonExistingElementException() : base() { } |
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.
А пустой конструктор без параметров не нужен, он сам сгенерится
|
|
||
| return false; | ||
| } | ||
| } |
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.
Всё-таки можно нарушить инвариант уникальности в списке. Подумайте, как
List/List/List/ListTest/ListTest.cs
Outdated
|
|
||
| public class Tests | ||
| { | ||
| IUniqueList<int> list = new UniqueList<int>(); |
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.
| IUniqueList<int> list = new UniqueList<int>(); | |
| private IUniqueList<int> list = new UniqueList<int>(); |
No description provided.