Skip to content

Commit

Permalink
Helper class to allow us to quickly convert back to CDK 'Ring' object…
Browse files Browse the repository at this point in the history
…s - probably won't be needed in future and is private.

Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Aug 1, 2013
1 parent 99e1311 commit 17299ad
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/main/org/openscience/cdk/ringsearch/AllRingsFinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -443,5 +443,43 @@ public AllRingsFinder setTimeout(long timeout) {
public long getTimeout() {
return timeout;
}


/**
* Simple class to allow undirected indexing of edges. One day... should
* part of public api - but that day is not now.
*/
private final class Edge {

/** Endpoints. */
private final int u, v;

/**
* Create a new edge from two endpoints.
* @param u an endpoint
* @param v another endpoint
*/
private Edge(int u, int v) {
this.u = u;
this.v = v;
}

/** @inheritDoc */
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Edge that = (Edge) o;
return (this.u == that.u && this.v == that.v) ||
(this.u == that.v && this.v == that.u);
}

/** @inheritDoc */
@Override
public int hashCode() {
return u ^ v;
}
}

}

0 comments on commit 17299ad

Please sign in to comment.