Class Bond
java.lang.Object
org.openscience.cdk.ChemObject
org.openscience.cdk.ElectronContainer
org.openscience.cdk.Bond
- All Implemented Interfaces:
Serializable, Cloneable, IBond, ICDKObject, IChemObject, IElectronContainer
- Direct Known Subclasses:
DebugBond, PharmacophoreAngleBond, PharmacophoreBond, PharmacophoreQueryAngleBond, PharmacophoreQueryBond
Implements the concept of a covalent bond between two or more atoms. A bond is
considered to be a number of electrons connecting two or more of atoms.
It should be noted that the majority of applications will consider 2-center bonds,
especially since the bond orders currently supported are really only valid for
2-center bonds. However the code does support multi-center bonds, though the
orders may not make sense at this point.
In general code that assumes bonds are 2-centered can use this class seamlessly, as
the semantics are identical to the older versions. Care shoud be exercised when
using multi-center bonds using this class as the orders may not make sense.
- Author:
- steinbeck
- See Also:
- Keywords:
- bond, atom, electron
- Created on:
- 2003-10-02
-
Nested Class Summary
Nested classes/interfaces inherited from interface IBond
IBond.Display, IBond.Order, IBond.StereoModifier and TypeInterfaceDescriptionstatic enumBond display style, controlling how bonds appear in a 2D depiction.static enumA list of permissible bond orders.static enumDeprecated. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intNumber of atoms contained by this object.protected IAtom[]A list of atoms participating in this bond.protected IBond.Displayprotected IBond.OrderThe bond order of this bond.Fields inherited from class ElectronContainer
electronCountFields 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
ConstructorsConstructorDescriptionBond()Constructs an empty bond.Constructs a multi-center bond, with undefined order and no stereo information.Bond(IAtom[] atoms, IBond.Order order) Constructs a multi-center bond, with a specified order and no stereo information.Constructs a bond with a single bond order..Bond(IAtom atom1, IAtom atom2, IBond.Order order) Constructs a bond with a given order.Bond(IAtom beg, IAtom end, IBond.Order order, IBond.Display display) Constructs a bond with a given order and display from an array of atoms.Bond(IAtom atom1, IAtom atom2, IBond.Order order, IBond.Stereo stereo) Constructs a bond with a given order and stereo orientation from an array of atoms. -
Method Summary
Modifier and TypeMethodDescriptionatoms()Returns the Iterator to atoms making up this bond.clone()Clones this bond object, including clones of the atoms between which the bond is defined.booleanCompares a bond with this bond.booleanReturns true if the given atom participates in this bond.booleanjavax.vecmath.Point2dReturns the geometric 2D center of the bond.javax.vecmath.Point3dReturns the geometric 3D center of the bond.getAtom(int position) Returns an Atom from this bond.intReturns the number of Atoms in this Bond.getBegin()Access the begin (or first) atom of the bond.getConnectedAtom(IAtom atom) Returns the other atom in the bond, the atom is connected to the given atom.IAtom[]getConnectedAtoms(IAtom atom) Returns all the atoms in the bond connected to the given atom.Access the bond display style.getEnd()Access the end (or second) atom of the bond.intgetIndex()getOrder()Returns the bond order of this bond.Returns the other atom in the bond, the atom is connected to the given atom.This method is only correct for two-centre bonds, for n-centre bonds the behaviour is undefined and the more correctIBond.getConnectedAtoms(IAtom)should be used.Returns the stereo descriptor for this bond.inthashCode()booleanAccess whether this bond has been marked as aromatic.booleanisConnectedTo(IBond bond) Checks whether a bond is connected to another one.booleanisInRing()Access whether this bond has been flagged as in a ring.voidSets an Atom in this bond.voidSets the array of atoms making up this bond.voidsetDisplay(IBond.Display display) Set the bond display style.voidsetIsAromatic(boolean arom) Mark this bond as being aromatic.voidsetIsInRing(boolean ring) Mark this bond as being in a ring.voidsetOrder(IBond.Order order) Sets the bond order of this bond.voidsetStereo(IBond.Stereo stereo) Sets the stereo descriptor for this bond.toString()Returns a one line string representation of this Container.Methods inherited from class ElectronContainer
getElectronCount, setElectronCountModifier and TypeMethodDescriptionReturns the number of electrons in this electron container.voidsetElectronCount(Integer electronCount) Sets the number of electrons in this electron container.Methods inherited from class ChemObject
addListener, addProperties, clear, flags, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, is, notifyChanged, notifyChanged, removeListener, removeProperty, set, setFlag, setFlags, setID, setNotification, setProperties, setProperty, shallowCopyModifier 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.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.Clones thisIChemObject, but preserves references toObjects.Methods inherited from interface IBond
getConnectedAtomModifier and TypeMethodDescriptiondefault IAtomgetConnectedAtom(IBond other) Get the connected atom between two bonds.
-
Field Details
-
order
The bond order of this bond. -
atomCount
protected int atomCountNumber of atoms contained by this object. -
atoms
A list of atoms participating in this bond. -
display
-
-
Constructor Details
-
Bond
public Bond()Constructs an empty bond. -
Bond
-
Bond
Constructs a bond with a given order.- Parameters:
atom1- the first Atom in the bondatom2- the second Atom in the bondorder- the bond order
-
Bond
Constructs a multi-center bond, with undefined order and no stereo information.- Parameters:
atoms- An array of IAtom containing the atoms constituting the bond
-
Bond
Constructs a multi-center bond, with a specified order and no stereo information.- Parameters:
atoms- An array of IAtom containing the atoms constituting the bondorder- The order of the bond
-
Bond
Constructs a bond with a given order and stereo orientation from an array of atoms.- Parameters:
atom1- the first Atom in the bondatom2- the second Atom in the bondorder- the bond orderstereo- a descriptor the stereochemical orientation of this bond
-
Bond
Constructs a bond with a given order and display from an array of atoms.- Parameters:
beg- the first Atom in the bondend- the second Atom in the bondorder- the bond orderdisplay- graphical display of this bond
-
-
Method Details
-
atoms
-
getIndex
-
getContainer
- Specified by:
getContainerin interfaceIBond
-
setAtoms
-
getAtomCount
public int getAtomCount()Returns the number of Atoms in this Bond.- Specified by:
getAtomCountin interfaceIBond- Returns:
- The number of Atoms in this Bond
-
getAtom
-
getBegin
-
getEnd
-
getOther
Returns the other atom in the bond, the atom is connected to the given atom.This method is only correct for two-centre bonds, for n-centre bonds the behaviour is undefined and the more correctIBond.getConnectedAtoms(IAtom)should be used.IAtom beg = bond.getBegin(); IAtom end = bond.getEnd(); // bond.getOther(beg) == end // bond.getOther(end) == beg -
getConnectedAtom
Returns the other atom in the bond, the atom is connected to the given atom. This method is only correct for two-centre bonds, for n-centre bonds the behaviour is undefined and the more correctIBond.getConnectedAtoms(IAtom)should be used.IAtom beg = bond.getBegin(); IAtom end = bond.getEnd(); // bond.getConnectedAtom(beg) == end // bond.getConnectedAtom(end) == beg- Specified by:
getConnectedAtomin interfaceIBond- Parameters:
atom- The atom the bond partner is searched of- Returns:
- the connected atom or null if the given atom is not part of the bond
-
getConnectedAtoms
Returns all the atoms in the bond connected to the given atom.- Specified by:
getConnectedAtomsin interfaceIBond- Parameters:
atom- The atoms the bond partner is searched of- Returns:
- the connected atoms or null if the given atom is not part of the bond
-
contains
-
setAtom
-
getOrder
Returns the bond order of this bond. -
setOrder
Sets the bond order of this bond. -
getStereo
Returns the stereo descriptor for this bond. -
setStereo
Sets the stereo descriptor for this bond. -
getDisplay
Access the bond display style.- Specified by:
getDisplayin interfaceIBond- Returns:
- the bond display
-
setDisplay
Set the bond display style.- Specified by:
setDisplayin interfaceIBond- Parameters:
display- the display
-
get2DCenter
public javax.vecmath.Point2d get2DCenter()Returns the geometric 2D center of the bond.- Specified by:
get2DCenterin interfaceIBond- Returns:
- The geometric 2D center of the bond
-
get3DCenter
public javax.vecmath.Point3d get3DCenter()Returns the geometric 3D center of the bond.- Specified by:
get3DCenterin interfaceIBond- Returns:
- The geometric 3D center of the bond
-
compare
Compares a bond with this bond.- Specified by:
comparein interfaceIBond- Overrides:
comparein classChemObject- Parameters:
object- Object of type Bond- Returns:
- true if the bond is equal to this bond
-
isConnectedTo
Checks whether a bond is connected to another one. This can only be true if the bonds have an Atom in common.- Specified by:
isConnectedToin interfaceIBond- Parameters:
bond- The bond which is checked to be connect with this one- Returns:
- true if the bonds share an atom, otherwise false
-
isAromatic
public boolean isAromatic()Access whether this bond has been marked as aromatic. The default value is false and you must explicitly perceive aromaticity with one of the available models.- Specified by:
isAromaticin interfaceIBond- Returns:
- aromatic status
- See Also:
-
setIsAromatic
public void setIsAromatic(boolean arom) Mark this bond as being aromatic.- Specified by:
setIsAromaticin interfaceIBond- Parameters:
arom- aromatic status- See Also:
-
isInRing
-
setIsInRing
public void setIsInRing(boolean ring) Mark this bond as being in a ring.- Specified by:
setIsInRingin interfaceIBond- Parameters:
ring- ring status- See Also:
-
clone
Clones this bond object, including clones of the atoms between which the bond is defined.- Specified by:
clonein interfaceIBond- Specified by:
clonein interfaceIChemObject- Overrides:
clonein classElectronContainer- Returns:
- The cloned object
- Throws:
CloneNotSupportedException- if the IChemObject cannot be cloned
-
hashCode
-
equals
-
toString
Returns a one line string representation of this Container. This method is conform RFC #9.- Specified by:
toStringin interfaceIChemObject- Overrides:
toStringin classElectronContainer- Returns:
- The string representation of this Container
-