Skip to content

Commit

Permalink
Added a method to return the possible InChI options
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Aug 16, 2012
1 parent 3f033f3 commit 69458bb
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
Expand Up @@ -10,6 +10,8 @@
******************************************************************************/
package net.bioclipse.inchi.business.test;

import java.util.List;

import org.junit.Assert;
import org.junit.Ignore;

Expand Down Expand Up @@ -71,4 +73,13 @@ public void testGenerateKey() throws Exception {
key.getKey()
);
}

@Test
public void testOptions() throws Exception {
List<String> options = inchi.options();
Assert.assertNotNull(options);
Assert.assertNotSame(0, options.size()); // at least one option
Assert.assertTrue(options.contains("FixedH"));
}

}
Expand Up @@ -51,6 +51,12 @@ public BioclipseJob<InChI> generate(IMolecule molecule,
public BioclipseJob<InChI> generate(IMolecule molecule, String options,
BioclipseJobUpdateHook<InChI> h );

@Recorded
@PublishedMethod(
methodSummary = "Returns a list of InChI generation options.")
@TestMethods("testOptions")
public List<String> options();

@Recorded
@PublishedMethod(
methodSummary = "Loads the InChI library.")
Expand Down
Expand Up @@ -12,13 +12,16 @@
package net.bioclipse.inchi.business;

import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.List;

import net.bioclipse.core.PublishedMethod;
import net.bioclipse.core.Recorded;
import net.bioclipse.core.domain.IMolecule;
import net.bioclipse.inchi.InChI;
import net.bioclipse.jobs.IReturner;
import net.bioclipse.managers.business.IBioclipseManager;
import net.sf.jniinchi.INCHI_OPTION;
import net.sf.jniinchi.INCHI_RET;

import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -131,6 +134,14 @@ public void generate( IMolecule molecule, String options,
}
}

public List<String> options() {
List<String> options = new ArrayList<String>();
for (INCHI_OPTION option : INCHI_OPTION.values()) {
options.add("" + option);
}
return options;
}

public String load() {
if (factory == null) {
try {
Expand Down

0 comments on commit 69458bb

Please sign in to comment.