public void removeChild(Person barn) { if (this.isMale()) { barn.setFather(null); } else if (this.isFemale()) { barn.setMother(null); } }
public void addChild(Person barn) { if (!this.children.contains(barn)) { if (this.isMale()) { barn.setFather(this); } else if (this.isFemale()) { barn.setMother(this); } } }
public void setFather(Person far) { if (far == null) { if (this.father != null) { this.father.children.remove(this); } this.father = far; } else if (far.isMale()) { if (this.father != null) { this.father.children.remove(this); } this.father = far; this.father.children.add(this); } }
public void setMother(Person mor) { if (mor == null) { if (this.mother != null) { this.mother.children.remove(this); } this.mother = mor; } else if (mor.isFemale()) { if (this.mother != null) { this.mother.children.remove(this); } this.mother = mor; this.mother.children.add(this); } }