-
Notifications
You must be signed in to change notification settings - Fork 0
LZW #5
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
LZW #5
Conversation
Probably it'll need fixes
fix: LZWEncode a lot of fixes
feat: some garbage files
@@ -0,0 +1,68 @@ | |||
using Trees; |
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.
Неиспользуемый using, уберите, пожалуйста
using Trees; | ||
using LZW; | ||
|
||
if (args.Length < 2) |
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.
Если больше 2, то тоже нехорошо вообще-то, добавьте и такую проверку, пожалуйста
using Trees; | ||
|
||
/// <summary> | ||
/// class that perfroms encoding by LZW algorithm. |
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.
_performs_все-таки :)
var newElement = new List<byte>(); | ||
newElement.Add((byte)i); |
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 newElement = new List<byte>(); | |
newElement.Add((byte)i); | |
var newElement = new List<byte> | |
{ | |
(byte)i | |
}; |
var newBytes = new List<byte>(); | ||
List<byte> result = new (); |
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 newBytes = new List<byte>();
var result = new List<byte>();
/// <summary> | ||
/// Gets size of Trie, count of elements in Trie, doesn't include empty array. | ||
/// </summary> | ||
public int Size { get { return head.BytesCount; } } |
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 { return head.BytesCount; } } | |
public int Size => head.BytesCount; |
/// <param name="element">The array to be checked to see if it is contained in.</param> | ||
/// <returns>true -- if Trie contains element, false -- if it doesn't (Empty array contained in the Trie) .</returns> | ||
/// <exception cref="ArgumentNullException">element variable can't be null.</exception> | ||
public bool Contains(List<byte> element) |
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.
Какой-то это уже не бор. Пустой список в боре содержаться не должен по определению. Причем внезапно содержаться он у вас в боре может, а удалить его нельзя. Попробуйте как-то без этого :)
/// <param name="element">element, that need to be added to Trie.</param> | ||
/// <returns>true -- it successfully added the element, false -- the element is already contained (Empty array contained in the Trie).</returns> | ||
/// <exception cref="ArgumentNullException">element can't be null.</exception> | ||
public bool Add(List<byte> element, int value) |
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.
Вы значение, которое передаете вторым аргументов везде называете Value. Тема Value не раскрыта. Без копания в коде совсем не очевидно, что за значение нужно передавать в качестве этого аргумента. Именно поэтому добавьте, пожалуйста, комментарии с пояснениями
/// <param name="prefix">prefix with which the number should start.</param> | ||
/// <returns>Count of elements Trie which start with prefix. Empty array will return count of all words in Trie.</returns> | ||
/// <exception cref="ArgumentNullException">prefix can't be null.</exception> | ||
public int HowManyStartsWithPrefix(List<byte> prefix) |
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.
Ну и так как пустой список в боре не содержится, то и этот метод нужно переделать с учетом этого
namespace LZW; | ||
|
||
/// <summary> | ||
/// Class that perfroms decoding by LZW algorithm. |
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.
_performs_все-таки :)
No description provided.