Skip to content

Commit

Permalink
minor code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Apodaca committed Jul 1, 2009
1 parent 16fb07f commit 8e39ba0
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/com/metamolecular/mx/fingerprint/PathFingerprinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class PathFingerprinter implements Fingerprinter
private BloomFilter bloomFilter;
private Walker walker;
private RingFilter filter;
private Set<Atom> aromatics;

public PathFingerprinter()
{
Expand All @@ -58,6 +59,7 @@ public PathFingerprinter(RingFilter filter)
this.writer = new PathWriter(bloomFilter);
this.walker = new DefaultWalker();
this.filter = filter;
this.aromatics = new HashSet();
}

public RingFilter getRingFilter()
Expand Down Expand Up @@ -93,23 +95,28 @@ public int getFingerprintLength()
public BitSet getFingerprint(Molecule molecule)
{
bloomFilter.clear();
Set<Atom> aromatics = new HashSet();
filter.filterAtoms(molecule, aromatics);

for (Atom atom : aromatics)
{
aromatics.add(atom);
}

writer.setAromatics(aromatics);
findAromatics(molecule);

for (int i = 0; i < molecule.countAtoms(); i++)
{
Atom atom = molecule.getAtom(i);

walker.walk(atom, writer);
}

return bloomFilter.toBitSet();
}

private void findAromatics(Molecule molecule)
{
aromatics.clear();
filter.filterAtoms(molecule, aromatics);

for (Atom atom : aromatics)
{
aromatics.add(atom);
}

writer.setAromatics(aromatics);
}
}

0 comments on commit 8e39ba0

Please sign in to comment.