/// <summary> ///Creates a reproduction with initial state. /// </summary> /// <param name="female">The female.</param> /// <param name="male">The male.</param> /// <param name="date">The date.</param> /// <param name="type">The type.</param> /// <param name="status">The status.</param> /// <param name="commentary">The commentary.</param> /// <returns></returns> public static Reproduction Initialize(Female female, Male male, DateTime date, ReproductionTypeEnum type, ReproductionStateEnum status, string commentary) { if (female != null && female.CanBeMated(date) && status == ReproductionStateEnum.Initial) { return(new Reproduction(female, male, date, type, ReproductionStateEnum.Initial, commentary)); } return(Reproduction.None); }
/// <summary> /// Initializes a new instance of the <see cref="Reproduction"/> class. /// </summary> /// <param name="female">The female.</param> /// <param name="male">The male.</param> /// <param name="date">The date.</param> /// <param name="type">The type.</param> /// <param name="states">The states.</param> /// <param name="commentary">The commentary.</param> private Reproduction(Female female, Male male, DateTime date, ReproductionTypeEnum type, IEnumerable <ReproductionState> states, string commentary) { if (female != null && male != null) { Female = female; Male = male; Date = date; Type = type; States = States.Union(states); Commentary = commentary; } else { Female = null; Male = null; Date = DateTime.MinValue; Type = ReproductionTypeEnum.Artificial; } }
/// <summary> /// Initializes a new instance of the <see cref="Reproduction"/> class. /// </summary> /// <param name="female">The female.</param> /// <param name="male">The male.</param> /// <param name="date">The date.</param> /// <param name="type">The type.</param> /// <param name="status">The status.</param> /// <param name="commentary">The commentary.</param> private Reproduction(Female female, Male male, DateTime date, ReproductionTypeEnum type, ReproductionStateEnum status, string commentary) { if (female != null && female.CanBeMated(date) && status == ReproductionStateEnum.Initial) { Female = female; Male = male; Date = date; Type = type; States.Append(new ReproductionState(status, date)); Commentary = commentary; } else { Female = null; Male = null; Date = DateTime.MinValue; Type = ReproductionTypeEnum.Artificial; } }
/// <summary> /// Indicates that the specified male has mated the given female. /// </summary> /// <param name="female">The female.</param> /// <param name="date">The date.</param> /// <param name="type">The type.</param> /// <param name="status">The status.</param> /// <param name="commentary">The commentary.</param> /// <returns>A Reproduction object with initial state</returns> public ValueObjects.Reproduction HasMated(Female female, DateTime date, ReproductionTypeEnum type, ReproductionStateEnum status, string commentary) { return(ValueObjects.Reproduction.Initialize(female, this, date, type, status, commentary)); }
/// <summary> /// Initializes a new instance of the <see cref="Reproduction"/> class. /// </summary> /// <param name="female">The female.</param> /// <param name="male">The male.</param> /// <param name="date">The date.</param> /// <param name="type">The type.</param> /// <param name="status">The status.</param> private Reproduction(Female female, Male male, DateTime date, ReproductionTypeEnum type, ReproductionStateEnum status) : this(female, male, date, type, status, null) { }