Class Element

All Implemented Interfaces:
Serializable, Cloneable, ICDKObject, IChemObject, IElement
Direct Known Subclasses:
DebugElement, Isotope

public class Element extends ChemObject implements Serializable, IElement, Cloneable
Implements the idea of an element in the periodic table.

Use the IsotopeFactory to get a ready-to-use elements by symbol or atomic number:

   IsotopeFactory if = IsotopeFactory.getInstance(new Element().getNewBuilder());
   Element e1 = if.getElement("C");
   Element e2 = if.getElement(12);
See Also:
Source code:
Belongs to CDK module:
  • Field Details

    • atomicNumber

      protected Integer atomicNumber
      The atomic number for this element giving their position in the periodic table.
  • Constructor Details

    • Element

      public Element()
      Constructs an empty Element.
    • Element

      public Element(IElement element)
      Constructs an empty by copying the symbol, atomic number, flags, and identifier from the given IElement. It does not copy the listeners and properties.
      element - IElement to copy information from
    • Element

      public Element(String symbol)
      Constructs an Element with a given element symbol.
      symbol - The element symbol that this element should have.
    • Element

      public Element(String symbol, Integer atomicNumber)
      Constructs an Element with a given element symbol, atomic number and atomic mass.
      symbol - The element symbol of this element.
      atomicNumber - The atomicNumber of this element.
  • Method Details

    • getAtomicNumber

      public Integer getAtomicNumber()
      Returns the atomic number of this element.

      Once instantiated all field not filled by passing parameters to the constructor are null. Elements can be configured by using the IsotopeFactory.configure() method:

         Element element = new Element("C");
         IsotopeFactory if = IsotopeFactory.getInstance(element.getNewBuilder());
      Specified by:
      getAtomicNumber in interface IElement
      The atomic number of this element
      See Also:
    • setAtomicNumber

      public void setAtomicNumber(Integer atomicNumber)
      Sets the atomic number of this element.
      Specified by:
      setAtomicNumber in interface IElement
      atomicNumber - The atomic mass to be assigned to this element
      See Also:
    • getSymbol

      public String getSymbol()
      Returns the element symbol of this element.
      Specified by:
      getSymbol in interface IElement
      The element symbol of this element. Null if unset.
      See Also:
    • setSymbol

      public void setSymbol(String symbol)
      Sets the element symbol of this element.
      Specified by:
      setSymbol in interface IElement
      symbol - The element symbol to be assigned to this atom
      See Also:
    • toString

      public String toString()
      Description copied from interface: IChemObject
      Returns a one line description of this IChemObject.
      Specified by:
      toString in interface IChemObject
      toString in class Object
      a String representation of this object
    • clone

      public Object clone() throws CloneNotSupportedException
      Description copied from class: ChemObject
      Clones this IChemObject. It clones the identifier, flags, properties and pointer vectors. The ChemObjectListeners are not cloned, and neither is the content of the pointer vectors.
      Specified by:
      clone in interface IChemObject
      clone in class ChemObject
      The cloned object
      CloneNotSupportedException - if the IChemObject cannot be cloned
    • compare

      public boolean compare(Object object)
      Compares an Element with this Element.
      compare in class ChemObject
      object - Object of type AtomType
      true if the atom types are equal