public interface IAtomContainer extends IChemObject, IChemObjectListener
Looping over all IBond
s in the IAtomContainer
is typically done like:
for (IBond bond : atomContainer.bonds()) { // do something }If you do need an explicit Iterator then use
Iterator<IBond> bondIter = atomContainer.bonds().iterator();
Modifier and Type | Method and Description |
---|---|
void |
add(IAtomContainer atomContainer)
Adds all atoms and electronContainers of a given atomcontainer to this
container.
|
void |
addAtom(IAtom atom)
Adds an atom to this container.
|
void |
addBond(IBond bond)
Adds a Bond to this AtomContainer.
|
void |
addBond(int atom1,
int atom2,
IBond.Order order)
Adds a bond to this container.
|
void |
addBond(int atom1,
int atom2,
IBond.Order order,
IBond.Stereo stereo)
Adds a bond to this container.
|
void |
addElectronContainer(IElectronContainer electronContainer)
Adds a ElectronContainer to this AtomContainer.
|
void |
addLonePair(ILonePair lonePair)
Adds a lone pair to this AtomContainer.
|
void |
addLonePair(int atomID)
Adds a LonePair to this Atom.
|
void |
addSingleElectron(int atomID)
Adds a SingleElectron to this Atom.
|
void |
addSingleElectron(ISingleElectron singleElectron)
Adds a single electron to this AtomContainer.
|
void |
addStereoElement(IStereoElement element)
Adds a stereo element to this container.
|
Iterable<IAtom> |
atoms()
Returns an Iterable for looping over all atoms in this container.
|
Iterable<IBond> |
bonds()
Returns an Iterable for looping over all bonds in this container.
|
IAtomContainer |
clone()
Returns a deep clone of this IChemObject.
|
boolean |
contains(IAtom atom)
True, if the AtomContainer contains the given atom object.
|
boolean |
contains(IBond bond)
True, if the AtomContainer contains the given bond object.
|
boolean |
contains(IElectronContainer electronContainer)
True, if the AtomContainer contains the given ElectronContainer object.
|
boolean |
contains(ILonePair lonePair)
True, if the AtomContainer contains the given LonePair object.
|
boolean |
contains(ISingleElectron singleElectron)
True, if the AtomContainer contains the given SingleElectron object.
|
Iterable<IElectronContainer> |
electronContainers()
Returns an Iterable for looping over all electron containers in this container.
|
IAtom |
getAtom(int number)
Get the atom at position
number in [0,..]. |
int |
getAtomCount()
Returns the number of Atoms in this Container.
|
int |
getAtomNumber(IAtom atom)
Deprecated.
use
indexOf(IAtom) |
IBond |
getBond(IAtom atom1,
IAtom atom2)
Returns the bond that connectes the two given atoms.
|
IBond |
getBond(int number)
Get the bond at position
number in [0,..]. |
int |
getBondCount()
Returns the number of Bonds in this Container.
|
int |
getBondNumber(IAtom atom1,
IAtom atom2)
Deprecated.
use
indexOf(IBond) |
int |
getBondNumber(IBond bond)
Deprecated.
use
indexOf(IBond) |
double |
getBondOrderSum(IAtom atom)
Returns the sum of the bond orders for a given Atom.
|
int |
getConnectedAtomsCount(IAtom atom)
Returns the number of atoms connected to the given atom.
|
List<IAtom> |
getConnectedAtomsList(IAtom atom)
Returns an ArrayList of all atoms connected to the given atom.
|
int |
getConnectedBondsCount(IAtom atom)
Returns the number of Bonds for a given Atom.
|
int |
getConnectedBondsCount(int atomnumber)
Returns the number of connected atoms (degree) to the given atom.
|
List<IBond> |
getConnectedBondsList(IAtom atom)
Returns an ArrayList of all Bonds connected to the given atom.
|
List<IElectronContainer> |
getConnectedElectronContainersList(IAtom atom)
Returns an ArrayList of all electronContainers connected to the given atom.
|
int |
getConnectedLonePairsCount(IAtom atom)
Returns the number of LonePairs for a given Atom.
|
List<ILonePair> |
getConnectedLonePairsList(IAtom atom)
Returns the array of lone pairs connected to an atom.
|
int |
getConnectedSingleElectronsCount(IAtom atom)
Returns the sum of the SingleElectron for a given Atom.
|
List<ISingleElectron> |
getConnectedSingleElectronsList(IAtom atom)
Returns an array of all SingleElectron connected to the given atom.
|
IElectronContainer |
getElectronContainer(int number)
Returns the ElectronContainer at position
number in the
container. |
int |
getElectronContainerCount()
Returns the number of ElectronContainers in this Container.
|
IAtom |
getFirstAtom()
Deprecated.
use
getAtom(int) |
IAtom |
getLastAtom()
Deprecated.
use
getAtom(int) |
ILonePair |
getLonePair(int number)
Get the lone pair at position
number in [0,..]. |
int |
getLonePairCount()
Returns the number of LonePairs in this Container.
|
int |
getLonePairNumber(ILonePair lonePair)
Deprecated.
|
IBond.Order |
getMaximumBondOrder(IAtom atom)
Returns the maximum bond order that this atom currently has in the context
of this AtomContainer.
|
IBond.Order |
getMinimumBondOrder(IAtom atom)
Returns the minimum bond order that this atom currently has in the context
of this AtomContainer.
|
ISingleElectron |
getSingleElectron(int number)
Get the single electron at position
number in [0,..]. |
int |
getSingleElectronCount()
Returns the number of the single electrons in this container.
|
int |
getSingleElectronNumber(ISingleElectron singleElectron)
Deprecated.
|
int |
indexOf(IAtom atom)
Access the storage index of an atom.
|
int |
indexOf(IBond bond)
Access the storage index of a bond.
|
int |
indexOf(ILonePair pair)
Access the storage index of a long pair.
|
int |
indexOf(ISingleElectron electron)
Access the storage index of a single electron (radical).
|
boolean |
isEmpty()
Indicates whether this container is empty.
|
Iterable<ILonePair> |
lonePairs()
Returns an Iterable for looping over all lone pairs in this container.
|
void |
remove(IAtomContainer atomContainer)
Removes all atoms and electronContainers of a given atomcontainer from this
container.
|
void |
removeAllBonds()
Removes all Bonds from this container.
|
void |
removeAllElectronContainers()
Removes electronContainers from this container.
|
void |
removeAllElements()
Removes all atoms, bonds and stereo elements from this container.
|
void |
removeAtom(IAtom atom)
Removes the given atom from the AtomContainer.
|
void |
removeAtom(int position)
Removes the atom at the given position from the AtomContainer.
|
void |
removeAtomAndConnectedElectronContainers(IAtom atom)
Removes the given atom and all connected electronContainers from the
AtomContainer.
|
IBond |
removeBond(IAtom atom1,
IAtom atom2)
Removes the bond that connects the two given atoms.
|
void |
removeBond(IBond bond)
Removes the bond from this container.
|
IBond |
removeBond(int position)
Removes the bond at the given position from the AtomContainer.
|
void |
removeElectronContainer(IElectronContainer electronContainer)
Removes this ElectronContainer from this container.
|
IElectronContainer |
removeElectronContainer(int position)
Removes the bond at the given position from this container.
|
void |
removeLonePair(ILonePair lonePair)
Removes the lone pair from the AtomContainer.
|
ILonePair |
removeLonePair(int position)
Removes the lone pair at the given position from the AtomContainer.
|
ISingleElectron |
removeSingleElectron(int position)
Removes the single electron at the given position from the AtomContainer.
|
void |
removeSingleElectron(ISingleElectron singleElectron)
Removes the single electron from the AtomContainer.
|
void |
setAtom(int number,
IAtom atom)
Set the atom at position
number in [0,..]. |
void |
setAtoms(IAtom[] atoms)
Sets the array of atoms of this AtomContainer.
|
void |
setBonds(IBond[] bonds)
Sets the array of bonds of this AtomContainer.
|
void |
setStereoElements(List<IStereoElement> elements)
Set the stereo elements - this will replace the existing instance
with a new instance.
|
Iterable<ISingleElectron> |
singleElectrons()
Returns an Iterable for looping over all single electrons in this container.
|
Iterable<IStereoElement> |
stereoElements()
Returns the stereo elements defined for this atom container.
|
addListener, addProperties, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty, toString
getBuilder
stateChanged
void addStereoElement(IStereoElement element)
element
- The new IStereoElement
for this containerstereoElements()
void setStereoElements(List<IStereoElement> elements)
elements
- the new stereo elementsIterable<IStereoElement> stereoElements()
Iterable
of IStereoElement
s.addStereoElement(IStereoElement)
void setAtoms(IAtom[] atoms)
atoms
- The array of atoms to be assigned to this AtomContaineratoms()
void setBonds(IBond[] bonds)
bonds
- The array of bonds to be assigned to
this AtomContainerbonds()
void setAtom(int number, IAtom atom)
number
in [0,..].number
- The position of the atom to be set.atom
- The atom to be stored at position number
getAtom(int)
IAtom getAtom(int number)
number
in [0,..].number
- The position of the atom to be retrieved.setAtom(int, org.openscience.cdk.interfaces.IAtom)
IBond getBond(int number)
number
in [0,..].number
- The position of the bond to be retrieved.ILonePair getLonePair(int number)
number
in [0,..].number
- The position of the LonePair to be retrieved.ISingleElectron getSingleElectron(int number)
number
in [0,..].number
- The position of the SingleElectron to be retrieved.Iterable<IAtom> atoms()
Iterable<IBond> bonds()
Iterable<ILonePair> lonePairs()
Iterable<ISingleElectron> singleElectrons()
Iterable<IElectronContainer> electronContainers()
@Deprecated IAtom getFirstAtom()
getAtom(int)
@Deprecated IAtom getLastAtom()
getAtom(int)
@Deprecated int getAtomNumber(IAtom atom)
indexOf(IAtom)
atom
- The atom to be sought@Deprecated int getBondNumber(IAtom atom1, IAtom atom2)
indexOf(IBond)
atom1
- The first atomatom2
- The second atom@Deprecated int getBondNumber(IBond bond)
indexOf(IBond)
bond
- The bond to be sought@Deprecated int getLonePairNumber(ILonePair lonePair)
indexOf(ILonePair)
lonePair
- The lone pair to be soughtint getSingleElectronNumber(ISingleElectron singleElectron)
indexOf(ISingleElectron)
singleElectron
- The single electron to be soughtint indexOf(IAtom atom)
atom
- atom instance to findint indexOf(IBond bond)
bond
- bond instance to findint indexOf(ISingleElectron electron)
electron
- the electronint indexOf(ILonePair pair)
pair
- the long pairIElectronContainer getElectronContainer(int number)
number
in the
container.number
- The position of the ElectronContainer to be returned.number
.addElectronContainer(IElectronContainer)
IBond getBond(IAtom atom1, IAtom atom2)
atom1
- The first atomatom2
- The second atomint getAtomCount()
int getBondCount()
int getLonePairCount()
int getSingleElectronCount()
int getElectronContainerCount()
List<IAtom> getConnectedAtomsList(IAtom atom)
atom
- The atom the bond partners are searched of.List<IBond> getConnectedBondsList(IAtom atom)
atom
- The atom the connected bonds are searched ofList<ILonePair> getConnectedLonePairsList(IAtom atom)
atom
- The atom for which to get lone pairsList<ISingleElectron> getConnectedSingleElectronsList(IAtom atom)
atom
- The atom on which the single electron is locatedList<IElectronContainer> getConnectedElectronContainersList(IAtom atom)
atom
- The atom the connected electronContainers are searched ofint getConnectedAtomsCount(IAtom atom)
atom
- The atom the number of bond partners are searched of.int getConnectedBondsCount(IAtom atom)
atom
- The atomint getConnectedBondsCount(int atomnumber)
atomnumber
- The atomnumber the degree is searched forint getConnectedLonePairsCount(IAtom atom)
atom
- The atomint getConnectedSingleElectronsCount(IAtom atom)
atom
- The atom on which the single electron is locateddouble getBondOrderSum(IAtom atom)
atom
- The atomIBond.Order getMaximumBondOrder(IAtom atom)
atom
- The atomIBond.Order getMinimumBondOrder(IAtom atom)
atom
- The atomvoid add(IAtomContainer atomContainer)
atomContainer
- The atomcontainer to be addedvoid addAtom(IAtom atom)
atom
- The atom to be added to this containervoid addBond(IBond bond)
bond
- The bond to added to this containervoid addLonePair(ILonePair lonePair)
lonePair
- The LonePair to added to this containervoid addSingleElectron(ISingleElectron singleElectron)
singleElectron
- The SingleElectron to added to this containervoid addElectronContainer(IElectronContainer electronContainer)
electronContainer
- The ElectronContainer to added to this containervoid remove(IAtomContainer atomContainer)
atomContainer
- The atomcontainer to be removedvoid removeAtom(int position)
position
- The position of the atom to be removed.void removeAtom(IAtom atom)
atom
- The atom to be removedIBond removeBond(int position)
position
- The position of the bond to be removed.IBond removeBond(IAtom atom1, IAtom atom2)
atom1
- The first atomatom2
- The second atomvoid removeBond(IBond bond)
bond
- The bond to be removed.ILonePair removeLonePair(int position)
position
- The position of the LonePair to be removed.void removeLonePair(ILonePair lonePair)
lonePair
- The LonePair to be removed.ISingleElectron removeSingleElectron(int position)
position
- The position of the SingleElectron to be removed.void removeSingleElectron(ISingleElectron singleElectron)
singleElectron
- The SingleElectron to be removed.IElectronContainer removeElectronContainer(int position)
position
- The position of the bond in the electronContainers arrayvoid removeElectronContainer(IElectronContainer electronContainer)
electronContainer
- The electronContainer to be removedvoid removeAtomAndConnectedElectronContainers(IAtom atom)
IStereoElement
that the atom is contained in. If you are removing hydrogens one of the
utility methods (e.g. AtomContainerManipulator.removeHydrogens(IAtomContainer))
is preferable.atom
- the atom to be removedvoid removeAllElements()
void removeAllElectronContainers()
void removeAllBonds()
void addBond(int atom1, int atom2, IBond.Order order, IBond.Stereo stereo)
atom1
- Id of the first atom of the Bond in [0,..]atom2
- Id of the second atom of the Bond in [0,..]order
- Bondorderstereo
- Stereochemical orientationvoid addBond(int atom1, int atom2, IBond.Order order)
atom1
- Id of the first atom of the Bond in [0,..]atom2
- Id of the second atom of the Bond in [0,..]order
- Bondordervoid addLonePair(int atomID)
atomID
- The atom number to which the LonePair is added in [0,..]void addSingleElectron(int atomID)
atomID
- The atom number to which the SingleElectron is added in [0,..]boolean contains(IAtom atom)
atom
- the atom this AtomContainer is searched forboolean contains(IBond bond)
bond
- the bond this AtomContainer is searched forboolean contains(ILonePair lonePair)
lonePair
- the LonePair this AtomContainer is searched forboolean contains(ISingleElectron singleElectron)
singleElectron
- the SingleElectron this AtomContainer is searched forboolean contains(IElectronContainer electronContainer)
electronContainer
- ElectronContainer that is searched forboolean isEmpty()
IAtomContainer clone() throws CloneNotSupportedException
clone
in interface IChemObject
CloneNotSupportedException
- if the IChemObject cannot be clonedCopyright © 2017. All Rights Reserved.