Logo Search packages:      
Sourcecode: cdk version File versions  Download package

void org::openscience::cdk::AtomContainer::removeAtomAndConnectedElectronContainers ( IAtom  atom  )  [inline, inherited]

Removes the given atom and all connected electronContainers from the AtomContainer.

Parameters:
atom The atom to be removed

Implements org::openscience::cdk::interfaces::IAtomContainer.

Reimplemented in org::openscience::cdk::debug::DebugAminoAcid, org::openscience::cdk::debug::DebugAtomContainer, org::openscience::cdk::debug::DebugBioPolymer, org::openscience::cdk::debug::DebugCrystal, org::openscience::cdk::debug::DebugMolecule, org::openscience::cdk::debug::DebugMonomer, org::openscience::cdk::debug::DebugPolymer, org::openscience::cdk::debug::DebugRing, and org::openscience::cdk::debug::DebugStrand.

Definition at line 1266 of file AtomContainer.java.

References org::openscience::cdk::AtomContainer::bondCount, org::openscience::cdk::AtomContainer::bonds(), org::openscience::cdk::AtomContainer::contains(), org::openscience::cdk::AtomContainer::getAtomNumber(), org::openscience::cdk::AtomContainer::lonePairCount, org::openscience::cdk::AtomContainer::lonePairs(), org::openscience::cdk::ChemObject::notifyChanged(), org::openscience::cdk::AtomContainer::removeAtom(), org::openscience::cdk::AtomContainer::removeBond(), org::openscience::cdk::AtomContainer::removeLonePair(), org::openscience::cdk::AtomContainer::removeSingleElectron(), org::openscience::cdk::AtomContainer::singleElectronCount, and org::openscience::cdk::AtomContainer::singleElectrons().

      {
            int position = getAtomNumber(atom);
            if (position != -1)
            {
                  for (int i = 0; i < bondCount; i++)
                  {
                        if (bonds[i].contains(atom)) {
                              removeBond(i);
                              --i;
                        }
                  }
                  for (int i = 0; i < lonePairCount; i++)
                  {
                        if (lonePairs[i].contains(atom)) {
                              removeLonePair(i);
                              --i;
                        }
                  }
                  for (int i = 0; i < singleElectronCount; i++)
                  {
                        if (singleElectrons[i].contains(atom)) {
                              removeSingleElectron(i);
                              --i;
                        }
                  }
                  removeAtom(position);
            }
            notifyChanged();
      }


Generated by  Doxygen 1.6.0   Back to index