Package org.biojava.nbio.structure
Class BondImpl
- java.lang.Object
- 
- org.biojava.nbio.structure.BondImpl
 
- 
- All Implemented Interfaces:
- Serializable,- Bond
 
 public class BondImpl extends Object implements Bond A simple bond -- it stores information about two atoms as well as information about its bond order.- Author:
- Jules Jacobsen , Ulysse Carion 
- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description BondImpl(Atom atomA, Atom atomB, int bondOrder)Constructs a new bond from a pair of atoms and the bond order of the bond between them.BondImpl(Atom atomA, Atom atomB, int bondOrder, boolean addSelfToAtoms)Constructs a new bond from a pair of atoms and the bond order of the bond between them.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomgetAtomA()Gets atom 'A' of this bond.AtomgetAtomB()Gets atom 'B' of this bond.intgetBondOrder()Gets the bond order of this bond.doublegetLength()Gets the distance between the two atoms of this bond.AtomgetOther(Atom exclude)A utility method to get the other atom in a bond, given one of its atoms.StringtoString()
 
- 
- 
- 
Constructor Detail- 
BondImplpublic BondImpl(Atom atomA, Atom atomB, int bondOrder) Constructs a new bond from a pair of atoms and the bond order of the bond between them.Note that by forming a bond between atoms 'A' and 'B' with this constructor, atoms 'A' and 'B' will be updated to have this bond in their list of bonds. If you do not want this automatic updating, instead use #Bond(Atom, Atom, int, boolean)with theaddSelfToAtomsflag set tofalse.- Parameters:
- atomA- one of the atoms in this bond
- atomB- the other atom in this bond
- bondOrder- the bond order of this bond
 
 - 
BondImplpublic BondImpl(Atom atomA, Atom atomB, int bondOrder, boolean addSelfToAtoms) Constructs a new bond from a pair of atoms and the bond order of the bond between them.- Parameters:
- atomA- one of the atoms in this bond
- atomB- the other atom in this bond
- bondOrder- the bond order of this bond
- addSelfToAtoms- if set to true, this bond, once created, will automatically add itself to atomA and atomB's bond lists. (If this argument is set to false, the list returned from- Atom.getBonds()will not contain this bond.)
 
 
- 
 - 
Method Detail- 
getAtomApublic Atom getAtomA() Gets atom 'A' of this bond. There is no meaning to which atom is 'A' and which is 'B'; the atoms are labeled 'A' or 'B' based on the order in which they are passed to this class's constructor.- Specified by:
- getAtomAin interface- Bond
- Returns:
- one of the two atoms in this bond
- See Also:
- getAtomB()
 
 - 
getAtomBpublic Atom getAtomB() Gets atom 'B' of this bond. There is no meaning to which atom is 'A' and which is 'B'; the atoms are labeled 'A' or 'B' based on the order in which they are passed to this class's constructor.- Specified by:
- getAtomBin interface- Bond
- Returns:
- one of the two atoms in this bond
- See Also:
- getAtomA()
 
 - 
getOtherpublic Atom getOther(Atom exclude) A utility method to get the other atom in a bond, given one of its atoms. If the atom passed is one of the atoms in this bond, then this method is essentially equivalent to sayingatom == bond.getAtomA() ? bond.getAtomB() : bond.getAtomA().Note: Comparison of atoms in this method is done with ==, notequals.- Specified by:
- getOtherin interface- Bond
- Parameters:
- exclude- the atom of the bond to not return
- Returns:
- the atom in this bond that was not passed as an argument
- Throws:
- IllegalArgumentException- if the passed atom is not in this bond
 
 - 
getBondOrderpublic int getBondOrder() Gets the bond order of this bond. A return value of '1' corresponds to a single bond, '2' to a double bond, etc.- Specified by:
- getBondOrderin interface- Bond
- Returns:
- this bond's bond order
 
 - 
getLengthpublic double getLength() Gets the distance between the two atoms of this bond.This distance is calculated by Calc.getDistance(Atom, Atom), but this method will suppress the empty threat of aStructureExceptionthat method makes.
 
- 
 
-