Class BondTable

  • All Implemented Interfaces:
    Serializable, Cloneable

    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.
    Marvin 5.4
    See Also:
    Serialized Form
    • Field Detail


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

      • 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.
        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.
        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.)
        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.
        i - the first atom index
        j - the second atom index
        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.
        i - index of the first atom
        j - index of the second atom
        bondIndex - index of the bond connecting atoms i and j