/** @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(); }