Conversation
sproshev
approved these changes
Oct 15, 2016
| @@ -0,0 +1,226 @@ | |||
| import com.sun.xml.internal.ws.policy.privateutil.PolicyUtils; | |||
| public boolean contains(String element) { | ||
| Node pos = root; | ||
| boolean exists = true; | ||
| for (int i = 0; ((i < element.length()) && (exists)); i++) { |
| if (pos.hasKid(element.charAt(i))) { | ||
| pos = pos.getKid(element.charAt(i)); | ||
| } else { | ||
| exists = false; |
| if (exists) { | ||
| ans = pos.getSize(); | ||
| } | ||
| return ans; |
There was a problem hiding this comment.
может быть тут тоже можно как-то упростить по аналогии с contains?
| } | ||
|
|
||
| private class Node { | ||
| private static final int basicRepSize = 9; |
There was a problem hiding this comment.
константы именуются капсом, слова разделяются подчеркиваниями
| private static final int basicRepSize = 9; | ||
| private boolean terminal = false; | ||
| private int subtreeSize = 0; | ||
| private Node[] kids = new Node[52]; |
| ans |= ((int)arr[beginning + i]) >>> (8 * (3 - i)); | ||
| } | ||
| return ans; | ||
| } |
There was a problem hiding this comment.
DataInput/OutputStream я не просто так подсказывал)
| } else { | ||
| index = c - 'A' + 26; | ||
| } | ||
| return index; |
There was a problem hiding this comment.
зачем переменная индекс, если можно в обоих случаях сразу делать return?
| kids[kidsNumbers[i]] = new Node(); | ||
| kids[kidsNumbers[i]].unboxFromStream(stream); | ||
| } | ||
| } |
There was a problem hiding this comment.
результаты вызовов метода read проигнорированы, -0.5
| stream.read(basicData, 0, basicRepSize); | ||
| terminal = (basicData[0] == 1); | ||
| subtreeSize = assembleInt(basicData, 1); | ||
| kidsNumber = assembleInt(basicData, 5); |
There was a problem hiding this comment.
зачем kidsNumber и kidsNumbers объявлены выше? можно их объявить прямо при инициализации
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.