2525 */
2626package org .openscience .cdk .fingerprint ;
2727
28- import java .util .ArrayList ;
2928import java .util .Arrays ;
3029import java .util .Collections ;
31- import java .util .List ;
3230import java .util .Set ;
3331import java .util .TreeSet ;
3432
3735import org .openscience .cdk .interfaces .IAtom ;
3836import org .openscience .cdk .interfaces .IAtomContainer ;
3937import 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