Package org.openscience.cdk
Class Element
- java.lang.Object
-
- org.openscience.cdk.ChemObject
-
- org.openscience.cdk.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:
XMLIsotopeFactory
, Serialized Form- Source code:
- main
- Belongs to CDK module:
- data
- Keywords:
- element
-
-
Field Summary
Fields Modifier and Type Field Description protected Integer
atomicNumber
The atomic number for this element giving their position in the periodic table.-
Fields inherited from interface org.openscience.cdk.interfaces.IChemObject
ALIPHATIC, AROMATIC, CONJUGATED, HYDROGEN_BOND_ACCEPTOR, HYDROGEN_BOND_DONOR, IN_RING, MAPPED, NOT_IN_RING, PLACED, REACTIVE_CENTER, SINGLE_OR_DOUBLE, TYPEABLE, VISITED
-
Fields inherited from interface org.openscience.cdk.interfaces.IElement
Ac, Ag, Al, Am, Ar, As, At, Au, B, Ba, Be, Bh, Bi, Bk, Br, C, Ca, Cd, Ce, Cf, Cl, Cm, Cn, Co, Cr, Cs, Cu, Db, Ds, Dy, Er, Es, Eu, F, Fe, Fl, Fm, Fr, Ga, Gd, Ge, H, He, Hf, Hg, Ho, Hs, I, In, Ir, K, Kr, La, Li, Lr, Lu, Lv, Mc, Md, Mg, Mn, Mo, Mt, N, Na, Nb, Nd, Ne, Nh, Ni, No, Np, O, Og, Os, P, Pa, Pb, Pd, Pm, Po, Pr, Pt, Pu, Ra, Rb, Re, Rf, Rg, Rh, Rn, Ru, S, Sb, Sc, Se, Sg, Si, Sm, Sn, Sr, Ta, Tb, Tc, Te, Th, Ti, Tl, Tm, Ts, U, V, W, Wildcard, Xe, Y, Yb, Zn, Zr
-
-
Constructor Summary
Constructors Constructor Description Element()
Constructs an empty Element.Element(String symbol)
Constructs an Element with a given element symbol.Element(String symbol, Integer atomicNumber)
Constructs an Element with a given element symbol, atomic number and atomic mass.Element(IElement element)
Constructs an empty by copying the symbol, atomic number, flags, and identifier from the given IElement.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
clone()
Clones thisIChemObject
.boolean
compare(Object object)
Compares an Element with this Element.Integer
getAtomicNumber()
Returns the atomic number of this element.String
getSymbol()
Returns the element symbol of this element.void
setAtomicNumber(Integer atomicNumber)
Sets the atomic number of this element.void
setSymbol(String symbol)
Sets the element symbol of this element.String
toString()
Returns a one line description of this IChemObject.-
Methods inherited from class org.openscience.cdk.ChemObject
addListener, addProperties, clear, flags, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, is, notifyChanged, notifyChanged, removeListener, removeProperty, set, setFlag, setFlags, setID, setNotification, setProperties, setProperty, shallowCopy
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openscience.cdk.interfaces.ICDKObject
getBuilder
-
Methods inherited from interface org.openscience.cdk.interfaces.IChemObject
addListener, addProperties, clear, flags, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, is, notifyChanged, notifyChanged, removeListener, removeProperty, set, setFlag, setFlags, setID, setNotification, setProperties, setProperty
-
-
-
-
Field Detail
-
atomicNumber
protected Integer atomicNumber
The atomic number for this element giving their position in the periodic table.
-
-
Constructor Detail
-
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.- Parameters:
element
- IElement to copy information from
-
Element
public Element(String symbol)
Constructs an Element with a given element symbol.- Parameters:
symbol
- The element symbol that this element should have.
-
-
Method Detail
-
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()); if.configure(element);
- Specified by:
getAtomicNumber
in interfaceIElement
- Returns:
- The atomic number of this element
- See Also:
setAtomicNumber(java.lang.Integer)
-
setAtomicNumber
public void setAtomicNumber(Integer atomicNumber)
Sets the atomic number of this element.- Specified by:
setAtomicNumber
in interfaceIElement
- Parameters:
atomicNumber
- The atomic mass to be assigned to this element- See Also:
getAtomicNumber()
-
getSymbol
public String getSymbol()
Returns the element symbol of this element.- Specified by:
getSymbol
in interfaceIElement
- Returns:
- The element symbol of this element. Null if unset.
- See Also:
setSymbol(java.lang.String)
-
setSymbol
public void setSymbol(String symbol)
Sets the element symbol of this element.- Specified by:
setSymbol
in interfaceIElement
- Parameters:
symbol
- The element symbol to be assigned to this atom- See Also:
getSymbol()
-
toString
public String toString()
Description copied from interface:IChemObject
Returns a one line description of this IChemObject.- Specified by:
toString
in interfaceIChemObject
- Overrides:
toString
in classObject
- Returns:
- a String representation of this object
-
clone
public Object clone() throws CloneNotSupportedException
Description copied from class:ChemObject
Clones thisIChemObject
. 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 interfaceIChemObject
- Overrides:
clone
in classChemObject
- Returns:
- The cloned object
- Throws:
CloneNotSupportedException
- if the IChemObject cannot be cloned
-
compare
public boolean compare(Object object)
Compares an Element with this Element.- Overrides:
compare
in classChemObject
- Parameters:
object
- Object of type AtomType- Returns:
- true if the atom types are equal
-
-