/** * Traverse like in a the real fragmenter. The main purpose is to create a * copy of of the old fragment * * @param atomContainer * the atom container * @param atom * the atom * @param bondList * the bond list * * @return the list< i bond> */ private List<IBond> traverse(IAtomContainer atomContainer, IAtom atom, List<IBond> bondList) { var connectedBonds = atomContainer.getConnectedBondsList(atom); foreach (var aBond in connectedBonds.ToWindowsEnumerable<IBond>()) { if (bondList.Contains(aBond)) { continue; } bondList.Add(aBond); var nextAtom = aBond.getConnectedAtom(atom); if (atomContainer.getConnectedAtomsCount(nextAtom) == 1) { continue; } traverse(atomContainer, nextAtom, bondList); } return bondList; }