/// <summary> /// Return the Specie updated in the list. /// If not exists, it return null. /// </summary> /// <param name="pName"></param> /// <param name="pSpecieCycleName"></param> /// <param name="pBaseTemperature"></param> /// <returns></returns> public Specie UpdateSpecie(String pName, String pShortName, String pSpecieCycleName, Double pBaseTemperature, Double pStressTemperature, Utils.SpecieType pSpecieType) { Specie lReturn = null; SpecieCycle lSpecieCycle = null; long lSpecieCycleId = this.SpecieCycleList.Count; Specie lSpecie = null; long lSpecieId = this.SpecieList.Count; lSpecieCycle = this.FindSpecieCycle(pSpecieCycleName); if (lSpecieCycle == null) { lSpecieCycle = this.AddSpecieCycle(pSpecieCycleName); } //If not exists SpecieCycle, its create a new SpecieCycle. //In both cases, lSpecieCycle isnt null lSpecieCycleId = lSpecieCycle.SpecieCycleId; lSpecie = new Specie(lSpecieId, pName, pShortName, lSpecieCycleId, pBaseTemperature, pStressTemperature, pSpecieType); lReturn = ExistSpecie(lSpecie); if (lReturn != null) { lReturn.Name = pName; lReturn.ShortName = pShortName; lReturn.SpecieCycleId = lSpecieCycleId; lReturn.BaseTemperature = pBaseTemperature; lReturn.StressTemperature = pStressTemperature; lReturn.SpecieType = pSpecieType; } return(lReturn); }
/// <summary> /// Return the Specie added to the list. /// If already exists, it return the one of the list. /// </summary> /// <param name="pName"></param> /// <param name="pShortName"></param> /// <param name="pSpecieCycleName"></param> /// <param name="pBaseTemperature"></param> /// <param name="pStressTemperarute"></param> /// <param name="pSpecieType"></param> /// <returns></returns> public Specie AddSpecie(String pName, String pShortName, String pSpecieCycleName, Double pBaseTemperature, Double pStressTemperarute, Utils.SpecieType pSpecieType) { Specie lReturn = null; long lSpecieId = this.GetNewSpecieListId(); SpecieCycle lSpecieCycle = null; Specie lSpecie = null; lSpecieCycle = this.FindSpecieCycle(pSpecieCycleName); if (lSpecieCycle == null) { lSpecieCycle = this.AddSpecieCycle(pSpecieCycleName); } lSpecie = new Specie(lSpecieId, pName, pShortName, lSpecieCycle.SpecieCycleId, pBaseTemperature, pStressTemperarute, pSpecieType); lSpecie.SpecieCycle = lSpecieCycle; lReturn = this.ExistSpecie(lSpecie); if (lReturn == null) { this.SpecieList.Add(lSpecie); lReturn = lSpecie; } return(lReturn); }
/// <summary> /// Constructor of Specie without parameters /// </summary> public Specie() { //this.specieId = 0; this.Name = "noName"; this.ShortName = ""; this.SpecieCycleId = 0; this.BaseTemperature = 0; this.StressTemperature = 0; this.SpecieType = Utils.SpecieType.Default; }
/// <summary> /// Constructor of Specie with parameters /// </summary> /// <param name="pSpecieId"></param> /// <param name="pName"></param> /// <param name="pShortName"></param> /// <param name="pSpecieCycleId"></param> /// <param name="pBaseTemperature"></param> /// <param name="pStressTemperature"></param> public Specie(long pSpecieId, String pName, String pShortName, long pSpecieCycleId, Double pBaseTemperature, Double pStressTemperature, Utils.SpecieType pSpecieType) { this.specieId = pSpecieId; this.Name = pName; this.ShortName = pShortName; this.SpecieCycleId = pSpecieCycleId; this.BaseTemperature = pBaseTemperature; this.StressTemperature = pStressTemperature; this.SpecieType = pSpecieType; }