Class Ring

All Implemented Interfaces:
Serializable, Cloneable, IAtomContainer, ICDKObject, IChemObject, IChemObjectListener, IRing

public class Ring extends AtomContainer implements Serializable, IRing
Class representing a ring structure in a molecule. A ring is a linear sequence of N atoms interconnected to each other by covalent bonds, such that atom i (1 < i < N) is bonded to atom i-1 and atom i + 1 and atom 1 is bonded to atom N and atom 2.
See Also:
Source code:
Belongs to CDK module:
  • Constructor Details

    • Ring

      public Ring()
      Constructs an empty ring.
    • Ring

      public Ring(IAtomContainer atomContainer)
      Constructs a ring from the atoms in an IAtomContainer object.
      atomContainer - The IAtomContainer object containing the atoms to form the ring
    • Ring

      public Ring(int ringSize, String elementSymbol)
      Constructs a ring that will have a certain number of atoms of the given elements.
      ringSize - The number of atoms and bonds the ring will have
      elementSymbol - The element of the atoms the ring will have
    • Ring

      public Ring(int ringSize)
      Constructs an empty ring that will have a certain size.
      ringSize - The size (number of atoms) the ring will have
  • Method Details

    • getRingSize

      public int getRingSize()
      Returns the number of atoms\edges in this ring.
      Specified by:
      getRingSize in interface IRing
      The number of atoms\edges in this ring
    • getNextBond

      public IBond getNextBond(IBond bond, IAtom atom)
      Returns the next bond in order, relative to a given bond and atom. Example: Let the ring be composed of 0-1, 1-2, 2-3 and 3-0. A request getNextBond(1-2, 2) will return Bond 2-3.
      Specified by:
      getNextBond in interface IRing
      bond - A bond for which an atom from a consecutive bond is sought
      atom - A atom from the bond above to assign a search direction
      The next bond in the order given by the above assignment
    • getBondOrderSum

      public int getBondOrderSum()
      Returns the sum of all bond orders in the ring.
      Specified by:
      getBondOrderSum in interface IRing
      the sum of all bond orders in the ring
    • clone

      public IRing clone() throws CloneNotSupportedException
      Clones this IChemObject. It clones the identifier, flags, properties and pointer vectors. The ChemObjectListeners are not cloned, and neither is the content of the pointer vectors.
      Specified by:
      clone in interface IAtomContainer
      Specified by:
      clone in interface IChemObject
      Specified by:
      clone in interface IRing
      clone in class AtomContainer
      The cloned object
      CloneNotSupportedException - if the IChemObject cannot be cloned
    • toString

      public String toString()
      Description copied from class: AtomContainer
      Returns a one line description of this IChemObject.
      Specified by:
      toString in interface IChemObject
      toString in class AtomContainer
      a String representation of this object