コード例 #1
0
ファイル: gedcomer.cs プロジェクト: anytizer/gedcomer
        public void root(individual whoever)
        {
            family clan = new family();

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

            this.clans.Add(clan);
        }
コード例 #2
0
ファイル: individual.cs プロジェクト: anytizer/gedcomer
 /**
  * An alternative way to express
  */
 public void marry(individual opposite)
 {
     // @todo Recursion prevention: Cannot marry oneself.
     if (opposite != null)
     {
         if (this.id != opposite.id)
         {
             if (this.id != opposite.id)
             {
                 this.relate(kinship.SPOUSE, opposite);
             }
         }
     }
 }
コード例 #3
0
ファイル: gedcomer.cs プロジェクト: anytizer/gedcomer
        public string _relationships()
        {
            string gedcom   = "";
            string families = "";

            foreach (family f in this.clans)
            {
                gedcom += string.Format(@"
0 @{0}@ FAM
", f.id);

                individual self = f.members[0];
                families += self._father_id();
                families += self._mother_id();
            }

            gedcom += families;
            return(gedcom);
        }
コード例 #4
0
ファイル: individual.cs プロジェクト: anytizer/gedcomer
        //private role role;

        public individual(string name = "")
        {
            // look up based on id
            this.id = string.Format("I{0}", universe.id());

            this.name  = name;
            this.name2 = ""; // alias

            this.sex = sex.UNKNOWN;

            this.BIRTH = new date(datetype.DEAT, "", "");
            this.DEATH = new date(datetype.BIRT, "", "");

            this.events = new List <@event>();
            this.notes  = new List <note>();
            this.photos = new List <photo>();

            // relatives
            this.father   = null;
            this.mother   = null;
            this.spouses  = new List <individual>();
            this.children = new List <individual>();
        }
コード例 #5
0
ファイル: individual.cs プロジェクト: anytizer/gedcomer
        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;
                }
            }
        }