Permalink
Browse files

Parameterized the benchmark driver

  • Loading branch information...
1 parent 83983db commit 26ce4887a703be67e52d17ce031c86990484c9e8 @egonw committed Jul 13, 2011
Showing with 11 additions and 7 deletions.
  1. +11 −7 src/net/openmolecules/benchmark/driver/CDKSDFBench14.java
@@ -27,10 +27,12 @@
import com.sun.japex.JapexDriverBase;
import com.sun.japex.TestCase;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
-import org.openscience.cdk.DefaultChemObjectBuilder;
+import org.openscience.cdk.interfaces.IChemObjectBuilder;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.io.iterator.IteratingMDLReader;
import org.openscience.cdk.qsar.descriptors.molecular.WeightDescriptor;
@@ -39,13 +41,10 @@
/**
* @author Richard L. Apodaca
*/
-public class CDKSDFBench14 extends JapexDriverBase
-{
+public class CDKSDFBench14 extends JapexDriverBase {
@Override
- public void prepare()
- {
- }
+ public void prepare() {}
@Override
public void run(TestCase testCase)
@@ -79,8 +78,13 @@ private IteratingMDLReader getReader(String filename)
{
Reader raw = new FileReader(filename);
//BufferedReader reader = new BufferedReader(raw);
+ String chemObjectBuilder = getParam("chemObjectBuilder");
+ Class clazz = this.getClass().getClassLoader()
+ .loadClass(chemObjectBuilder);
+ Method getInstance = clazz.getMethod("getInstance", new Class[]{});
+ IChemObjectBuilder builder = (IChemObjectBuilder)getInstance.invoke(new Class[]{});
- result = new IteratingMDLReader(raw, DefaultChemObjectBuilder.getInstance());
+ result = new IteratingMDLReader(raw, builder);
} catch (Exception e)
{
throw new RuntimeException(e.getMessage(), e);

0 comments on commit 26ce488

Please sign in to comment.