-
Notifications
You must be signed in to change notification settings - Fork 0
TreeSet #11
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?
Conversation
| @@ -0,0 +1,2 @@ | |||
| #Tue Nov 14 16:51:37 MSK 2017 | |||
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.
папку .gradle не нужно выкладывать, я вроде бы про это писал уже
-0.5
|
|
||
| import static org.junit.Assert.*; | ||
|
|
||
| public class MindTreeSetTest { |
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.
тесты всё же надо дописать
-1
| */ | ||
| public class MindTreeSet<E> implements MyTreeSet<E>{ | ||
|
|
||
| Node start = null; |
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.
мне кажется, их лучше сделать закрытыми
| Node finish = null; | ||
| Node root = null; | ||
| int size = 0; | ||
| boolean ret = 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.
не самое удачное имя для поля, оно мало что говорит о своём назначении
| * Class with realising interface MyTreeSet | ||
| * @param <E> type of elements | ||
| */ | ||
| public class MindTreeSet<E> implements MyTreeSet<E>{ |
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.
тут бы не помешали какие-нибудь подходящие wilcard'ы генерикам
| * @return result of compare | ||
| */ | ||
| private int compare(E e1, E e2) { | ||
| if (comparator == null) { |
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.
давайте в конструкторе проинициализируем компаратор, чтобы он использовал compareTo(). тогда не нужно будет постоянно эти проверки делать
| Node<E> cur; | ||
| boolean direction; | ||
|
|
||
| TreeSetIterator(boolean r2) { |
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.
r2 тоже не особо удачное имя для аргумента
| * @return true, if it's new element, false, if element is already exist | ||
| */ | ||
| @Override | ||
| public boolean add(E e) { |
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.
это слишком длинный и сложный метод, давайте разобьём его на несколько
|
|
||
| Node start = null; | ||
| Node finish = null; | ||
| Node root = null; |
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.
давайте разделим сущности множества и дерева, которое оно использует для своей работы
| **/ | ||
| @Override | ||
| public MyTreeSet<E> descendingSet() { // | ||
| return null; |
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.
это как-то не доделано
-0.5
No description provided.