public static void main(String[] args) { Mother mother = new Mother(); mother.narrate(new Book()); mother.narrate(new Newspaper()); }
public void setStepMother(Mother stepMother) { if (this.getStepMother() != null) { this.getStepMother() .z_internalRemoveFromMotherStepChildren_stepChild(getMotherStepChildren_stepMother()); } if (stepMother == null) { this.z_internalRemoveFromMotherStepChildren_stepMother( this.getMotherStepChildren_stepMother()); } else { MotherStepChildren motherStepChildren_stepMother = new MotherStepChildren((StepChild) this, (Mother) stepMother); this.z_internalAddToMotherStepChildren_stepMother(motherStepChildren_stepMother); stepMother.z_internalAddToMotherStepChildren_stepChild(motherStepChildren_stepMother); } }
public String getRelationship(String name1, String name2, Person head) { Person firstPerson = personManager.getPersonWithName(head, name1); Person secondPerson = personManager.getPersonWithName(head, name2); String relation = Father.isFather(firstPerson, secondPerson) ? RelationEnum.FATHER.toString() : Mother.isMother(firstPerson, secondPerson) ? RelationEnum.MOTHER.toString() : Son.isSon(firstPerson, secondPerson) ? RelationEnum.SON.toString() : Daughter.isDaughter(firstPerson, secondPerson) ? RelationEnum.DAUGHTER.toString() : Brothers.isBrother(firstPerson, secondPerson) ? RelationEnum.BROTHERS.toString() : Sisters.isSister(firstPerson, secondPerson) ? RelationEnum.SISTERS.toString() : GrandDaughter.isGrandDaughter(firstPerson, secondPerson) ? RelationEnum.GRANDDAUGHTER.toString() : PaternalUncle.isPaternalUncle(firstPerson, secondPerson) ? RelationEnum.PATERNALUNCLE.toString() : PaternalAunt.isPaternalAunt(firstPerson, secondPerson) ? RelationEnum.PATERNALAUNT.toString() : MaternalUncle.isMaternalUncle( firstPerson, secondPerson) ? RelationEnum.MATERNALUNCLE.toString() : MaternalAunt.isMaternalAunt( firstPerson, secondPerson) ? RelationEnum.MATERNALAUNT.toString() : SisterInLaw.isSisterInLaw( firstPerson, secondPerson) ? RelationEnum.SISTERINLAW.toString() : BrotherInLaw.isBrotherInLaw( firstPerson, secondPerson) ? RelationEnum.BROTHERINLAW.toString() : Cousins.isCousin( firstPerson, secondPerson) ? RelationEnum.COUSINS.toString() : null; return relation; }