IAtomContainer.java

/* $Revision: 7996 $ $Author: egonw $ $Date: 2007-02-24 17:48:55 +0100 (Sat, 24 Feb 2007) $ * * Copyright (C) 2006-2007 Egon Willighagen <egonw@users.sf.net> * * Contact: cdk-devel@lists.sourceforge.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */package org.openscience.cdk.interfaces;
import java.util.Iterator;
import java.util.List;
/** * Base class for all chemical objects that maintain a list of Atoms and * ElectronContainers. <p> * * Looping over all <code>IBond</code>s in the <code>IAtomContainer</code> * is typically done like: * <pre> * Iterator bonds = atomContainer.bonds(); * while (bonds.hasNext()) { * IBond b = (IBond)bonds.next(); * } * </pre> * * @cdk.module interfaces * * @author steinbeck * @cdk.created 2000-10-02 */00044public interface IAtomContainer extends IChemObject, IChemObjectListener {
/** * Adds an AtomParity to this container. If a parity is already given for the * affected Atom, it is overwritten. * * @param parity The new AtomParity for this container * @see #getAtomParity */publicvoid addAtomParity(IAtomParity parity);
/** * Returns the atom parity for the given Atom. If no parity is associated * with the given Atom, it returns null. * * @param atom Atom for which the parity must be returned * @return The AtomParity for the given Atom, or null if that Atom does * not have an associated AtomParity * @see #addAtomParity */publicIAtomParity getAtomParity(IAtom atom);
/** * Sets the array of atoms of this AtomContainer. * * @param atoms The array of atoms to be assigned to this AtomContainer * @see #atoms */publicvoid setAtoms(IAtom[] atoms);
/** * Sets the array of bonds of this AtomContainer. * * @param bonds The array of bonds to be assigned to * this AtomContainer * @see #bonds */publicvoid setBonds(IBond[] bonds);
/** * Set the atom at position <code>number</code> in [0,..]. * * @param number The position of the atom to be set. * @param atom The atom to be stored at position <code>number</code> * @see #getAtom */publicvoid setAtom(int number, IAtom atom);
/** * Get the atom at position <code>number</code> in [0,..]. * * @param number The position of the atom to be retrieved. * @return The atom number * @see #setAtom */publicIAtom getAtom(int number);
/** * Get the bond at position <code>number</code> in [0,..]. * *@param number The position of the bond to be retrieved. *@return The bond number */publicIBond getBond(int number);
/** * Get the lone pair at position <code>number</code> in [0,..]. * *@param number The position of the LonePair to be retrieved. *@return The lone pair number */publicILonePair getLonePair(int number);
/** * Get the single electron at position <code>number</code> in [0,..]. * *@param number The position of the SingleElectron to be retrieved. *@return The single electron number */publicISingleElectron getSingleElectron(int number);
/** * Returns an Iterator for looping over all atoms in this container. * *@return An Iterator with the atoms in this container */public Iterator atoms();
/** * Returns an Iterator for looping over all bonds in this container. * *@return An Iterator with the bonds in this container */public Iterator bonds();
/** * Returns an Iterator for looping over all lone pairs in this container. * *@return An Iterator with the lone pairs in this container */public Iterator lonePairs();
/** * Returns an Iterator for looping over all single electrons in this container. * *@return An Iterator with the single electrons in this container */public Iterator singleElectrons();
/** * Returns an Iterator for looping over all electron containers in this container. * *@return An Iterator with the electron containers in this container */public Iterator electronContainers();
/** * Returns the atom at position 0 in the container. * *@return The atom at position 0 . */publicIAtom getFirstAtom();
/** * Returns the atom at the last position in the container. * *@return The atom at the last position */publicIAtom getLastAtom();
/** * Returns the position of a given atom in the atoms array. It returns -1 if * the atom atom does not exist. * *@param atom The atom to be sought *@return The Position of the atom in the atoms array in [0,..]. */publicint getAtomNumber(IAtom atom);
/** * Returns the position of the bond between two given atoms in the * electronContainers array. It returns -1 if the bond does not exist. * *@param atom1 The first atom *@param atom2 The second atom *@return The Position of the bond between a1 and a2 in the * electronContainers array. */publicint getBondNumber(IAtom atom1, IAtom atom2);
/** * Returns the position of a given bond in the electronContainers array. It * returns -1 if the bond does not exist. * *@param bond The bond to be sought *@return The Position of the bond in the electronContainers array in [0,..]. */publicint getBondNumber(IBond bond);
/** * Returns the position of a given lone pair in the lone pair array. * It returns -1 if the lone pair does not exist. * * @param lonePair The lone pair to be sought * @return The Position of the lone pair in the array.. */publicint getLonePairNumber(ILonePair lonePair);
/** * Returns the position of a given single electron in the single electron array. * It returns -1 if the single electron does not exist. * * @param singleElectron The single electron to be sought * @return The Position of the single electron in the array. */publicint getSingleElectronNumber(ISingleElectron singleElectron);
/** * Returns the ElectronContainer at position <code>number</code> in the * container. * *@param number The position of the ElectronContainer to be returned. *@return The ElectronContainer at position <code>number</code>. *@see #setElectronContainerAt */publicIElectronContainer getElectronContainer(int number);
/** * Returns the bond that connectes the two given atoms. * * @param atom1 The first atom * @param atom2 The second atom * @return The bond that connectes the two atoms */publicIBond getBond(IAtom atom1, IAtom atom2);
/** * Returns the number of Atoms in this Container. * *@return The number of Atoms in this Container */publicint getAtomCount();
/** * Returns the number of Bonds in this Container. * *@return The number of Bonds in this Container */publicint getBondCount();
/** * Returns the number of LonePairs in this Container. * *@return The number of LonePairs in this Container */publicint getLonePairCount();
/** * Returns the number of the single electrons in this container. * * @return The number of SingleElectron objects of this AtomContainer */publicint getSingleElectronCount();
/** * Returns the number of ElectronContainers in this Container. * * @return The number of ElectronContainers in this Container */publicint getElectronContainerCount();
/** * Returns an ArrayList of all atoms connected to the given atom. * *@param atom The atom the bond partners are searched of. *@return The ArrayList with the connected atoms */public List getConnectedAtomsList(IAtom atom);
/** * Returns an ArrayList of all Bonds connected to the given atom. * *@param atom The atom the connected bonds are searched of *@return The ArrayList with connected atoms */public List getConnectedBondsList(IAtom atom);
/** * Returns the array of lone pairs connected to an atom. * *@param atom The atom for which to get lone pairs *@return The array of LonePairs of this AtomContainer */public List getConnectedLonePairsList(IAtom atom);
/** * Returns an array of all SingleElectron connected to the given atom. * *@param atom The atom on which the single electron is located *@return The array of SingleElectron of this AtomContainer */public List getConnectedSingleElectronsList(IAtom atom);
/** * Returns an ArrayList of all electronContainers connected to the given atom. * *@param atom The atom the connected electronContainers are searched of *@return The ArrayList with the connected atoms */public List getConnectedElectronContainersList(IAtom atom);
/** * Returns the number of atoms connected to the given atom. * *@param atom The atom the number of bond partners are searched of. *@return The the size of connected atoms */publicint getConnectedAtomsCount(IAtom atom);
/** * Returns the number of Bonds for a given Atom. * *@param atom The atom *@return The number of Bonds for this atom */publicint getConnectedBondsCount(IAtom atom);
/** * Returns the number of connected atoms (degree) to the given atom. * *@param atomnumber The atomnumber the degree is searched for *@return The number of connected atoms (degree) */publicint getConnectedBondsCount(int atomnumber);
/** * Returns the number of LonePairs for a given Atom. * *@param atom The atom *@return The number of LonePairs for this atom */publicint getConnectedLonePairsCount(IAtom atom);
/** * Returns the sum of the SingleElectron for a given Atom. * *@param atom The atom on which the single electron is located *@return The array of SingleElectron of this AtomContainer */publicint getConnectedSingleElectronsCount(IAtom atom);
/** * Returns the sum of the bond orders for a given Atom. * * @param atom The atom * @return The number of bondorders for this atom */publicdouble getBondOrderSum(IAtom atom);
/** * Returns the maximum bond order that this atom currently has in the context * of this AtomContainer. * * @param atom The atom * @return The maximum bond order that this atom currently has */publicdouble getMaximumBondOrder(IAtom atom);
/** * Returns the minimum bond order that this atom currently has in the context * of this AtomContainer. * *@param atom The atom *@return The minimim bond order that this atom currently has */publicdouble getMinimumBondOrder(IAtom atom);
/** * Adds all atoms and electronContainers of a given atomcontainer to this * container. * *@param atomContainer The atomcontainer to be added */publicvoidadd(IAtomContainer atomContainer);
/** * Adds an atom to this container. * *@param atom The atom to be added to this container */publicvoid addAtom(IAtom atom);
/** * Adds a Bond to this AtomContainer. * *@param bond The bond to added to this container */publicvoid addBond(IBond bond);
/** * Adds a lone pair to this AtomContainer. * *@param lonePair The LonePair to added to this container */publicvoid addLonePair(ILonePair lonePair);
/** * Adds a single electron to this AtomContainer. * *@param singleElectron The SingleElectron to added to this container */publicvoid addSingleElectron(ISingleElectron singleElectron);
/** * Adds a ElectronContainer to this AtomContainer. * *@param electronContainer The ElectronContainer to added to this container */publicvoid addElectronContainer(IElectronContainer electronContainer);
/** * Removes all atoms and electronContainers of a given atomcontainer from this * container. * *@param atomContainer The atomcontainer to be removed */publicvoidremove(IAtomContainer atomContainer);
/** * 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. * *@param position The position of the atom to be removed. */publicvoid removeAtom(int position);
/** * 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. * *@param atom The atom to be removed */publicvoid removeAtom(IAtom atom);
/** * Removes the bond at the given position from the AtomContainer. * *@param position The position of the bond to be removed. */publicIBond removeBond(int position);
/** * Removes the bond that connects the two given atoms. * * @param atom1 The first atom * @param atom2 The second atom * @return The bond that connectes the two atoms */publicIBond removeBond(IAtom atom1, IAtom atom2);
/** * Removes the bond from this container. * * @param bond The bond to be removed. */publicvoid removeBond(IBond bond);
/** * Removes the lone pair at the given position from the AtomContainer. * * @param position The position of the LonePair to be removed. * @return The removed ILonePair. */publicILonePair removeLonePair(int position);
/** * Removes the lone pair from the AtomContainer. * * @param lonePair The LonePair to be removed. */publicvoid removeLonePair(ILonePair lonePair);
/** * Removes the single electron at the given position from the AtomContainer. * * @param position The position of the SingleElectron to be removed. * @return The removed ISingleElectron */publicISingleElectron removeSingleElectron(int position);
/** * Removes the single electron from the AtomContainer. * * @param singleElectron The SingleElectron to be removed. */publicvoid removeSingleElectron(ISingleElectron singleElectron);
/** * Removes the bond at the given position from this container. * * @param position The position of the bond in the electronContainers array * @return the IElectronContainer that was removed */publicIElectronContainer removeElectronContainer(int position);
/** * Removes this ElectronContainer from this container. * * @param electronContainer The electronContainer to be removed */publicvoid removeElectronContainer(IElectronContainer electronContainer);
/** * Removes the given atom and all connected electronContainers from the * AtomContainer. * *@param atom The atom to be removed */publicvoid removeAtomAndConnectedElectronContainers(IAtom atom);
/** * Removes all atoms and bond from this container. */publicvoid removeAllElements();
/** * Removes electronContainers from this container. */publicvoid removeAllElectronContainers();
/** * Removes all Bonds from this container. */publicvoid removeAllBonds();
/** * Adds a bond to this container. * *@param atom1 Id of the first atom of the Bond in [0,..] *@param atom2 Id of the second atom of the Bond in [0,..] *@param order Bondorder *@param stereo Stereochemical orientation */publicvoid addBond(int atom1, int atom2, double order, int stereo);
/** * Adds a bond to this container. * *@param atom1 Id of the first atom of the Bond in [0,..] *@param atom2 Id of the second atom of the Bond in [0,..] *@param order Bondorder */publicvoid addBond(int atom1, int atom2, double order);
/** * Adds a LonePair to this Atom. * *@param atomID The atom number to which the LonePair is added in [0,..] */publicvoid addLonePair(int atomID);
/** * Adds a SingleElectron to this Atom. * *@param atomID The atom number to which the SingleElectron is added in [0,..] */publicvoid addSingleElectron(int atomID);
/** * True, if the AtomContainer contains the given atom object. * *@param atom the atom this AtomContainer is searched for *@return True, if the AtomContainer contains the given atom object */publicboolean contains(IAtom atom);
/** * True, if the AtomContainer contains the given bond object. * *@param bond the bond this AtomContainer is searched for *@return True, if the AtomContainer contains the given bond object */publicboolean contains(IBond bond);
/** * True, if the AtomContainer contains the given LonePair object. * *@param lonePair the LonePair this AtomContainer is searched for *@return True, if the AtomContainer contains the given LonePair object */publicboolean contains(ILonePair lonePair);
/** * True, if the AtomContainer contains the given SingleElectron object. * *@param singleElectron the SingleElectron this AtomContainer is searched for *@return True, if the AtomContainer contains the given SingleElectron object */publicboolean contains(ISingleElectron singleElectron);
/** * True, if the AtomContainer contains the given ElectronContainer object. * *@param electronContainer ElectronContainer that is searched for *@return True, if the AtomContainer contains the given bond object */publicboolean contains(IElectronContainer electronContainer);
}