Skip to content

Conversation

@MikePuzanov
Copy link
Owner

No description provided.

using System.Collections;
using System.IO;

namespace hw2LZW
Copy link
Collaborator

Choose a reason for hiding this comment

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

Пространства имён в .NET именуются всегда с заглавной, и пространство имён всего проекта называется по умолчанию так же, как сам проект, поэтому и проекты стоит называть с заглавной

}
}
return 1;
}

This comment was marked as resolved.

}

private bool CheckAdd(byte value, Node node)
=> node.IsFind(value) == null ? true : false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

? true : false можно не писать, == и так возвращает булевое значение

if (runner == root)
{
var check = runner.Sons[value];
if (check.IsUsed == false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (check.IsUsed == false)
if (!check.IsUsed)

if (codeOfBytes != -1)
{
codes.Enqueue(codeOfBytes);
trie.IsAdd(byter);
Copy link
Collaborator

Choose a reason for hiding this comment

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

И снова добавляем байт в дерево? Хм, зачем?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Надо придумать и написать этому рациональное объяснение. В реальном проекте нельзя просто взять и проигнорировать комментарий ревьюера.

private bool CheckAdd(byte value, Node node)
=> node.IsFind(value) == null ? true : false;

public int LastCode { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

По-хорошему, к свойствам (особенно с неочевидными названиями, как это) тоже надо комментарии

Copy link
Collaborator

Choose a reason for hiding this comment

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

Не исправлено

/// вернем последний код
/// </summary>
/// <returns>возвращается последний код</returns>
public int GetLastCode()
Copy link
Collaborator

Choose a reason for hiding this comment

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

А зачем, есть же public-свойство, которое делает то же самое

Comment on lines +30 to +31
string path1 = "..\\..\\..\\TestTxt.txt";
string path2 = "..\\..\\..\\TestTxtCopy.txt";

This comment was marked as resolved.

Comment on lines +18 to +19
var compressedFileSize = new FileInfo(args[0]);
var decompressedFileSize = new FileInfo(args[0] + ".zipped");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Наоборот же :)

hw2LZW.LZW.Compress(path1);
hw2LZW.LZW.Decompress(path1 + ".zipped");
File.Delete(path1 + ".zipped");
Assert.IsTrue(Compare(path1, path2));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Я проделал это вручную и, если удалить исходный TestImg.jpg, получил:
TestImg

Есть подозрение, что тест проходит только потому, что TestImg.jpg уже существует, а распаковщик не перезаписывает файл до конца (то есть в хвосте остаются байты оригинального изображения).

Copy link
Collaborator

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

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

С одной стороны, стало лучше, с другой стороны, стало хуже :)

if (codeOfBytes != -1)
{
codes.Enqueue(codeOfBytes);
trie.IsAdd(byter);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Надо придумать и написать этому рациональное объяснение. В реальном проекте нельзя просто взять и проигнорировать комментарий ревьюера.


public bool IsUsed { get; set; }

public int IdByte;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Я пишу "у этих свойств видимость уж слишком широкая, сеттер можно было убрать", а Вы такой "о, почему бы не превратить свойство в public-поле?". Типа "сгорел сарай, гори и хата"? Нет, не прокатит.

private bool CheckAdd(byte value, Node node)
=> node.IsFind(value) == null ? true : false;

public int LastCode { get; set; }
Copy link
Collaborator

Choose a reason for hiding this comment

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

Не исправлено

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.

3 participants