/// <summary> /// Add the principal isotope of the element to this chemical formula /// given its chemical symbol /// </summary> /// <param name="symbol">The chemical symbol of the element to add</param> /// <param name="count">The number of the element to add</param> public void Add(string symbol, int count) { try { Isotope isotope = PeriodicTable.GetElement(symbol).PrincipalIsotope; Add(isotope, count); } catch (KeyNotFoundException e) { throw new KeyNotFoundException(string.Format("The element symbol '{0}' is not found in the periodic table", symbol), e); } }
public int Count(string symbol, int atomicNumber) { Isotope isotope = PeriodicTable.GetElement(symbol)[atomicNumber]; return(Count(isotope)); }
public int Count(string symbol) { Element element = PeriodicTable.GetElement(symbol); return(Count(element)); }
/// <summary> /// Remove all the isotopes of an chemical element represented by the symbol /// from this chemical formula /// </summary> /// <param name="symbol">The symbol of the chemical element to remove</param> /// <returns>True if the element was present and removed, false otherwise</returns> public int Remove(string symbol) { return(Remove(PeriodicTable.GetElement(symbol))); }
/// <summary> /// Remove the principal isotope of the element represented by the symbol /// from this chemical formula /// </summary> /// <param name="symbol">The symbol of the chemical element to remove</param> /// <param name="count">The number of isotopes to remove</param> public void Remove(string symbol, int count) { Add(PeriodicTable.GetElement(symbol).PrincipalIsotope, -count); }