public static double GetAvarageHalfLife(IsotopeDataModel isotopeData) { double avarageHalfLife = 0; foreach (var isotope in isotopeData.Isotopes) { avarageHalfLife += GetHalfLife(isotope, 0); } avarageHalfLife /= isotopeData.Isotopes.Length; return(avarageHalfLife); }
public static IsotopeModel GetIsotope(IsotopeDataModel isotopeData, int massNumber) { if (isotopeData == null) { return(new IsotopeModel(isotopeData.Symbol, massNumber, "?", new DecayModel[0])); } var isotopeEnumerable = isotopeData.Isotopes.Where(i => i.MassNumber == massNumber); if (isotopeEnumerable.Count() == 0) { return(new IsotopeModel(isotopeData.Symbol, massNumber, "", new DecayModel[0])); } return(isotopeEnumerable.First()); }