Commit e31764df authored by Phuong Khanh Tran's avatar Phuong Khanh Tran
Browse files

Update MoleculeDatabase.java

parent bdb93958
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -26,8 +26,15 @@ public class MoleculeDatabase implements Serializable {
    /**
     * Find isomorphic molecule from the database
     */
    public Molecule findMolecule(Molecule molecule) {
      return null; // for now
    public Molecule find(Molecule molecule) {
        // Iterate through the array list of molecules inside the database
        for (Molecule dbMolecule : db) {
            if (areMoleculesEqual(dbMolecule, molecule)) {
                return dbMolecule; // Return the isomorphic molecule
            }
        }
        System.out.println("No isomorphic molecule found in database.");
        return null; // Return null if molecule not found
    }

    /**