public class BondImpl extends Object implements Bond
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
Atom |
getAtomA()
Gets atom 'A' of this bond.
|
Atom |
getAtomB()
Gets atom 'B' of this bond.
|
int |
getBondOrder()
Gets the bond order of this bond.
|
double |
getLength()
Gets the distance between the two atoms of this bond.
|
Atom |
getOther(Atom exclude)
A utility method to get the other atom in a bond, given one of its atoms.
|
String |
toString() |
public BondImpl(Atom atomA, Atom atomB, int bondOrder)
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 the
addSelfToAtoms
flag set to false
.
atomA
- one of the atoms in this bondatomB
- the other atom in this bondbondOrder
- the bond order of this bondpublic BondImpl(Atom atomA, Atom atomB, int bondOrder, boolean addSelfToAtoms)
atomA
- one of the atoms in this bondatomB
- the other atom in this bondbondOrder
- the bond order of this bondaddSelfToAtoms
- 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.)public Atom getAtomA()
getAtomA
in interface Bond
getAtomB()
public Atom getAtomB()
getAtomB
in interface Bond
getAtomA()
public Atom getOther(Atom exclude)
atom == bond.getAtomA() ? bond.getAtomB() : bond.getAtomA()
.
Note: Comparison of atoms in this method is done with
==
, not equals
.
getOther
in interface Bond
exclude
- the atom of the bond to not returnIllegalArgumentException
- if the passed atom is not in this bondpublic int getBondOrder()
getBondOrder
in interface Bond
public double getLength()
This distance is calculated by Calc.getDistance(Atom, Atom)
, but
this method will suppress the empty threat of a
StructureException
that method makes.
Copyright © 2000–2018 BioJava. All rights reserved.