Class Ring
java.lang.Object
org.openscience.cdk.ChemObject
org.openscience.cdk.AtomContainer
org.openscience.cdk.Ring
- All Implemented Interfaces:
Serializable, Cloneable, IAtomContainer, ICDKObject, IChemObject, IChemObjectListener, IRing
- Direct Known Subclasses:
DebugRing
Class representing a ring structure in a molecule.
A ring is a linear sequence of
N atoms interconnected to each other by covalent bonds,
such that atom i (1 < i < N) is bonded to
atom i-1 and atom i + 1 and atom 1 is bonded to atom N and atom 2.
- See Also:
- Keywords:
- ring
-
Field Summary
Fields inherited from interface IChemObject
ALIPHATIC, AROMATIC, CONJUGATED, HIDDEN, HYDROGEN_BOND_ACCEPTOR, HYDROGEN_BOND_DONOR, IN_RING, MAPPED, MARKUSH, NOT_IN_RING, PLACED, REACTIVE_CENTER, SINGLE_OR_DOUBLE, TYPEABLE, VISITEDModifier and TypeFieldDescriptionstatic final intFlag that is set if a ChemObject is part of an aliphatic chain.static final intFlag is set if ChemObject is part of an aromatic system.static final intFlag is set if ChemObject is part of a conjugated system.static final intThis flag can be used when depicted structures to hide certain parts, for example the things are abbreviated (display shortcuts).static final intSets to true if the atom is a hydrogen bond acceptor.static final intSets to true if the atom is a hydrogen bond donor.static final intFlag that is set when the ChemObject is part of a ring.static final intFlag is set if a ChemObject is mapped to another ChemObject.static final intFlag to indicate a flattened molecule holds a Markush structure, you can work on it as is or it might make more sense to repack into something sensible like a RGroupQuery.static final intFlag that is set when the ChemObject is part of a ring.static final intFlag that is set if the ChemObject is placed when calculating 2D/3D layouts.static final intFlag is set if a ChemObject has reactive center.static final intFlag used for marking uncertainty of the bond order.static final intFlag is set if an atom could be typed.static final intFlag is set if ChemObject has been visited. -
Constructor Summary
ConstructorsConstructorDescriptionRing()Constructs an empty ring.Ring(int ringSize) Constructs an empty ring that will have a certain size.Constructs a ring that will have a certain number of atoms of the given elements.Ring(IAtomContainer atomContainer) Constructs a ring from the atoms in an IAtomContainer object. -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones thisIChemObject.intReturns the sum of all bond orders in the ring.getNextBond(IBond bond, IAtom atom) Returns the next bond in order, relative to a given bond and atom.intReturns the number of atoms\edges in this ring.toString()Returns a one line description of this IChemObject.Methods inherited from class AtomContainer
add, addAtom, addBond, addBond, addBond, addElectronContainer, addLonePair, addLonePair, addSingleElectron, addSingleElectron, addStereoElement, atoms, bonds, contains, contains, contains, contains, contains, electronContainers, getAtom, getAtomCount, getAtomNumber, getBond, getBond, getBondCount, getBondNumber, getBondNumber, getBondOrderSum, getConnectedAtomsCount, getConnectedAtomsList, getConnectedBondsCount, getConnectedBondsCount, getConnectedBondsList, getConnectedElectronContainersList, getConnectedLonePairsCount, getConnectedLonePairsList, getConnectedSingleElectronsCount, getConnectedSingleElectronsList, getElectronContainer, getElectronContainerCount, getFirstAtom, getLastAtom, getLonePair, getLonePairCount, getLonePairNumber, getMaximumBondOrder, getMinimumBondOrder, getSingleElectron, getSingleElectronCount, getSingleElectronNumber, getTitle, indexOf, indexOf, indexOf, indexOf, isEmpty, lonePairs, newAtom, newAtom, newBond, remove, removeAllBonds, removeAllElectronContainers, removeAllElements, removeAtom, removeAtom, removeAtomAndConnectedElectronContainers, removeAtomOnly, removeAtomOnly, removeBond, removeBond, removeBond, removeElectronContainer, removeElectronContainer, removeLonePair, removeLonePair, removeSingleElectron, removeSingleElectron, setAtom, setAtoms, setBonds, setStereoElements, setTitle, shallowCopy, singleElectrons, stateChanged, stereoElementsModifier and TypeMethodDescriptionvoidadd(IAtomContainer that) Adds all atoms and electronContainers of a given atomcontainer to this container.voidAdds an atom to this container.voidaddBond(int beg, int end, IBond.Order order, IBond.Display display) Adds a bond to this container.voidaddBond(int beg, int end, IBond.Order order, IBond.Stereo stereo) Adds a bond to this container.voidAdds a Bond to this AtomContainer.voidAdds a ElectronContainer to this AtomContainer.voidaddLonePair(int idx) Adds a LonePair to this Atom.voidaddLonePair(ILonePair lp) Adds a lone pair to this AtomContainer.voidaddSingleElectron(int idx) Adds a SingleElectron to this Atom.voidAdds a single electron to this AtomContainer.voidaddStereoElement(IStereoElement element) Adds a stereo element to this container.atoms()Returns an Iterable for looping over all atoms in this container.bonds()Returns an Iterable for looping over all bonds in this container.booleanTrue, if the AtomContainer contains the given atom object.booleanTrue, if the AtomContainer contains the given bond object.booleancontains(IElectronContainer electronContainer) True, if the AtomContainer contains the given ElectronContainer object.booleanTrue, if the AtomContainer contains the given LonePair object.booleancontains(ISingleElectron electron) True, if the AtomContainer contains the given SingleElectron object.Returns an Iterable for looping over all electron containers in this container.getAtom(int idx) Get the atom at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getAtomCount().intReturns the number of Atoms in this Container.intgetAtomNumber(IAtom atom) Returns the position of a given atom in the atoms array.getBond(int idx) Get the bond at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getBondCount().Returns the bond that connects the two given atoms.intReturns the number of Bonds in this Container.intgetBondNumber(IAtom beg, IAtom end) Returns the position of the bond between two given atoms in the electronContainers array.intgetBondNumber(IBond bond) Returns the position of a given bond in the electronContainers array.doublegetBondOrderSum(IAtom atom) Returns the sum of the bond orders for a given Atom.intgetConnectedAtomsCount(IAtom atom) Returns the number of connected atoms (explicit degree) to the specified atom.getConnectedAtomsList(IAtom atom) Returns the atoms connected connected to the specified atom by a bond.intgetConnectedBondsCount(int idx) Returns the number of connected bonds (explicit degree) to atom at the specified index.intgetConnectedBondsCount(IAtom atom) Returns the number of connected bonds (explicit degree) to the specified atom.getConnectedBondsList(IAtom atom) Returns the bonds connected connected to the specified atom.Returns the electron containers (bonds, radicals, and lone pairs ) connected connected to the specified atom.intReturns the number of lone pairs connected to the specified atom.Returns the lone pairs connected connected to the specified atom.intReturns the number of single electrons connected to the specified atom.Returns the single electrons connected connected to the specified atom.getElectronContainer(int number) Returns the ElectronContainer at positionnumberin the container.intReturns the number of ElectronContainers in this Container.Returns the atom at position 0 in the container.Returns the atom at the last position in the container.getLonePair(int idx) Get the lone pair at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getLonePairCount().intReturns the number of LonePairs in this Container.intgetLonePairNumber(ILonePair lonePair) Returns the position of a given lone pair in the lone pair array.getMaximumBondOrder(IAtom atom) Returns the maximum bond order that this atom currently has in the context of this AtomContainer.getMinimumBondOrder(IAtom atom) Returns the minimum bond order that this atom currently has in the context of this AtomContainer.getSingleElectron(int idx) Get the single electron at the specified idx, the index should be in the range 0 ≤ idx <IAtomContainer.getSingleElectronCount().intReturns the number of the single electrons in this container.intgetSingleElectronNumber(ISingleElectron singleElectron) Returns the position of a given single electron in the single electron array.getTitle()Access the title of the record.intAccess the storage index of an atom.intAccess the storage index of a bond.intAccess the storage index of a long pair.intindexOf(ISingleElectron electron) Access the storage index of a single electron (radical).booleanisEmpty()Indicates whether this container is empty.Returns an Iterable for looping over all lone pairs in this container.newAtom(int element, int numImplH) Create a new atom in this container of the specified element and implicit hydrogen count.Create a new atom in the container based on properties of the provided atom.newBond(IAtom beg, IAtom end, IBond.Order order) Create a new bond between two atoms.voidremove(IAtomContainer atomContainer) Removes all atoms and electronContainers of a given atomcontainer from this container.voidRemoves all Bonds from this container.voidRemoves electronContainers from this container.voidRemoves all atoms, bonds and stereo elements from this container.voidremoveAtom(int pos) Safely remove an atom from the container.voidremoveAtom(IAtom atom) Safely remove an atom from the container.voidSafely remove an atom from the container.voidremoveAtomOnly(int idx) Unsafely remove atom at index.voidremoveAtomOnly(IAtom atom) Unsafely remove atom.removeBond(int idx) Removes the bond at the given position from the AtomContainer.removeBond(IAtom beg, IAtom end) Removes the bond that connects the two given atoms.voidremoveBond(IBond bond) Removes the bond from this container.removeElectronContainer(int number) Removes the bond at the given position from this container.voidRemoves this ElectronContainer from this container.removeLonePair(int idx) Removes the lone pair at the given position from the AtomContainer.voidremoveLonePair(ILonePair lonePair) Removes the lone pair from the AtomContainer.removeSingleElectron(int idx) Removes the single electron at the given position from the AtomContainer.voidremoveSingleElectron(ISingleElectron electron) Removes the single electron from the AtomContainer.voidSet the atom atidx, the index must have an existing atom and therefore be in the range 0 ≤ idx < mol.getAtomCount().voidSets the array of atoms of this AtomContainer.voidSets the array of bonds of this AtomContainer.voidsetStereoElements(List<IStereoElement> elements) Set the stereo elements - this will replace the existing instance with a new instance.voidModify the title of the record.Clones thisIChemObject, but preserves references toObjects.Returns an Iterable for looping over all single electrons in this container.voidCalled by objects to notify objects that implemented this interface and registered with them as ChemObjectListeners.Returns the stereo elements defined for this atom container.Methods inherited from class ChemObject
addListener, addProperties, clear, compare, flags, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, is, notifyChanged, notifyChanged, removeListener, removeProperty, set, setFlag, setFlags, setID, setNotification, setProperties, setPropertyModifier and TypeMethodDescriptionvoidUse this to add yourself to this IChemObject as a listener.voidaddProperties(Map<Object, Object> properties) Sets the properties of this object.voidclear(int flags) Clear the provided flags.booleanCompares a IChemObject with this IChemObject.intflags()Access the current value of the flags for this ChemObject.Returns aIChemObjectBuilderfor the data classes that extend this class.booleangetFlag(int mask) Returns the value of a given flag.boolean[]getFlags()Returns the whole set of flags.Access the internal value used to store the flags.getID()Returns the identifier (ID) of this object.intReturns the number of ChemObjectListeners registered with this object.booleanReturns the flag that indicates whether notification messages are sent around.Returns a Map with the IChemObject's properties.<T> TgetProperty(Object description) Returns a property for the IChemObject.<T> TgetProperty(Object description, Class<T> c) Access a property of the given description and cast the specified class.booleanis(int flags) Test if a flag(s) are set on this ChemObject.voidThis should be triggered by an method that changes the content of an object to that the registered listeners can react to it.voidThis should be triggered by an method that changes the content of an object to that the registered listeners can react to it.voidUse this to remove a ChemObjectListener from the ListenerList of this IChemObject.voidremoveProperty(Object description) Removes a property for a IChemObject.voidset(int flags) Set the provided flags.voidsetFlag(int mask, boolean value) Sets the value of some flag.voidsetFlags(boolean[] flagsNew) Sets the whole set of flags.voidSets the identifier (ID) of this object.voidsetNotification(boolean bool) Set a flag to use or not use notification.voidsetProperties(Map<Object, Object> properties) Set the properties of this object to the provided map (shallow copy).voidsetProperty(Object description, Object property) Sets a property for a IChemObject.Methods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface IAtomContainer
addBond, newAtom, newAtom, newBondModifier and TypeMethodDescriptiondefault voidaddBond(int atom1, int atom2, IBond.Order order) Adds a bond to this container.default IAtomnewAtom()Create a new carbon atom in this container, it will have the implicit hydrogen count initialized to 0.default IAtomnewAtom(int element) Create a new atom in this container of the specified element, it will have the implicit hydrogen count initialized to 0.default IBondCreate a new single bond between two atoms.
-
Constructor Details
-
Ring
public Ring()Constructs an empty ring. -
Ring
Constructs a ring from the atoms in an IAtomContainer object.- Parameters:
atomContainer- The IAtomContainer object containing the atoms to form the ring
-
Ring
Constructs a ring that will have a certain number of atoms of the given elements.- Parameters:
ringSize- The number of atoms and bonds the ring will haveelementSymbol- The element of the atoms the ring will have
-
Ring
public Ring(int ringSize) Constructs an empty ring that will have a certain size.- Parameters:
ringSize- The size (number of atoms) the ring will have
-
-
Method Details
-
getRingSize
public int getRingSize()Returns the number of atoms\edges in this ring.- Specified by:
getRingSizein interfaceIRing- Returns:
- The number of atoms\edges in this ring
-
getNextBond
Returns the next bond in order, relative to a given bond and atom. Example: Let the ring be composed of 0-1, 1-2, 2-3 and 3-0. A request getNextBond(1-2, 2) will return Bond 2-3.- Specified by:
getNextBondin interfaceIRing- Parameters:
bond- A bond for which an atom from a consecutive bond is soughtatom- A atom from the bond above to assign a search direction- Returns:
- The next bond in the order given by the above assignment
-
getBondOrderSum
public int getBondOrderSum()Returns the sum of all bond orders in the ring.- Specified by:
getBondOrderSumin interfaceIRing- Returns:
- the sum of all bond orders in the ring
-
clone
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:
clonein interfaceIAtomContainer- Specified by:
clonein interfaceIChemObject- Specified by:
clonein interfaceIRing- Overrides:
clonein classAtomContainer- Returns:
- The cloned object
- Throws:
CloneNotSupportedException- if the IChemObject cannot be cloned
-
toString
Description copied from class:AtomContainerReturns a one line description of this IChemObject.- Specified by:
toStringin interfaceIChemObject- Overrides:
toStringin classAtomContainer- Returns:
- a String representation of this object
-