Package org.openscience.cdk.silent
Class Bond
java.lang.Object
org.openscience.cdk.silent.ChemObject
org.openscience.cdk.silent.ElectronContainer
org.openscience.cdk.silent.Bond
- All Implemented Interfaces:
Serializable
,Cloneable
,IBond
,ICDKObject
,IChemObject
,IElectronContainer
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:
- Source code:
- main
- Belongs to CDK module:
- silent
- Keywords:
- bond, atom, electron
- Created on:
- 2003-10-02
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.openscience.cdk.interfaces.IBond
IBond.Display, IBond.Order, IBond.Stereo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Number of atoms contained by this object.protected IAtom[]
A list of atoms participating in this bond.protected IBond.Display
protected IBond.Order
The bond order of this bond.protected IBond.Stereo
A descriptor the stereochemical orientation of this bond.Fields inherited from class org.openscience.cdk.silent.ElectronContainer
electronCount
-
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.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.boolean
Compares a bond with this bond.boolean
Returns true if the given atom participates in this bond.boolean
javax.vecmath.Point2d
Returns the geometric 2D center of the bond.javax.vecmath.Point3d
Returns the geometric 3D center of the bond.getAtom
(int position) Returns an Atom from this bond.int
Returns 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.int
getIndex()
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.int
hashCode()
boolean
Access whether this bond has been marked as aromatic.boolean
isConnectedTo
(IBond bond) Checks whether a bond is connected to another one.boolean
isInRing()
Access whether this bond has been flagged as in a ring.void
Sets an Atom in this bond.void
Sets the array of atoms making up this bond.void
setDisplay
(IBond.Display display) Set the bond display style.void
setIsAromatic
(boolean arom) Mark this bond as being aromatic.void
setIsInRing
(boolean ring) Mark this bond as being in a ring.void
setOrder
(IBond.Order order) Sets the bond order of this bond.void
setStereo
(IBond.Stereo stereo) Sets the stereo descriptor for this bond.toString()
Returns a one line string representation of this Container.Methods inherited from class org.openscience.cdk.silent.ElectronContainer
getElectronCount, setElectronCount
Methods inherited from class org.openscience.cdk.silent.ChemObject
addListener, addProperties, getBuilder, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty, shallowCopy
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.openscience.cdk.interfaces.ICDKObject
getBuilder
Methods inherited from interface org.openscience.cdk.interfaces.IChemObject
addListener, addProperties, getFlag, getFlags, getFlagValue, getID, getListenerCount, getNotification, getProperties, getProperty, getProperty, notifyChanged, notifyChanged, removeListener, removeProperty, setFlag, setFlags, setID, setNotification, setProperties, setProperty
Methods inherited from interface org.openscience.cdk.interfaces.IElectronContainer
getElectronCount, setElectronCount
-
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. -
stereo
A descriptor the stereochemical orientation of this bond. -
display
-
-
Constructor Details
-
Bond
public Bond()Constructs an empty bond. -
Bond
Constructs a bond with a single bond order..- Parameters:
atom1
- the first Atom in the bondatom2
- the second Atom in the 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:
beg
- the first Atom in the bondend
- the second Atom in the bondorder
- the bond orderstereo
- a descriptor the stereochemical orientation of this bond
-
-
Method Details
-
atoms
Returns the Iterator to atoms making up this bond. Iterator.remove() is not implemented. -
getIndex
public int getIndex() -
getContainer
- Specified by:
getContainer
in interfaceIBond
-
setAtoms
Sets the array of atoms making up this bond. -
getAtomCount
public int getAtomCount()Returns the number of Atoms in this Bond.- Specified by:
getAtomCount
in interfaceIBond
- Returns:
- The number of Atoms in this Bond
-
getAtom
Returns an Atom from this bond. -
getBegin
Access the begin (or first) atom of the bond. -
getEnd
Access the end (or second) atom of the bond. -
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:
getConnectedAtom
in 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:
getConnectedAtoms
in 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
Returns true if the given atom participates in this bond. -
setAtom
Sets an Atom in this bond. -
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:
getDisplay
in interfaceIBond
- Returns:
- the bond display
-
setDisplay
Set the bond display style.- Specified by:
setDisplay
in interfaceIBond
- Parameters:
display
- the display
-
get2DCenter
public javax.vecmath.Point2d get2DCenter()Returns the geometric 2D center of the bond.- Specified by:
get2DCenter
in 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:
get3DCenter
in interfaceIBond
- Returns:
- The geometric 3D center of the bond
-
compare
Compares a bond with this bond.- Specified by:
compare
in interfaceIBond
- Overrides:
compare
in 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:
isConnectedTo
in 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:
isAromatic
in interfaceIBond
- Returns:
- aromatic status
- See Also:
-
setIsAromatic
public void setIsAromatic(boolean arom) Mark this bond as being aromatic.- Specified by:
setIsAromatic
in interfaceIBond
- Parameters:
arom
- aromatic status- See Also:
-
isInRing
public boolean isInRing()Access whether this bond has been flagged as in a ring. The default value is false and you must explicitly find rings first. -
setIsInRing
public void setIsInRing(boolean ring) Mark this bond as being in a ring.- Specified by:
setIsInRing
in 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:
clone
in interfaceIBond
- Specified by:
clone
in interfaceIChemObject
- Overrides:
clone
in classElectronContainer
- Returns:
- The cloned object
- Throws:
CloneNotSupportedException
- if the IChemObject cannot be cloned
-
hashCode
public int hashCode() -
equals
-
toString
Returns a one line string representation of this Container. This method is conform RFC #9.- Specified by:
toString
in interfaceIChemObject
- Overrides:
toString
in classElectronContainer
- Returns:
- The string representation of this Container
-