Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Removed hardcoded String use of InvPair constants in favor of their a…
…ctual constants
  • Loading branch information
egonw committed Aug 28, 2011
1 parent 409733e commit 4777958
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/main/org/openscience/cdk/smiles/SmilesGenerator.java
Expand Up @@ -386,7 +386,7 @@ public synchronized String createSMILESWithoutCheckForMultipleMolecules(IAtomCon
}
//logger.debug("Setting all VISITED flags to false");
atom.setFlag(CDKConstants.VISITED, false);
if ((Long) atom.getProperty("CanonicalLable") == 1)
if ((Long) atom.getProperty(InvPair.CANONICAL_LABEL) == 1)
{
start = atom;
}
Expand Down Expand Up @@ -455,8 +455,8 @@ public synchronized String createSMILESWithoutCheckForMultipleMolecules(IAtomCon

// remove all CanonicalLable/InvariancePair props
for (int k = 0; k < molecule.getAtomCount(); k++) {
molecule.getAtom(k).removeProperty("CanonicalLable");
molecule.getAtom(k).removeProperty("InvariancePair");
molecule.getAtom(k).removeProperty(InvPair.CANONICAL_LABEL);
molecule.getAtom(k).removeProperty(InvPair.INVARIANCE_PAIR);
}

return l.toString();
Expand Down Expand Up @@ -655,7 +655,10 @@ private List getCanNeigh(final IAtom a, final IAtomContainer container)
{
public int compare(Object o1, Object o2)
{
return (int) ((Long) ((IAtom) o1).getProperty("CanonicalLable") - (Long) ((IAtom) o2).getProperty("CanonicalLable"));
return (int) (
(Long) ((IAtom) o1).getProperty(InvPair.CANONICAL_LABEL) -
(Long) ((IAtom) o2).getProperty(InvPair.CANONICAL_LABEL)
);
}
});
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/org/openscience/cdk/tools/HOSECodeGenerator.java
Expand Up @@ -47,6 +47,7 @@
import org.openscience.cdk.interfaces.IRing;
import org.openscience.cdk.interfaces.IRingSet;
import org.openscience.cdk.ringsearch.SSSRFinder;
import org.openscience.cdk.smiles.InvPair;

/**
* Generates HOSE codes {@cdk.cite BRE78}.
Expand Down Expand Up @@ -740,8 +741,8 @@ class TreeNodeComparator implements Comparator<TreeNode> {
public int compare(TreeNode obj1, TreeNode obj2) {
if(obj1==null || obj2==null || ((TreeNode) obj1).getAtom()==null || ((TreeNode) obj2).getAtom()==null)
return 0;
Long label1 = (Long)((TreeNode) obj1).getAtom().getProperty("CanonicalLable");
Long label2 = (Long)((TreeNode) obj2).getAtom().getProperty("CanonicalLable");
Long label1 = (Long)((TreeNode) obj1).getAtom().getProperty(InvPair.CANONICAL_LABEL);
Long label2 = (Long)((TreeNode) obj2).getAtom().getProperty(InvPair.CANONICAL_LABEL);
if(label1==null || label2==null)
return 0;
if (label1.intValue() < label2.intValue()) {
Expand Down

0 comments on commit 4777958

Please sign in to comment.