Skip to content

List#10

Open
MinyazevR wants to merge 10 commits intomainfrom
List
Open

List#10
MinyazevR wants to merge 10 commits intomainfrom
List

Conversation

@MinyazevR
Copy link
Copy Markdown
Owner

No description provided.

Comment thread List/List/List/List/IUniqueList.cs Outdated
/// Size property
/// </summary>
/// <returns>Number of element on list</returns>
public int Size { get;}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public int Size { get;}
public int Size { get; }

Comment thread 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>
Copy link
Copy Markdown

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; }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По-хорошему public-свойствам тоже комментарии нужны

Comment thread List/List/List/List/List.cs Outdated
return;
}

var newTail = new ListElement(){};
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var newTail = new ListElement(){};
var newTail = new ListElement();

Comment thread List/List/List/List/List.cs Outdated
}

var element = head;
var copyElement = new ListElement();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для удаления элемента как бы не надо выделять память на куче

Comment thread List/List/List/List/List.cs Outdated
}

/// <summary>
/// Аunction to search for an item in the list
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// А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
Copy link
Copy Markdown

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() { }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А пустой конструктор без параметров не нужен, он сам сгенерится


return false;
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Всё-таки можно нарушить инвариант уникальности в списке. Подумайте, как

Comment thread List/List/List/ListTest/ListTest.cs Outdated

public class Tests
{
IUniqueList<int> list = new UniqueList<int>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
IUniqueList<int> list = new UniqueList<int>();
private IUniqueList<int> list = new UniqueList<int>();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants