Package chemaxon.core.util
Class BondTable
java.lang.Object
chemaxon.core.util.BondTable
- All Implemented Interfaces:
Serializable
,Cloneable
Provides easy lookup of bonds between pair of atoms in a molecule graph.
This class is an abstraction of the NxN square matrix for a molecule graph containing N atoms,
for which matrix[i][j] and matrix[j][i] are the index of the bond between the atoms
with indexes i and j, or -1 if there is no bond between the atoms.
- Since:
- Marvin 5.4
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default (null) value in the matrix. -
Method Summary
Modifier and TypeMethodDescriptionclone()
static BondTable
cloneBondTable
(BondTable bondTable) Clones the bond table.static BondTable
createBondTable
(int atomCount, int bondCount) Creates a new bond table for a molecule graph with the specified number of atoms and bonds.final int
Returns the number of atoms in the molecule this bond table represents.abstract int
getBondIndex
(int i, int j) Returns the index of the bond connecting two atoms, or -1 if the two atoms are not connected.final void
setBondIndex
(int i, int j, int bondIndex) Sets the index of the bond connecting two atoms.
-
Field Details
-
DEFAULT_VALUE
public static final int DEFAULT_VALUEThe default (null) value in the matrix.- See Also:
-
-
Method Details
-
createBondTable
Creates a new bond table for a molecule graph with the specified number of atoms and bonds. Initially, all values are set to -1.- Parameters:
atomCount
- the number of atoms (the number of rows and columns of the matrix)bondCount
- the number of bonds (required for the selection of optimized implementations)
-
cloneBondTable
Clones the bond table. Makes a deep copy.- Parameters:
bondTable
- the matrix to copy, has to be not null.
-
getAtomCount
public final int getAtomCount()Returns the number of atoms in the molecule this bond table represents. (This is the number of rows and columns of the matrix array.)- Returns:
- the number of atoms (rows, columns).
-
getBondIndex
public abstract int getBondIndex(int i, int j) Returns the index of the bond connecting two atoms, or -1 if the two atoms are not connected.- Parameters:
i
- the first atom indexj
- the second atom index- Returns:
- the connecting bond index, or -1 if there is no such bond
-
setBondIndex
public final void setBondIndex(int i, int j, int bondIndex) Sets the index of the bond connecting two atoms. If the bond index is -1, the connection is removed.- Parameters:
i
- index of the first atomj
- index of the second atombondIndex
- index of the bond connecting atoms i and j
-
clone
-