Package org.openscience.cdk.debug
Class DebugAtomContainer
- java.lang.Object
-
- org.openscience.cdk.ChemObject
-
- org.openscience.cdk.AtomContainer
-
- org.openscience.cdk.debug.DebugAtomContainer
-
- All Implemented Interfaces:
Serializable
,Cloneable
,IAtomContainer
,ICDKObject
,IChemObject
,IChemObjectListener
public class DebugAtomContainer extends AtomContainer implements IAtomContainer
Debugging data class.- Author:
- egonw
- See Also:
- Serialized Form
- Source code:
- main
- Belongs to CDK module:
- datadebug
-
-
Field Summary
-
Fields inherited from class org.openscience.cdk.AtomContainer
atomCount, atoms, bondCount, bonds, growArraySize, lonePairCount, lonePairs, singleElectronCount, singleElectrons, stereoElements
-
-
Constructor Summary
Constructors Constructor Description DebugAtomContainer()
DebugAtomContainer(int atomCount, int bondCount, int lonePairCount, int singleElectronCount)
DebugAtomContainer(IAtomContainer container)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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(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
addBond(IBond bond)
Adds a Bond to this AtomContainer.void
addElectronContainer(IElectronContainer electronContainer)
Adds a ElectronContainer to this AtomContainer.void
addListener(IChemObjectListener col)
Use this to add yourself to this IChemObject as a listener.void
addLonePair(int atomID)
Adds a LonePair to this Atom.void
addLonePair(ILonePair ec)
Adds a lone pair to this AtomContainer.void
addProperties(Map<Object,Object> properties)
Sets the properties of this object.void
addSingleElectron(int atomID)
Adds a SingleElectron to this Atom.void
addSingleElectron(ISingleElectron ec)
Adds a single electron to this AtomContainer.void
addStereoElement(IStereoElement parity)
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()
Clones thisIChemObject
.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 ec)
True, if the AtomContainer contains the given LonePair object.boolean
contains(ISingleElectron ec)
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 <IAtomContainer.getAtomCount()
.int
getAtomCount()
Returns the number of Atoms in this Container.IBond
getBond(int idx)
Get the bond at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getBondCount()
.IBond
getBond(IAtom atom1, IAtom atom2)
Returns the bond that connects the two given atoms.int
getBondCount()
Returns the number of Bonds in this Container.double
getBondOrderSum(IAtom atom)
Returns the sum of the bond orders for a given Atom.IChemObjectBuilder
getBuilder()
Returns aIChemObjectBuilder
for the data classes that extend this class.int
getConnectedAtomsCount(IAtom atom)
Returns the number of connected atoms (explicit degree) to the specified atom.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.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 positionnumber
in the container.int
getElectronContainerCount()
Returns the number of ElectronContainers in this Container.IAtom
getFirstAtom()
Returns the atom at position 0 in the container.boolean
getFlag(int flagType)
Returns the value of a given flag.boolean[]
getFlags()
Returns the whole set of flags.String
getID()
Returns the identifier (ID) of this object.IAtom
getLastAtom()
Returns the atom at the last position in the container.int
getListenerCount()
Returns the number of ChemObjectListeners registered with this object.ILonePair
getLonePair(int idx)
Get the lone pair at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getLonePairCount()
.int
getLonePairCount()
Returns the number of LonePairs in this Container.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.Map<Object,Object>
getProperties()
Returns a Map with the IChemObject's properties.<T> T
getProperty(Object description)
Returns a property for the IChemObject.ISingleElectron
getSingleElectron(int idx)
Get the single electron at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getSingleElectronCount()
.int
getSingleElectronCount()
Returns the number of the single electrons in this container.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
notifyChanged()
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.void
notifyChanged(IChemObjectChangeEvent evt)
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.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
removeAtomOnly(int position)
Unsafely remove atom at index.void
removeAtomOnly(IAtom atom)
Unsafely remove atom.IBond
removeBond(int pos)
Removes the bond at the given position 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.IElectronContainer
removeElectronContainer(int position)
Removes the bond at the given position from this container.void
removeElectronContainer(IElectronContainer electronContainer)
Removes this ElectronContainer from this container.void
removeListener(IChemObjectListener col)
Use this to remove a ChemObjectListener from the ListenerList of this IChemObject.ILonePair
removeLonePair(int pos)
Removes the lone pair at the given position from the AtomContainer.void
removeLonePair(ILonePair ec)
Removes the lone pair from the AtomContainer.void
removeProperty(Object description)
Removes a property for a IChemObject.ISingleElectron
removeSingleElectron(int pos)
Removes the single electron at the given position from the AtomContainer.void
removeSingleElectron(ISingleElectron ec)
Removes the single electron from the AtomContainer.void
setAtom(int number, IAtom atom)
Set the atom atidx
, 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
setFlag(int flagType, boolean flagValue)
Sets the value of some flag.void
setFlags(boolean[] flagsNew)
Sets the whole set of flags.void
setID(String identifier)
Sets the identifier (ID) of this object.void
setProperty(Object description, Object property)
Sets a property for a IChemObject.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.-
Methods inherited from class org.openscience.cdk.AtomContainer
getAtomNumber, getBondNumber, getBondNumber, getConnectedBondsCount, getLonePairNumber, getSingleElectronNumber, getTitle, removeAtom, removeAtomAndConnectedElectronContainers, setBonds, setTitle, stateChanged, toString
-
Methods inherited from class org.openscience.cdk.ChemObject
compare, getFlagValue, getNotification, getProperty, setNotification, setProperties, 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.IAtomContainer
getAtomNumber, getBondNumber, getBondNumber, getConnectedBondsCount, getLonePairNumber, getSingleElectronNumber, getTitle, removeAtom, removeAtomAndConnectedElectronContainers, setBonds, setTitle
-
Methods inherited from interface org.openscience.cdk.interfaces.IChemObject
getFlagValue, getNotification, getProperty, setNotification, setProperties, toString
-
Methods inherited from interface org.openscience.cdk.interfaces.IChemObjectListener
stateChanged
-
-
-
-
Constructor Detail
-
DebugAtomContainer
public DebugAtomContainer()
-
DebugAtomContainer
public DebugAtomContainer(int atomCount, int bondCount, int lonePairCount, int singleElectronCount)
-
DebugAtomContainer
public DebugAtomContainer(IAtomContainer container)
-
-
Method Detail
-
addStereoElement
public void addStereoElement(IStereoElement parity)
Adds a stereo element to this container.- Specified by:
addStereoElement
in interfaceIAtomContainer
- Overrides:
addStereoElement
in classAtomContainer
- Parameters:
parity
- The newIStereoElement
for this container- See Also:
IAtomContainer.stereoElements()
-
setStereoElements
public void setStereoElements(List<IStereoElement> elements)
Set the stereo elements - this will replace the existing instance with a new instance.- Specified by:
setStereoElements
in interfaceIAtomContainer
- Overrides:
setStereoElements
in classAtomContainer
- Parameters:
elements
- the new stereo elements
-
stereoElements
public Iterable<IStereoElement> stereoElements()
Returns the stereo elements defined for this atom container.- Specified by:
stereoElements
in interfaceIAtomContainer
- Overrides:
stereoElements
in classAtomContainer
- Returns:
- An
Iterable
ofIStereoElement
s. - See Also:
IAtomContainer.addStereoElement(IStereoElement)
-
setAtoms
public void setAtoms(IAtom[] atoms)
Sets the array of atoms of this AtomContainer.- Specified by:
setAtoms
in interfaceIAtomContainer
- Overrides:
setAtoms
in classAtomContainer
- Parameters:
atoms
- The array of atoms to be assigned to this AtomContainer- See Also:
IAtomContainer.atoms()
-
setAtom
public void setAtom(int number, IAtom atom)
Set the atom atidx
, the index must have an existing atom and therefore be in the range 0 ≤ idx < mol.getAtomCount().- Specified by:
setAtom
in interfaceIAtomContainer
- Overrides:
setAtom
in classAtomContainer
- Parameters:
number
- The index of the atom to be set.atom
- The atom to be stored at positionidx
- See Also:
IAtomContainer.getAtom(int)
-
getAtom
public IAtom getAtom(int idx)
Get the atom at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getAtomCount()
.- Specified by:
getAtom
in interfaceIAtomContainer
- Overrides:
getAtom
in classAtomContainer
- Parameters:
idx
- atom index- Returns:
- the atom stored at the index
- See Also:
IAtomContainer.setAtom(int, org.openscience.cdk.interfaces.IAtom)
-
getBond
public IBond getBond(int idx)
Get the bond at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getBondCount()
.- Specified by:
getBond
in interfaceIAtomContainer
- Overrides:
getBond
in classAtomContainer
- Parameters:
idx
- bond index- Returns:
- the bond stored at the index
-
getLonePair
public ILonePair getLonePair(int idx)
Get the lone pair at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getLonePairCount()
.- Specified by:
getLonePair
in interfaceIAtomContainer
- Overrides:
getLonePair
in classAtomContainer
- Parameters:
idx
- lone pair index- Returns:
- the lone pair stored at the index
-
getSingleElectron
public ISingleElectron getSingleElectron(int idx)
Get the single electron at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getSingleElectronCount()
.- Specified by:
getSingleElectron
in interfaceIAtomContainer
- Overrides:
getSingleElectron
in classAtomContainer
- Parameters:
idx
- single electron index- Returns:
- the single electron stored at the index
-
atoms
public Iterable<IAtom> atoms()
Returns an Iterable for looping over all atoms in this container.- Specified by:
atoms
in interfaceIAtomContainer
- Overrides:
atoms
in classAtomContainer
- Returns:
- An Iterable with the atoms in this container
-
bonds
public Iterable<IBond> bonds()
Returns an Iterable for looping over all bonds in this container.- Specified by:
bonds
in interfaceIAtomContainer
- Overrides:
bonds
in classAtomContainer
- Returns:
- An Iterable with the bonds in this container
-
lonePairs
public Iterable<ILonePair> lonePairs()
Returns an Iterable for looping over all lone pairs in this container.- Specified by:
lonePairs
in interfaceIAtomContainer
- Overrides:
lonePairs
in classAtomContainer
- Returns:
- An Iterable with the lone pairs in this container
-
singleElectrons
public Iterable<ISingleElectron> singleElectrons()
Returns an Iterable for looping over all single electrons in this container.- Specified by:
singleElectrons
in interfaceIAtomContainer
- Overrides:
singleElectrons
in classAtomContainer
- Returns:
- An Iterable with the single electrons in this container
-
electronContainers
public Iterable<IElectronContainer> electronContainers()
Returns an Iterable for looping over all electron containers in this container.- Specified by:
electronContainers
in interfaceIAtomContainer
- Overrides:
electronContainers
in classAtomContainer
- Returns:
- An Iterable with the electron containers in this container
-
getFirstAtom
public IAtom getFirstAtom()
Returns the atom at position 0 in the container.- Specified by:
getFirstAtom
in interfaceIAtomContainer
- Overrides:
getFirstAtom
in classAtomContainer
- Returns:
- The atom at position 0 .
-
getLastAtom
public IAtom getLastAtom()
Returns the atom at the last position in the container.- Specified by:
getLastAtom
in interfaceIAtomContainer
- Overrides:
getLastAtom
in classAtomContainer
- Returns:
- The atom at the last position
-
indexOf
public int indexOf(IAtom atom)
Access the storage index of an atom.- Specified by:
indexOf
in interfaceIAtomContainer
- Overrides:
indexOf
in classAtomContainer
- Parameters:
atom
- atom instance to find- Returns:
- the index, -1 if not found
-
indexOf
public int indexOf(IBond bond)
Access the storage index of a bond.- Specified by:
indexOf
in interfaceIAtomContainer
- Overrides:
indexOf
in classAtomContainer
- Parameters:
bond
- bond instance to find- Returns:
- the index, -1 if not found
-
indexOf
public int indexOf(ISingleElectron electron)
Access the storage index of a single electron (radical).- Specified by:
indexOf
in interfaceIAtomContainer
- Overrides:
indexOf
in classAtomContainer
- Parameters:
electron
- the electron- Returns:
- the index, -1 if not found
-
indexOf
public int indexOf(ILonePair pair)
Access the storage index of a long pair.- Specified by:
indexOf
in interfaceIAtomContainer
- Overrides:
indexOf
in classAtomContainer
- Parameters:
pair
- the long pair- Returns:
- the index, -1 if not found
-
getElectronContainer
public IElectronContainer getElectronContainer(int number)
Returns the ElectronContainer at positionnumber
in the container.- Specified by:
getElectronContainer
in interfaceIAtomContainer
- Overrides:
getElectronContainer
in classAtomContainer
- Parameters:
number
- The position of the ElectronContainer to be returned.- Returns:
- The ElectronContainer at position
number
. - See Also:
IAtomContainer.addElectronContainer(IElectronContainer)
-
getBond
public IBond getBond(IAtom atom1, IAtom atom2)
Returns the bond that connects the two given atoms.- Specified by:
getBond
in interfaceIAtomContainer
- Overrides:
getBond
in classAtomContainer
- Parameters:
atom1
- The first atomatom2
- The second atom- Returns:
- The bond that connects the two atoms
-
getAtomCount
public int getAtomCount()
Returns the number of Atoms in this Container.- Specified by:
getAtomCount
in interfaceIAtomContainer
- Overrides:
getAtomCount
in classAtomContainer
- Returns:
- The number of Atoms in this Container
-
getBondCount
public int getBondCount()
Returns the number of Bonds in this Container.- Specified by:
getBondCount
in interfaceIAtomContainer
- Overrides:
getBondCount
in classAtomContainer
- Returns:
- The number of Bonds in this Container
-
getLonePairCount
public int getLonePairCount()
Returns the number of LonePairs in this Container.- Specified by:
getLonePairCount
in interfaceIAtomContainer
- Overrides:
getLonePairCount
in classAtomContainer
- Returns:
- The number of LonePairs in this Container
-
getSingleElectronCount
public int getSingleElectronCount()
Returns the number of the single electrons in this container.- Specified by:
getSingleElectronCount
in interfaceIAtomContainer
- Overrides:
getSingleElectronCount
in classAtomContainer
- Returns:
- The number of SingleElectron objects of this AtomContainer
-
getElectronContainerCount
public int getElectronContainerCount()
Returns the number of ElectronContainers in this Container.- Specified by:
getElectronContainerCount
in interfaceIAtomContainer
- Overrides:
getElectronContainerCount
in classAtomContainer
- Returns:
- The number of ElectronContainers in this Container
-
getConnectedAtomsList
public List<IAtom> getConnectedAtomsList(IAtom atom)
Returns the atoms connected connected to the specified atom by a bond.- Specified by:
getConnectedAtomsList
in interfaceIAtomContainer
- Overrides:
getConnectedAtomsList
in classAtomContainer
- Parameters:
atom
- the atom- Returns:
- connected atoms
-
getConnectedBondsList
public List<IBond> getConnectedBondsList(IAtom atom)
Returns the bonds connected connected to the specified atom.- Specified by:
getConnectedBondsList
in interfaceIAtomContainer
- Overrides:
getConnectedBondsList
in classAtomContainer
- Parameters:
atom
- the atom- Returns:
- connected bonds
-
getConnectedLonePairsList
public List<ILonePair> getConnectedLonePairsList(IAtom atom)
Returns the lone pairs connected connected to the specified atom.- Specified by:
getConnectedLonePairsList
in interfaceIAtomContainer
- Overrides:
getConnectedLonePairsList
in classAtomContainer
- Parameters:
atom
- the atom- Returns:
- connected lone pairs
-
getConnectedSingleElectronsList
public List<ISingleElectron> getConnectedSingleElectronsList(IAtom atom)
Returns the single electrons connected connected to the specified atom.- Specified by:
getConnectedSingleElectronsList
in interfaceIAtomContainer
- Overrides:
getConnectedSingleElectronsList
in classAtomContainer
- Parameters:
atom
- the atom- Returns:
- connected lone pairs
-
getConnectedElectronContainersList
public List<IElectronContainer> getConnectedElectronContainersList(IAtom atom)
Returns the electron containers (bonds, radicals, and lone pairs ) connected connected to the specified atom.- Specified by:
getConnectedElectronContainersList
in interfaceIAtomContainer
- Overrides:
getConnectedElectronContainersList
in classAtomContainer
- Parameters:
atom
- the atom- Returns:
- connected lone pairs
-
getConnectedAtomsCount
public int getConnectedAtomsCount(IAtom atom)
Returns the number of connected atoms (explicit degree) to the specified atom. This does not include bonds to implicit hydrogens.- Specified by:
getConnectedAtomsCount
in interfaceIAtomContainer
- Overrides:
getConnectedAtomsCount
in classAtomContainer
- Parameters:
atom
- the atom- Returns:
- number of connected bonds
-
getConnectedBondsCount
public int getConnectedBondsCount(IAtom atom)
Returns the number of connected bonds (explicit degree) to the specified atom. This does not include bonds to implicit hydrogens.- Specified by:
getConnectedBondsCount
in interfaceIAtomContainer
- Overrides:
getConnectedBondsCount
in classAtomContainer
- Parameters:
atom
- the atom- Returns:
- number of connected bonds
-
getConnectedLonePairsCount
public int getConnectedLonePairsCount(IAtom atom)
Returns the number of lone pairs connected to the specified atom.- Specified by:
getConnectedLonePairsCount
in interfaceIAtomContainer
- Overrides:
getConnectedLonePairsCount
in classAtomContainer
- Parameters:
atom
- the atom- Returns:
- number of connected bonds
-
getConnectedSingleElectronsCount
public int getConnectedSingleElectronsCount(IAtom atom)
Returns the number of single electrons connected to the specified atom.- Specified by:
getConnectedSingleElectronsCount
in interfaceIAtomContainer
- Overrides:
getConnectedSingleElectronsCount
in classAtomContainer
- Parameters:
atom
- the atom- Returns:
- number of connected bonds
-
getBondOrderSum
public double getBondOrderSum(IAtom atom)
Returns the sum of the bond orders for a given Atom.- Specified by:
getBondOrderSum
in interfaceIAtomContainer
- Overrides:
getBondOrderSum
in classAtomContainer
- Parameters:
atom
- The atom- Returns:
- The number of bondorders for this atom
-
getMaximumBondOrder
public IBond.Order getMaximumBondOrder(IAtom atom)
Returns the maximum bond order that this atom currently has in the context of this AtomContainer. If the atom has no bonds but does have implicit hydrogens the minimum bond order isIBond.Order.SINGLE
, otherwise the bond is unsetIBond.Order.UNSET
.- Specified by:
getMaximumBondOrder
in interfaceIAtomContainer
- Overrides:
getMaximumBondOrder
in classAtomContainer
- Parameters:
atom
- The atom- Returns:
- The maximum bond order that this atom currently has
-
getMinimumBondOrder
public IBond.Order getMinimumBondOrder(IAtom atom)
Returns the minimum bond order that this atom currently has in the context of this AtomContainer. If the atom has no bonds but does have implicit hydrogens the minimum bond order isIBond.Order.SINGLE
, otherwise the bond is unsetIBond.Order.UNSET
.- Specified by:
getMinimumBondOrder
in interfaceIAtomContainer
- Overrides:
getMinimumBondOrder
in classAtomContainer
- Parameters:
atom
- The atom- Returns:
- The minimum bond order that this atom currently has
-
add
public void add(IAtomContainer atomContainer)
Adds all atoms and electronContainers of a given atomcontainer to this container.- Specified by:
add
in interfaceIAtomContainer
- Overrides:
add
in classAtomContainer
- Parameters:
atomContainer
- The atomcontainer to be added
-
addAtom
public void addAtom(IAtom atom)
Adds an atom to this container.- Specified by:
addAtom
in interfaceIAtomContainer
- Overrides:
addAtom
in classAtomContainer
- Parameters:
atom
- The atom to be added to this container
-
addBond
public void addBond(IBond bond)
Adds a Bond to this AtomContainer.- Specified by:
addBond
in interfaceIAtomContainer
- Overrides:
addBond
in classAtomContainer
- Parameters:
bond
- The bond to added to this container
-
addLonePair
public void addLonePair(ILonePair ec)
Adds a lone pair to this AtomContainer.- Specified by:
addLonePair
in interfaceIAtomContainer
- Overrides:
addLonePair
in classAtomContainer
- Parameters:
ec
- The LonePair to added to this container
-
addSingleElectron
public void addSingleElectron(ISingleElectron ec)
Adds a single electron to this AtomContainer.- Specified by:
addSingleElectron
in interfaceIAtomContainer
- Overrides:
addSingleElectron
in classAtomContainer
- Parameters:
ec
- The SingleElectron to added to this container
-
addElectronContainer
public void addElectronContainer(IElectronContainer electronContainer)
Adds a ElectronContainer to this AtomContainer.- Specified by:
addElectronContainer
in interfaceIAtomContainer
- Overrides:
addElectronContainer
in classAtomContainer
- Parameters:
electronContainer
- The ElectronContainer to added to this container
-
remove
public void remove(IAtomContainer atomContainer)
Removes all atoms and electronContainers of a given atomcontainer from this container.- Specified by:
remove
in interfaceIAtomContainer
- Overrides:
remove
in classAtomContainer
- Parameters:
atomContainer
- The atomcontainer to be removed
-
removeElectronContainer
public IElectronContainer removeElectronContainer(int position)
Removes the bond at the given position from this container.- Specified by:
removeElectronContainer
in interfaceIAtomContainer
- Overrides:
removeElectronContainer
in classAtomContainer
- Parameters:
position
- The position of the bond in the electronContainers array- Returns:
- the IElectronContainer that was removed
-
removeElectronContainer
public void removeElectronContainer(IElectronContainer electronContainer)
Removes this ElectronContainer from this container.- Specified by:
removeElectronContainer
in interfaceIAtomContainer
- Overrides:
removeElectronContainer
in classAtomContainer
- Parameters:
electronContainer
- The electronContainer to be removed
-
removeAtomOnly
public void removeAtomOnly(int position)
Unsafely remove atom at index.
Removes the atom at the given position from the AtomContainer. Note that the electronContainers are unaffected: you also have to take care of removing all electronContainers to this atom from the container manually.- Specified by:
removeAtomOnly
in interfaceIAtomContainer
- Overrides:
removeAtomOnly
in classAtomContainer
- Parameters:
position
- The position of the atom to be removed.
-
removeAtomOnly
public void removeAtomOnly(IAtom atom)
Unsafely remove atom.
Removes the given atom from the AtomContainer. Note that the electronContainers are unaffected: you also have to take care of removeing all electronContainers to this atom from the container.- Specified by:
removeAtomOnly
in interfaceIAtomContainer
- Overrides:
removeAtomOnly
in classAtomContainer
- Parameters:
atom
- The atom to be removed
-
removeBond
public IBond removeBond(int pos)
Removes the bond at the given position from the AtomContainer.- Specified by:
removeBond
in interfaceIAtomContainer
- Overrides:
removeBond
in classAtomContainer
- Parameters:
pos
- The position of the bond to be removed.- Returns:
- the bond at the given position
-
removeBond
public IBond removeBond(IAtom atom1, IAtom atom2)
Removes the bond that connects the two given atoms.- Specified by:
removeBond
in interfaceIAtomContainer
- Overrides:
removeBond
in classAtomContainer
- Parameters:
atom1
- The first atomatom2
- The second atom- Returns:
- The bond that connects the two atoms
-
removeBond
public void removeBond(IBond bond)
Removes the bond from this container.- Specified by:
removeBond
in interfaceIAtomContainer
- Overrides:
removeBond
in classAtomContainer
- Parameters:
bond
- The bond to be removed.
-
removeLonePair
public ILonePair removeLonePair(int pos)
Removes the lone pair at the given position from the AtomContainer.- Specified by:
removeLonePair
in interfaceIAtomContainer
- Overrides:
removeLonePair
in classAtomContainer
- Parameters:
pos
- The position of the LonePair to be removed.- Returns:
- The removed ILonePair.
-
removeLonePair
public void removeLonePair(ILonePair ec)
Removes the lone pair from the AtomContainer.- Specified by:
removeLonePair
in interfaceIAtomContainer
- Overrides:
removeLonePair
in classAtomContainer
- Parameters:
ec
- The LonePair to be removed.
-
removeSingleElectron
public ISingleElectron removeSingleElectron(int pos)
Removes the single electron at the given position from the AtomContainer.- Specified by:
removeSingleElectron
in interfaceIAtomContainer
- Overrides:
removeSingleElectron
in classAtomContainer
- Parameters:
pos
- The position of the SingleElectron to be removed.- Returns:
- The removed ISingleElectron
-
removeSingleElectron
public void removeSingleElectron(ISingleElectron ec)
Removes the single electron from the AtomContainer.- Specified by:
removeSingleElectron
in interfaceIAtomContainer
- Overrides:
removeSingleElectron
in classAtomContainer
- Parameters:
ec
- The SingleElectron to be removed.
-
removeAtom
public void removeAtom(IAtom atom)
Safely remove an atom from the container.
Removes a single atom from the container updating all internal state to be consistent. All bonds connected to the atom will be deleted as well as all stereo elements. If multiple atoms/bonds are being deleted they should be gathered into a single transaction and removed withIAtomContainer.remove(IAtomContainer)
.
If you are removing hydrogens one of the utility methods (e.g. AtomContainerManipulator.removeHydrogens(IAtomContainer)) is preferable.- Specified by:
removeAtom
in interfaceIAtomContainer
- Overrides:
removeAtom
in classAtomContainer
- Parameters:
atom
- the atom to be removed
-
removeAllElements
public void removeAllElements()
Removes all atoms, bonds and stereo elements from this container.- Specified by:
removeAllElements
in interfaceIAtomContainer
- Overrides:
removeAllElements
in classAtomContainer
-
removeAllElectronContainers
public void removeAllElectronContainers()
Removes electronContainers from this container.- Specified by:
removeAllElectronContainers
in interfaceIAtomContainer
- Overrides:
removeAllElectronContainers
in classAtomContainer
-
removeAllBonds
public void removeAllBonds()
Removes all Bonds from this container.- Specified by:
removeAllBonds
in interfaceIAtomContainer
- Overrides:
removeAllBonds
in classAtomContainer
-
addBond
public void addBond(int atom1, int atom2, IBond.Order order, IBond.Stereo stereo)
Adds a bond to this container.- Specified by:
addBond
in interfaceIAtomContainer
- Overrides:
addBond
in classAtomContainer
- Parameters:
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 orientation
-
addBond
public void addBond(int atom1, int atom2, IBond.Order order)
Adds a bond to this container.- Specified by:
addBond
in interfaceIAtomContainer
- Overrides:
addBond
in classAtomContainer
- Parameters:
atom1
- Id of the first atom of the Bond in [0,..]atom2
- Id of the second atom of the Bond in [0,..]order
- Bondorder
-
addLonePair
public void addLonePair(int atomID)
Adds a LonePair to this Atom.- Specified by:
addLonePair
in interfaceIAtomContainer
- Overrides:
addLonePair
in classAtomContainer
- Parameters:
atomID
- The atom number to which the LonePair is added in [0,..]
-
addSingleElectron
public void addSingleElectron(int atomID)
Adds a SingleElectron to this Atom.- Specified by:
addSingleElectron
in interfaceIAtomContainer
- Overrides:
addSingleElectron
in classAtomContainer
- Parameters:
atomID
- The atom number to which the SingleElectron is added in [0,..]
-
contains
public boolean contains(IAtom atom)
True, if the AtomContainer contains the given atom object.- Specified by:
contains
in interfaceIAtomContainer
- Overrides:
contains
in classAtomContainer
- Parameters:
atom
- the atom this AtomContainer is searched for- Returns:
- True, if the AtomContainer contains the given atom object
-
contains
public boolean contains(IBond bond)
True, if the AtomContainer contains the given bond object.- Specified by:
contains
in interfaceIAtomContainer
- Overrides:
contains
in classAtomContainer
- Parameters:
bond
- the bond this AtomContainer is searched for- Returns:
- True, if the AtomContainer contains the given bond object
-
contains
public boolean contains(ILonePair ec)
True, if the AtomContainer contains the given LonePair object.- Specified by:
contains
in interfaceIAtomContainer
- Overrides:
contains
in classAtomContainer
- Parameters:
ec
- the LonePair this AtomContainer is searched for- Returns:
- True, if the AtomContainer contains the given LonePair object
-
contains
public boolean contains(ISingleElectron ec)
True, if the AtomContainer contains the given SingleElectron object.- Specified by:
contains
in interfaceIAtomContainer
- Overrides:
contains
in classAtomContainer
- Parameters:
ec
- the SingleElectron this AtomContainer is searched for- Returns:
- True, if the AtomContainer contains the given SingleElectron object
-
contains
public boolean contains(IElectronContainer electronContainer)
True, if the AtomContainer contains the given ElectronContainer object.- Specified by:
contains
in interfaceIAtomContainer
- Overrides:
contains
in classAtomContainer
- Parameters:
electronContainer
- ElectronContainer that is searched for- Returns:
- True, if the AtomContainer contains the given bond object
-
addListener
public void addListener(IChemObjectListener col)
Use this to add yourself to this IChemObject as a listener. In order to do so, you must implement the ChemObjectListener Interface.- Specified by:
addListener
in interfaceIChemObject
- Overrides:
addListener
in classChemObject
- Parameters:
col
- the ChemObjectListener- See Also:
ChemObject.removeListener(org.openscience.cdk.interfaces.IChemObjectListener)
-
getListenerCount
public int getListenerCount()
Returns the number of ChemObjectListeners registered with this object.- Specified by:
getListenerCount
in interfaceIChemObject
- Overrides:
getListenerCount
in classChemObject
- Returns:
- the number of registered listeners.
-
removeListener
public void removeListener(IChemObjectListener col)
Use this to remove a ChemObjectListener from the ListenerList of this IChemObject. It will then not be notified of change in this object anymore.- Specified by:
removeListener
in interfaceIChemObject
- Overrides:
removeListener
in classChemObject
- Parameters:
col
- The ChemObjectListener to be removed- See Also:
ChemObject.addListener(org.openscience.cdk.interfaces.IChemObjectListener)
-
notifyChanged
public void notifyChanged()
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it.- Specified by:
notifyChanged
in interfaceIChemObject
- Overrides:
notifyChanged
in classChemObject
-
notifyChanged
public void notifyChanged(IChemObjectChangeEvent evt)
This should be triggered by an method that changes the content of an object to that the registered listeners can react to it. This is a version of notifyChanged() which allows to propagate a change event while preserving the original origin.- Specified by:
notifyChanged
in interfaceIChemObject
- Overrides:
notifyChanged
in classChemObject
- Parameters:
evt
- A ChemObjectChangeEvent pointing to the source of where the change happened
-
setProperty
public void setProperty(Object description, Object property)
Sets a property for a IChemObject.- Specified by:
setProperty
in interfaceIChemObject
- Overrides:
setProperty
in classChemObject
- Parameters:
description
- An object description of the property (most likely a unique string)property
- An object with the property itself- See Also:
ChemObject.getProperty(java.lang.Object)
,ChemObject.removeProperty(java.lang.Object)
-
removeProperty
public void removeProperty(Object description)
Removes a property for a IChemObject.- Specified by:
removeProperty
in interfaceIChemObject
- Overrides:
removeProperty
in classChemObject
- Parameters:
description
- The object description of the property (most likely a unique string)- See Also:
ChemObject.setProperty(java.lang.Object, java.lang.Object)
,ChemObject.getProperty(java.lang.Object)
-
getProperty
public <T> T getProperty(Object description)
Returns a property for the IChemObject.- Specified by:
getProperty
in interfaceIChemObject
- Overrides:
getProperty
in classChemObject
- Type Parameters:
T
- generic return type- Parameters:
description
- An object description of the property (most likely a unique string)- Returns:
- The object containing the property. Returns null if propert is not set.
- See Also:
ChemObject.setProperty(java.lang.Object, java.lang.Object)
,ChemObject.removeProperty(java.lang.Object)
-
getProperties
public Map<Object,Object> getProperties()
Returns a Map with the IChemObject's properties.- Specified by:
getProperties
in interfaceIChemObject
- Overrides:
getProperties
in classChemObject
- Returns:
- The object's properties as an Hashtable
- See Also:
ChemObject.addProperties(java.util.Map<java.lang.Object, java.lang.Object>)
-
getID
public String getID()
Returns the identifier (ID) of this object.- Specified by:
getID
in interfaceIChemObject
- Overrides:
getID
in classChemObject
- Returns:
- a String representing the ID value
- See Also:
ChemObject.setID(java.lang.String)
-
setID
public void setID(String identifier)
Sets the identifier (ID) of this object.- Specified by:
setID
in interfaceIChemObject
- Overrides:
setID
in classChemObject
- Parameters:
identifier
- a String representing the ID value- See Also:
ChemObject.getID()
-
setFlag
public void setFlag(int flagType, boolean flagValue)
Sets the value of some flag. The flag is a mask from a given CDKConstant (e.g.CDKConstants.ISAROMATIC
orCDKConstants.VISITED
). The flags are intrinsic internal properties and should not be used to store custom values, please useIChemObject.setProperty(Object, Object)
.// set this chem object to be aromatic chemObject.setFlag(CDKConstants.ISAROMATIC, Boolean.TRUE); // ... // indicate we have visited this chem object chemObject.setFlag(CDKConstants.VISITED, Boolean.TRUE);
- Specified by:
setFlag
in interfaceIChemObject
- Overrides:
setFlag
in classChemObject
- Parameters:
flagType
- flag to set the value forflagValue
- value to assign to flag- See Also:
IChemObject.getFlag(int)
,CDKConstants
-
getFlag
public boolean getFlag(int flagType)
Returns the value of a given flag. The flag is a mask from a given CDKConstant (e.g.CDKConstants.ISAROMATIC
).if(chemObject.getFlag(CDKConstants.ISAROMATIC)){ // handle aromatic flag on this chem object }
- Specified by:
getFlag
in interfaceIChemObject
- Overrides:
getFlag
in classChemObject
- Parameters:
flagType
- flag to retrieve the value of- Returns:
- true if the flag
flag_type
is set - See Also:
IChemObject.setFlag(int, boolean)
,CDKConstants
-
addProperties
public void addProperties(Map<Object,Object> properties)
Sets the properties of this object.- Specified by:
addProperties
in interfaceIChemObject
- Overrides:
addProperties
in classChemObject
- Parameters:
properties
- a Hashtable specifying the property values- See Also:
ChemObject.getProperties()
-
getFlags
public boolean[] getFlags()
Returns the whole set of flags.- Specified by:
getFlags
in interfaceIChemObject
- Overrides:
getFlags
in classChemObject
- Returns:
- the flags.
- See Also:
ChemObject.setFlags(boolean[])
-
setFlags
public void setFlags(boolean[] flagsNew)
Sets the whole set of flags.- Specified by:
setFlags
in interfaceIChemObject
- Overrides:
setFlags
in classChemObject
- Parameters:
flagsNew
- the new flags.- See Also:
ChemObject.getFlags()
-
clone
public IAtomContainer clone() throws CloneNotSupportedException
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 interfaceIAtomContainer
- Specified by:
clone
in interfaceIChemObject
- Overrides:
clone
in classAtomContainer
- Returns:
- The cloned object
- Throws:
CloneNotSupportedException
- if the IChemObject cannot be cloned
-
getBuilder
public IChemObjectBuilder getBuilder()
Returns aIChemObjectBuilder
for the data classes that extend this class.- Specified by:
getBuilder
in interfaceICDKObject
- Overrides:
getBuilder
in classChemObject
- Returns:
- The
IChemObjectBuilder
matching thisICDKObject
-
isEmpty
public boolean isEmpty()
Indicates whether this container is empty. The container is considered empty if there are no atoms. Bonds are not checked as a graph with no vertexes can not have edges.- Specified by:
isEmpty
in interfaceIAtomContainer
- Overrides:
isEmpty
in classAtomContainer
- Returns:
- whether the container is empty
-
-