Пример #1
0
        public void root(individual whoever)
        {
            family clan = new family();

            whoever.belongsto(clan);
            clan.members.Add(whoever);

            this.clans.Add(clan);
        }
Пример #2
0
        internal void belongsto(family family)
        {
            role r;

            if (this.sex == sex.MALE)
            {
                r = role.HUSB;
            }
            else
            {
                r = role.WIFE;
            }

            this.belongsToFamily = family;
            //this.role = r;
        }
Пример #3
0
        public void relate(kinship relationship, individual person)
        {
            if (person.belongsToFamily == null)
            {
                person.belongsToFamily = new family();
            }

            if (person != null)
            {
                // if (person.sex == sex.MALE)
                // {
                //     person.role = role.HUSB;
                // }
                // else
                // {
                //     person.role = role.WIFE;
                // }

                // sex correction by known relationships
                switch (relationship)
                {
                case kinship.SELF:
                    this.id   = person._id();
                    this.name = person._name();
                    this.sex  = person._sex();
                    // this.role = role.SELF;

                    // @todo Copy these records too
                    // @todo Multiple calls should not be available
                    // @todo Must be called and once only
                    break;

                case kinship.FATHER:
                    person.male();
                    // @todo add spouse
                    //person.role = role.HUSB;
                    this.father = person;

                    // @if mother available, marry
                    this.father.marry(this.mother);
                    break;

                case kinship.MOTHER:
                    //person.role = role.WIFE;
                    person.female();
                    // @todo add spouse
                    this.mother = person;

                    // @if father available, marry
                    this.mother.marry(this.father);
                    break;

                case kinship.SPOUSE:
                    // @todo sex flip
                    // or often allow same sex spousing if there is an adoptation
                    // what if they do not have a child?
                    if (this.belongsToFamily == null)
                    {
                        this.belongsToFamily = new family();
                    }

                    if (person.sex == sex.FEMALE)
                    {
                        person.sex = sex.MALE;
                        //person.role = role.HUSB;
                    }
                    else
                    {
                        person.sex = sex.FEMALE;
                        //person.role = role.WIFE;
                    }
                    this.spouses.Add(person);
                    break;

                case kinship.CHILD:
                    //person.role = role.CHIL;
                    this.children.Add(person);
                    break;
                }
            }
        }