Skip to content

Commit cd1a7d9

Browse files
committed
Capturing pseudo atom logic was previously wrong and removed, remove the
now redundant variable.
1 parent ee48add commit cd1a7d9

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

descriptor/fingerprint/src/main/java/org/openscience/cdk/fingerprint/ShortestPathWalker.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@
2525
*/
2626
package org.openscience.cdk.fingerprint;
2727

28-
import java.util.ArrayList;
2928
import java.util.Arrays;
3029
import java.util.Collections;
31-
import java.util.List;
3230
import java.util.Set;
3331
import java.util.TreeSet;
3432

@@ -37,7 +35,6 @@
3735
import org.openscience.cdk.interfaces.IAtom;
3836
import org.openscience.cdk.interfaces.IAtomContainer;
3937
import org.openscience.cdk.interfaces.IBond;
40-
import org.openscience.cdk.interfaces.IPseudoAtom;
4138

4239
/**
4340
*
@@ -57,9 +54,6 @@ public final class ShortestPathWalker {
5754
/* set of encoded atom paths */
5855
private final Set<String> paths;
5956

60-
/* list of encoded pseudo atoms */
61-
private final List<String> pseudoAtoms;
62-
6357
/* maximum number of shortest paths, when there is more then one path */
6458
private static final int MAX_SHORTEST_PATHS = 5;
6559

@@ -69,7 +63,6 @@ public final class ShortestPathWalker {
6963
*/
7064
public ShortestPathWalker(IAtomContainer container) {
7165
this.container = container;
72-
this.pseudoAtoms = new ArrayList<String>(5);
7366
this.paths = Collections.unmodifiableSet(traverse());
7467
}
7568

@@ -86,7 +79,7 @@ public Set<String> paths() {
8679
*/
8780
private Set<String> traverse() {
8881

89-
Set<String> paths = new TreeSet<String>();
82+
Set<String> paths = new TreeSet<>();
9083

9184
// All-Pairs Shortest-Paths (APSP)
9285
AllPairsShortestPaths apsp = new AllPairsShortestPaths(container);
@@ -147,29 +140,16 @@ private int[] reverse(int[] src) {
147140
* @return encoded path
148141
*/
149142
private String encode(int[] path) {
150-
151143
StringBuilder sb = new StringBuilder(path.length * 3);
152-
153144
for (int i = 0, n = path.length - 1; i <= n; i++) {
154-
155145
IAtom atom = container.getAtom(path[i]);
156-
157146
sb.append(toAtomPattern(atom));
158-
159-
if (atom instanceof IPseudoAtom) {
160-
pseudoAtoms.add(atom.getSymbol());
161-
// potential bug, although the atoms are canonical we cannot guarantee the order we will visit them.
162-
// sb.append(PeriodicTable.getElementCount() + pseudoAtoms.size());
163-
}
164-
165147
// if we are not at the last index, add the connecting bond
166148
if (i < n) {
167149
IBond bond = container.getBond(container.getAtom(path[i]), container.getAtom(path[i + 1]));
168150
sb.append(getBondSymbol(bond));
169151
}
170-
171152
}
172-
173153
return sb.toString();
174154
}
175155

0 commit comments

Comments
 (0)