Class BondTable

java.lang.Object
chemaxon.core.util.BondTable
All Implemented Interfaces:
Serializable, Cloneable

@PublicApi public abstract class BondTable extends Object implements 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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default (null) value in the matrix.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    static 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.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_VALUE

      public static final int DEFAULT_VALUE
      The default (null) value in the matrix.
      See Also:
  • Method Details

    • createBondTable

      public static BondTable createBondTable(int atomCount, int bondCount)
      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

      public static BondTable cloneBondTable(BondTable bondTable)
      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 index
      j - 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 atom
      j - index of the second atom
      bondIndex - index of the bond connecting atoms i and j
    • clone

      public BondTable clone()
      Overrides:
      clone in class Object