Skip to content

Conversation

@dream-ink
Copy link

No description provided.

Comment on lines 13 to 14
public String mother;
public String father;
Copy link
Owner

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());
Copy link
Owner

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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже самое. Приведение типов ошибка. Будет работать только если использовать Human, а для Dog например приложение упадет

Comment on lines 8 to 14
public class Presenter {
private View view;

public Presenter(View view) {
this.view = view;
}
} No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И все?)) Такой презентер не создаст связи между view и моделью

int age = Integer.parseInt(scanner.nextLine());
}

private static void printMenu() {
Copy link
Owner

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;
Copy link
Owner

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){
;
Copy link
Owner

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){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень мало данных для создания человека. Мы там намного больше полей выделяли. А вместо возраста использовали дату рождения и смерти

Comment on lines +20 to +35
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();
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Скорее это работа семейного дерева, а точнее его метод toString. А здесь только вызов этого метода у дерева. Нарушение первого принципа солид

}
return stringBuilder.toString();
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не хватает методов сохранения и загрузки

Comment on lines +19 to +23
public void addHuman(String name, int age) {
service.add(name, age);
//какой-то ответ
getHumansListInfo();
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет возможности создания родственных связей, а это основная идея нашего приложения

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants