BasicAtomHashGenerator extends AbstractAtomHashGenerator implements AtomHashGenerator { long next(int[][] graph, int v, long[] current, long[] unique, long[] included) { long invariant = distribute(current[v]); int nUnique = 0; for (int w : graph[v]) { long adjInv = current[w]; int i = 0; while (i < nUnique && unique[i] != adjInv) { ++i; } included[i] = (i == nUnique) ? unique[nUnique++] = adjInv : rotate(included[i]); invariant ^= included[i]; } return invariant; } BasicAtomHashGenerator(AtomHashGenerator seedGenerator, Pseudorandom pseudorandom,
            StereoEncoderFactory factory, int depth);  BasicAtomHashGenerator(AtomHashGenerator seedGenerator, Pseudorandom pseudorandom, int depth); @Override long[] generate(IAtomContainer container);  }
@Test public void testRotation() throws Exception { AtomHashGenerator seedMock = mock(AtomHashGenerator.class); IAtomContainer container = mock(IAtomContainer.class); BasicAtomHashGenerator generator = new BasicAtomHashGenerator(mock(AtomHashGenerator.class), new Xorshift(), 2); int[][] graph = new int[][]{{1, 2, 3}, {0}, {0}, {0}}; long[] invs = new long[]{21, 31, 31, 31}; long[] unique = new long[4]; long[] rotated = new long[4]; long value = generator.next(graph, 0, invs, unique, rotated); assertThat(unique, is(new long[]{31, 0, 0, 0})); assertThat(rotated, is(new long[]{generator.rotate(31, 2), 0, 0, 0})); assertThat(value, is(generator.distribute(21) ^ 31 ^ generator.rotate(31) ^ generator.rotate(31, 2))); }