Commit f8323742 authored by Caelan Reese Wong's avatar Caelan Reese Wong
Browse files

updated mostSimilar function

parent c8fb4e63
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -15,13 +15,29 @@ public class Main {
            if (files != null) {
                for (File file : files) {
                    if (file.isFile()) {
                        for(int oo = 0;oo <1000;oo++)
                        moleculeArrayList.add(new Molecule(file.getPath()));
                    }
                }
            }
        }
        Molecule tester = new Molecule(filename);

        Molecule res=null;
        int similar=0;
        for(Molecule mol: moleculeArrayList)
        {
            int temp=mol.mostSimilar(moleculeArrayList.get(2));

            System.out.println(mol.moleculeName+" has "+ temp + " points");
            if(temp>similar)
            {
                similar=temp;
                res=mol;
            }
        }
        System.out.println("Most similar is "+ res.moleculeName);


        for(Molecule f: moleculeArrayList) {
            Molecule testing = new Molecule(filename);
            if (moleculeArrayList.get(0).areMoleculesEqual(testing) == null) {
+2 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ public class Molecule implements Serializable {

            for (Atom newAtom : otherMolecule.atomArrayList) {

                if (newAtom.elementType == dbAtom.elementType) { //Check if elements are the same
                if (!newAtom.marked && newAtom.elementType == dbAtom.elementType) { //Check if elements are the same
                    boolean [] edgeMarked = new boolean[newAtom.connected.size()];
                    // Compare connected of each atom
                    //for each connected atom in dbAtom
@@ -201,6 +201,7 @@ public class Molecule implements Serializable {

                if(matchingEdge)
                {
                    newAtom.marked=true;
                    break;
                }
            }