@TestClass(value="org.openscience.cdk.ringsearch.AllRingsFinderTest") public class AllRingsFinder extends Object
WARNING: This class has now a timeout of 5 seconds, after which it aborts
its ringsearch. The timeout value can be customized by the setTimeout()
method of this class.
Also, by using the optional argument "maxRingSize" timeouts can possibly be avoided
because recursion depth will be limited accordingly.
Example: given a complex atom container and a maxRingSize of six, the find method
will return all rings only of size six or smaller.
Modifier and Type | Field and Description |
---|---|
boolean |
debug |
Constructor and Description |
---|
AllRingsFinder()
Constructor for the AllRingsFinder with logging.
|
AllRingsFinder(boolean logging)
Constructor for the AllRingsFinder.
|
Modifier and Type | Method and Description |
---|---|
void |
checkTimeout()
Checks if the timeout has been reached and throws an
exception if so.
|
IRingSet |
findAllRings(IAtomContainer atomContainer)
Returns a ringset containing all rings in the given AtomContainer
Calls
findAllRings(IAtomContainer, Integer) with max ring size argument set to null (=unlimited ring sizes) |
IRingSet |
findAllRings(IAtomContainer atomContainer,
Integer maxRingSize)
Returns a ringset containing all rings up to a provided maximum size in a given AtomContainer
|
IRingSet |
findAllRingsInIsolatedRingSystem(IAtomContainer atomContainer)
Fings the set of all rings in a molecule
Calls
findAllRingsInIsolatedRingSystem(IAtomContainer,Integer) with max ring size argument set to null (=unlimited ring sizes) |
IRingSet |
findAllRingsInIsolatedRingSystem(IAtomContainer atomContainer,
Integer maxRingSize)
Finds the set of all rings in a molecule
|
long |
getTimeout()
Gets the timeout values in milliseconds of the AllRingsFinder object
|
AllRingsFinder |
setTimeout(long timeout)
Sets the timeout value in milliseconds of the AllRingsFinder object
This is used to prevent this AllRingsFinder
to run for ages in certain rare cases with ring systems of
large size or special topology
|
public AllRingsFinder(boolean logging)
logging
- true=logging will be done (slower), false = no logging.public AllRingsFinder()
@TestMethod(value="testFindAllRings_IAtomContainer,testBondsWithinRing") public IRingSet findAllRings(IAtomContainer atomContainer) throws CDKException
findAllRings(IAtomContainer, Integer)
with max ring size argument set to null (=unlimited ring sizes)atomContainer
- The AtomContainer to be searched for ringsCDKException
- An exception thrown if something goes wrong or if the timeout limit is reachedpublic IRingSet findAllRings(IAtomContainer atomContainer, Integer maxRingSize) throws CDKException
atomContainer
- The AtomContainer to be searched for ringsmaxRingSize
- Maximum ring size to consider. Provides a possible breakout from recursion for complex compounds.CDKException
- An exception thrown if something goes wrong or if the timeout limit is reachedpublic IRingSet findAllRingsInIsolatedRingSystem(IAtomContainer atomContainer) throws CDKException
findAllRingsInIsolatedRingSystem(IAtomContainer,Integer)
with max ring size argument set to null (=unlimited ring sizes)atomContainer
- the molecule to be searched for ringsCDKException
- An exception thrown if something goes wrong or if the timeout limit is reachedpublic IRingSet findAllRingsInIsolatedRingSystem(IAtomContainer atomContainer, Integer maxRingSize) throws CDKException
atomContainer
- the molecule to be searched for ringsmaxRingSize
- Maximum ring size to consider. Provides a possible breakout from recursion for complex compounds.CDKException
- An exception thrown if something goes wrong or if the timeout limit is reached@TestMethod(value="testCheckTimeout") public void checkTimeout() throws CDKException
CDKException
- The exception thrown in case of hitting the timeout@TestMethod(value="testSetTimeout_long") public AllRingsFinder setTimeout(long timeout)
timeout
- The new timeout value@TestMethod(value="testGetTimeout") public long getTimeout()