Skip to content

Commit

Permalink
QueryAtom/Bond need hashCode/equals to check Atom/BondRefs
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmay committed Feb 28, 2018
1 parent 892b17f commit 886c90b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javax.vecmath.Point2d;
import javax.vecmath.Point3d;

import org.openscience.cdk.AtomRef;
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
Expand Down Expand Up @@ -735,4 +736,22 @@ public IAtom clone() throws CloneNotSupportedException {
// XXX: clone always dodgy
return (IAtom) super.clone();
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
}

/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof AtomRef)
return super.equals(((AtomRef) obj).deref());
return super.equals(obj);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import javax.vecmath.Point2d;
import javax.vecmath.Point3d;

import org.openscience.cdk.BondRef;
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.interfaces.IAtom;
import org.openscience.cdk.interfaces.IAtomContainer;
Expand Down Expand Up @@ -527,4 +528,21 @@ public void setElectronCount(Integer electronCount) {
notifyChanged();
}

/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return super.hashCode();
}

/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj instanceof BondRef)
return super.equals(((BondRef) obj).deref());
return super.equals(obj);
}
}

0 comments on commit 886c90b

Please sign in to comment.