示例#1
0
文件: God.cs 项目: resaglow/study
        Human CreatePair(Human human, Sex gender)
        {
            if (human == null)
            {
                throw new ArgumentNullException();
            }

            Human newHuman;
            if (human is Botan)
            {
                newHuman = CreateCoolParentPair(human as Botan);
            }
            else if (human is CoolParent)
            {
                newHuman = CreateBotanPair(human as CoolParent, gender);
            }
            else if (human is Student)
            {
                newHuman = CreateParentPair(human as Student);
            }
            else if (human is Parent)
            {
                newHuman = CreateStudentPair(human as Parent, gender);
            }
            else
            {
                throw new ArgumentNullException();
            }
            Humans.Add(newHuman);
            return newHuman;
        }
示例#2
0
文件: God.cs 项目: resaglow/study
 public Human CreatePair(Human human)
 {
     if (human == null)
     {
         throw new ArgumentNullException();
     }
     return CreatePair(human, RandomDataProvider.RandomGender());
 }