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 idx)
Get the atom at the specified idx, the index should be in the
range 0 ≤ idx <
getAtomCount() . |
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 connects the two given atoms.
|
IBond |
getBond(int idx)
Get the bond at the specified idx, the index should be in the
range 0 ≤ idx <
getBondCount() . |
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)
Deprecated.
|
List<IAtom> |
getConnectedAtomsList(IAtom atom)
Returns the atoms connected connected to the specified atom by
a bond.
|
int |
getConnectedBondsCount(IAtom atom)
Returns the number of connected bonds (explicit degree) to the
specified atom.
|
int |
getConnectedBondsCount(int idx)
Returns the number of connected bonds (explicit degree) to atom
at the specified index.
|
List<IBond> |
getConnectedBondsList(IAtom atom)
Returns the bonds connected connected to the specified atom.
|
List<IElectronContainer> |
getConnectedElectronContainersList(IAtom atom)
Returns the electron containers (bonds, radicals, and lone pairs )
connected connected to the specified atom.
|
int |
getConnectedLonePairsCount(IAtom atom)
Returns the number of lone pairs connected to the specified atom.
|
List<ILonePair> |
getConnectedLonePairsList(IAtom atom)
Returns the lone pairs connected connected to the specified atom.
|
int |
getConnectedSingleElectronsCount(IAtom atom)
Returns the number of single electrons connected to the specified atom.
|
List<ISingleElectron> |
getConnectedSingleElectronsList(IAtom atom)
Returns the single electrons connected connected to the specified 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 idx)
Get the lone pair at the specified idx, the index should be in the
range 0 ≤ idx <
getLonePairCount() . |
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 idx)
Get the single electron at the specified idx, the index should
be in the range 0 ≤ idx <
getSingleElectronCount() . |
int |
getSingleElectronCount()
Returns the number of the single electrons in this container.
|
int |
getSingleElectronNumber(ISingleElectron singleElectron)
Deprecated.
|
String |
getTitle()
Access the title of the record.
|
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)
Safely remove an atom from the container.
|
void |
removeAtom(int pos)
Safely remove an atom from the container.
|
void |
removeAtomAndConnectedElectronContainers(IAtom atom)
Deprecated.
Method has be renamed
removeAtom(IAtom) . |
void |
removeAtomOnly(IAtom atom)
Unsafely remove atom.
|
void |
removeAtomOnly(int position)
Unsafely remove atom at index.
|
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 idx,
IAtom atom)
Set the atom at
idx , the index must have an existing atom
and therefore be in the range 0 ≤ idx < mol.getAtomCount(). |
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.
|
void |
setTitle(String title)
Modify the title of the record.
|
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 idx, IAtom atom)
idx
, the index must have an existing atom
and therefore be in the range 0 ≤ idx < mol.getAtomCount().idx
- The index of the atom to be set.atom
- The atom to be stored at position idx
IndexOutOfBoundsException
- index is out of boundsIllegalArgumentException
- the atom could not be setgetAtom(int)
IAtom getAtom(int idx)
getAtomCount()
.idx
- atom indexIndexOutOfBoundsException
- the index is out of rangesetAtom(int, org.openscience.cdk.interfaces.IAtom)
IBond getBond(int idx)
getBondCount()
.idx
- bond indexIndexOutOfBoundsException
- the index is out of rangeILonePair getLonePair(int idx)
getLonePairCount()
.idx
- lone pair indexIndexOutOfBoundsException
- the index is out of rangeISingleElectron getSingleElectron(int idx)
getSingleElectronCount()
.idx
- single electron indexIndexOutOfBoundsException
- the index is out of rangeIterable<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 atomNoSuchElementException
- the atom is not presentList<IBond> getConnectedBondsList(IAtom atom)
atom
- the atomNoSuchElementException
- the atom is not presentList<ILonePair> getConnectedLonePairsList(IAtom atom)
atom
- the atomNoSuchElementException
- the atom is not presentList<ISingleElectron> getConnectedSingleElectronsList(IAtom atom)
atom
- the atomNoSuchElementException
- the atom is not presentList<IElectronContainer> getConnectedElectronContainersList(IAtom atom)
atom
- the atomNoSuchElementException
- the atom is not present@Deprecated int getConnectedAtomsCount(IAtom atom)
getConnectedBondsCount(IAtom)
atom
- the atomNoSuchElementException
- the atom is not presentint getConnectedBondsCount(IAtom atom)
atom
- the atomNoSuchElementException
- the atom is not presentint getConnectedBondsCount(int idx)
idx
- the atom idxIndexOutOfBoundsException
- the index is not in rangeint getConnectedLonePairsCount(IAtom atom)
atom
- the atomNoSuchElementException
- the atom is not presentint getConnectedSingleElectronsCount(IAtom atom)
atom
- the atomNoSuchElementException
- the atom is not presentdouble getBondOrderSum(IAtom atom)
atom
- The atomIBond.Order getMaximumBondOrder(IAtom atom)
IBond.Order.SINGLE
, otherwise the bond is unset
IBond.Order.UNSET
.atom
- The atomNoSuchElementException
- atom does not belong to this containerIBond.Order getMinimumBondOrder(IAtom atom)
IBond.Order.SINGLE
, otherwise the bond is unset
IBond.Order.UNSET
.atom
- The atomNoSuchElementException
- atom does not belong to this containervoid 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 containerNoSuchAtomException
- optionally thrown if the atoms of the bond
have not yet been addedvoid 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 removeAtomOnly(int position)
position
- The position of the atom to be removed.void removeAtomOnly(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 removeAtom(IAtom atom)
remove(IAtomContainer)
.
atom
- the atom to be removedvoid removeAtom(int pos)
remove(IAtomContainer)
.
pos
- the position of the atom to be removed@Deprecated void removeAtomAndConnectedElectronContainers(IAtom atom)
removeAtom(IAtom)
.removeAtom(IAtom)
void 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()
String getTitle()
void setTitle(String title)
title
- the titleIAtomContainer clone() throws CloneNotSupportedException
clone
in interface IChemObject
CloneNotSupportedException
- if the IChemObject cannot be clonedCopyright © 2021. All rights reserved.