Commit 490634fc authored by Phuong Khanh Tran's avatar Phuong Khanh Tran
Browse files

Update MoleculeDatabase.java

parent a1f4f2fb
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
import edu.bu.ec504.project.Atom;
import edu.bu.ec504.project.Molecule;

import java.io.*;
@@ -47,6 +48,13 @@ public class MoleculeDatabase {
            return;
        }
        int numAtoms = molecule.getNumAtoms();
        //test if molecule has an unconnected atom
        for(Atom a: molecule.getAtomArrayList())
            if(a.connected.isEmpty()) {
                printVerbose("Error: molecule file is incorrect (contains unconnected atom)");
                return;
            }

        if (this.db.containsKey(numAtoms)) {
            this.db.get(numAtoms).add(molecule);
        } else {
@@ -56,6 +64,7 @@ public class MoleculeDatabase {
        }
    }


    /**
     * Find isomorphic molecule from the database
     */
@@ -133,7 +142,6 @@ public class MoleculeDatabase {
    /**
     * Download Molecules from PubChem in range [start, end]
     */

    public void downloadPubChem(String start, String end) {
        String scriptPath = "testcases/downloadPubChem.py";
        List<String> filenames = new ArrayList<>();