-
Notifications
You must be signed in to change notification settings - Fork 0
Hw2 Lzw #4
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: master
Are you sure you want to change the base?
Hw2 Lzw #4
Conversation
hw2LZW/hw2LZW/LZW.cs
Outdated
| using System.Collections; | ||
| using System.IO; | ||
|
|
||
| namespace hw2LZW |
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.
Пространства имён в .NET именуются всегда с заглавной, и пространство имён всего проекта называется по умолчанию так же, как сам проект, поэтому и проекты стоит называть с заглавной
| } | ||
| } | ||
| return 1; | ||
| } |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
hw2LZW/hw2LZW/Trie.cs
Outdated
| } | ||
|
|
||
| private bool CheckAdd(byte value, Node node) | ||
| => node.IsFind(value) == null ? true : 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.
? true : false можно не писать, == и так возвращает булевое значение
hw2LZW/hw2LZW/Trie.cs
Outdated
| if (runner == root) | ||
| { | ||
| var check = runner.Sons[value]; | ||
| if (check.IsUsed == 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.
| if (check.IsUsed == false) | |
| if (!check.IsUsed) |
| if (codeOfBytes != -1) | ||
| { | ||
| codes.Enqueue(codeOfBytes); | ||
| trie.IsAdd(byter); |
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.
И снова добавляем байт в дерево? Хм, зачем?
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 bool CheckAdd(byte value, Node node) | ||
| => node.IsFind(value) == null ? true : false; | ||
|
|
||
| public int LastCode { get; 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.
По-хорошему, к свойствам (особенно с неочевидными названиями, как это) тоже надо комментарии
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.
Не исправлено
hw2LZW/hw2LZW/Trie.cs
Outdated
| /// вернем последний код | ||
| /// </summary> | ||
| /// <returns>возвращается последний код</returns> | ||
| public int GetLastCode() |
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-свойство, которое делает то же самое
| string path1 = "..\\..\\..\\TestTxt.txt"; | ||
| string path2 = "..\\..\\..\\TestTxtCopy.txt"; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
| var compressedFileSize = new FileInfo(args[0]); | ||
| var decompressedFileSize = new FileInfo(args[0] + ".zipped"); |
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.
Наоборот же :)
| hw2LZW.LZW.Compress(path1); | ||
| hw2LZW.LZW.Decompress(path1 + ".zipped"); | ||
| File.Delete(path1 + ".zipped"); | ||
| Assert.IsTrue(Compare(path1, path2)); |
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.
yurii-litvinov
left a comment
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 (codeOfBytes != -1) | ||
| { | ||
| codes.Enqueue(codeOfBytes); | ||
| trie.IsAdd(byter); |
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 bool IsUsed { get; set; } | ||
|
|
||
| public int IdByte; |
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-поле?". Типа "сгорел сарай, гори и хата"? Нет, не прокатит.
| private bool CheckAdd(byte value, Node node) | ||
| => node.IsFind(value) == null ? true : false; | ||
|
|
||
| public int LastCode { get; 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.
Не исправлено

No description provided.