Class Ring

All Implemented Interfaces:
Serializable, Cloneable, IAtomContainer, ICDKObject, IChemObject, IChemObjectListener, IRing
Direct Known Subclasses:
DebugRing

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:
main
Belongs to CDK module:
data
Keywords:
ring
  • Constructor Details

    • Ring

      public Ring()
      Constructs an empty ring.
    • Ring

      public Ring(IAtomContainer atomContainer)
      Constructs a ring from the atoms in an IAtomContainer object.
      Parameters:
      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.
      Parameters:
      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.
      Parameters:
      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
      Returns:
      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
      Parameters:
      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
      Returns:
      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
      Returns:
      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
      Overrides:
      clone in class AtomContainer
      Returns:
      The cloned object
      Throws:
      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
      Overrides:
      toString in class AtomContainer
      Returns:
      a String representation of this object