Ejemplo n.º 1
0
 /** @inheritDoc */
 public void removeAtomAndConnectedElectronContainers(IAtom atom) {
   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;
       }
     }
     List<IStereoElement> atomElements = new ArrayList<IStereoElement>(3);
     for (IStereoElement element : stereoElements) {
       if (element.contains(atom)) atomElements.add(element);
     }
     stereoElements.removeAll(atomElements);
     removeAtom(position);
   }
   notifyChanged();
 }
 /**
  * Removes the given atom and all connected electronContainers from the AtomContainer.
  *
  * @param atom The atom to be removed
  */
 public void removeAtomAndConnectedElectronContainers(IAtom atom) {
   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();
 }
Ejemplo n.º 3
0
 /**
  * Removes all atoms and electronContainers of a given atomcontainer from this container.
  *
  * @param atomContainer The atomcontainer to be removed
  */
 public void remove(IAtomContainer atomContainer) {
   for (int f = 0; f < atomContainer.getAtomCount(); f++) {
     removeAtom(atomContainer.getAtom(f));
   }
   for (int f = 0; f < atomContainer.getBondCount(); f++) {
     removeBond(atomContainer.getBond(f));
   }
   for (int f = 0; f < atomContainer.getLonePairCount(); f++) {
     removeLonePair(atomContainer.getLonePair(f));
   }
   for (int f = 0; f < atomContainer.getSingleElectronCount(); f++) {
     removeSingleElectron(atomContainer.getSingleElectron(f));
   }
 }
 public void removeAtom(IAtom atom) {
   logger.debug("Removing atom: ", atom);
   super.removeAtom(atom);
 }
 public void removeAtom(int position) {
   logger.debug("Removing atom: ", position);
   super.removeAtom(position);
 }
Ejemplo n.º 6
0
 /**
  * Removes the given atom from the AtomContainer. Note that the electronContainers are unaffected:
  * you also have to take care of removing all electronContainers to this atom from the container.
  *
  * @param atom The atom to be removed
  */
 public void removeAtom(IAtom atom) {
   int position = getAtomNumber(atom);
   if (position != -1) {
     removeAtom(position);
   }
 }