Enum Element

  • All Implemented Interfaces:
    Serializable, Comparable<Element>

    public enum Element
    extends Enum<Element>
    Enumeration for typical chemical elements in lipids. Also supports heavy variants, e.g. C' as the heavy C13 isotope.
    Author:
    nils.hoffmann
    • Method Detail

      • values

        public static Element[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Element c : Element.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Element valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • getMass

        public double getMass()
      • forName

        public static Optional<ElementforName​(String name)
        Tries to find the corresponding element by name, e.g. 'C' would return carbon, while '13C' would return the corresponding carbon isotope. Note that 'C'' is an alias for 13C.
        Parameters:
        name - the name of the chemical element.
        Returns:
        the corresponding element, if it exists. It not, an empty optional will be returned.