private static IRingSet walkRingSystem ( IRingSet rs , IRing ring , IRingSet newRs ) { IRing tempRing ; IRingSet tempRings = rs . getConnectedRings ( ring ) ; // logger.debug("walkRingSystem -> tempRings.size(): " + tempRings.size()); rs . removeAtomContainer ( ring ) ; for ( IAtomContainer container : tempRings . atomContainers ( ) ) { tempRing = ( IRing ) container ; if ( ! newRs . contains ( tempRing ) ) { newRs . addAtomContainer ( tempRing ) ; newRs . add ( walkRingSystem ( rs , tempRing , newRs ) ) ; } } return newRs ; }
Perform a walk in the given RingSet starting at a given Ring and recursively searching for other Rings connected to this ring . By doing this it finds all rings in the RingSet connected to the start ring putting them in newRs and removing them from rs .