-
Notifications
You must be signed in to change notification settings - Fork 69
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
add DZ1 #11
base: master
Are you sure you want to change the base?
add DZ1 #11
Conversation
src/family_tree/human/Human.java
Outdated
public String mother; | ||
public String father; |
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.
Почему дети Human, а родители только String? что за странная семья?) родители тоже должны быть Human
} | ||
|
||
public void sortName() { | ||
humanList.sort((Comparator<? super E>) new HumanCompName()); |
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 Iterator<E> iterator() { | ||
return (Iterator<E>) new FamilyTreeIter(humanList); |
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.
Тоже самое. Приведение типов ошибка. Будет работать только если использовать Human, а для Dog например приложение упадет
public class Presenter { | ||
private View view; | ||
|
||
public Presenter(View view) { | ||
this.view = view; | ||
} | ||
} |
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.
И все?)) Такой презентер не создаст связи между view и моделью
src/family_tree/view/ConsoleUI.java
Outdated
int age = Integer.parseInt(scanner.nextLine()); | ||
} | ||
|
||
private static void printMenu() { |
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 class FamilyTree<E extends TreeN<E>> implements Serializable, Iterable<E> { | ||
private final List<E> humanList; | ||
private Writer writer; |
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 void add(String name, int age){ | ||
; |
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.
Это что за артефакт?)
group = new FamilyTree<>(); | ||
} | ||
|
||
public void add(String name, int age){ |
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 getHumanInfo() { | ||
StringBuilder stringBuilder = new StringBuilder(); | ||
stringBuilder.append("Список Членов семьи:\n"); | ||
|
||
// Iterator<Student> iterator = group.iterator(); | ||
// while (iterator.hasNext()){ | ||
// Student student = iterator.next(); | ||
// stringBuilder.append(student); | ||
// stringBuilder.append("\n"); | ||
// } | ||
for (Human human: group){ | ||
stringBuilder.append(human); | ||
stringBuilder.append("\n"); | ||
} | ||
return stringBuilder.toString(); | ||
} |
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.
Скорее это работа семейного дерева, а точнее его метод toString. А здесь только вызов этого метода у дерева. Нарушение первого принципа солид
} | ||
return stringBuilder.toString(); | ||
} | ||
|
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 void addHuman(String name, int age) { | ||
service.add(name, age); | ||
//какой-то ответ | ||
getHumansListInfo(); | ||
} |
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.