private static IRingSet toRingSet(IAtomContainer ac, System.Collections.ICollection cycles) { IRingSet ringSet = ac.Builder.newRingSet(); System.Collections.IEnumerator cycleIterator = cycles.GetEnumerator(); while (cycleIterator.MoveNext()) { SimpleCycle cycle = (SimpleCycle)cycleIterator.Current; IRing ring = ac.Builder.newRing(); System.Collections.IList vertices = cycle.vertexList(); IAtom[] atoms = new IAtom[vertices.Count]; atoms[0] = (IAtom)vertices[0]; for (int i = 1; i < vertices.Count; i++) { atoms[i] = (IAtom)vertices[i]; ring.addElectronContainer(ac.getBond(atoms[i - 1], atoms[i])); } ring.addElectronContainer(ac.getBond(atoms[vertices.Count - 1], atoms[0])); ring.Atoms = atoms; ringSet.addAtomContainer(ring); } return(ringSet); }