public static boolean ringAlreadyInSet ( IRing newRing , IRingSet ringSet ) { IRing ring ; // IBond[] bonds; // IBond[] newBonds; // IBond bond; int equalCount ; boolean equals ; for ( int f = 0 ; f < ringSet . getAtomContainerCount ( ) ; f ++ ) { equals = false ; equalCount = 0 ; ring = ( IRing ) ringSet . getAtomContainer ( f ) ; // bonds = ring.getBonds(); // newBonds = newRing.getBonds(); if ( ring . getBondCount ( ) == newRing . getBondCount ( ) ) { for ( IBond newBond : newRing . bonds ( ) ) { for ( IBond bond : ring . bonds ( ) ) { if ( newBond . equals ( bond ) ) { equals = true ; equalCount ++ ; break ; } } if ( ! equals ) break ; } } if ( equalCount == ring . getBondCount ( ) ) { return true ; } } return false ; }
Checks - and returns true - if a certain ring is already stored in the ringset . This is not a test for equality of Ring objects but compares all Bond objects of the ring .