RandomKey extends AbstractListChromosome<Double> implements PermutationChromosome<T> { @Override protected boolean isSame(final Chromosome another) { if (! (another instanceof RandomKey<?>)) { return false; } RandomKey<?> anotherRk = (RandomKey<?>) another; if (getLength() != anotherRk.getLength()) { return false; } List<Integer> thisPerm = this.baseSeqPermutation; List<Integer> anotherPerm = anotherRk.baseSeqPermutation; for (int i=0; i<getLength(); i++) { if (thisPerm.get(i) != anotherPerm.get(i)) { return false; } } return true; } RandomKey(final List<Double> representation);  RandomKey(final Double[] representation); List<T> decode(final List<T> sequence); static final List<Double> randomPermutation(final int l); static final List<Double> identityPermutation(final int l); static List<Double> comparatorPermutation(final List<S> data,
                                                         final Comparator<S> comparator); static List<Double> inducedPermutation(final List<S> originalData,
                                                      final List<S> permutedData); @Override String toString();  }
@Test public void testIsSame() { DummyRandomKey drk1 = new DummyRandomKey(new Double[] {0.4, 0.1, 0.5, 0.8, 0.2}); DummyRandomKey drk2 = new DummyRandomKey(new Double[] {0.4, 0.1, 0.5, 0.8, 0.2}); DummyRandomKey drk3 = new DummyRandomKey(new Double[] {0.4, 0.15, 0.5, 0.8, 0.2}); DummyRandomKey drk4 = new DummyRandomKey(new Double[] {0.4, 0.25, 0.5, 0.8, 0.2}); DummyRandomKey drk5 = new DummyRandomKey(new Double[] {0.4, 0.25, 0.5, 0.8, 0.2, 0.5}); Assert.assertTrue(drk1.isSame(drk2)); Assert.assertTrue(drk2.isSame(drk3)); Assert.assertFalse(drk3.isSame(drk4)); Assert.assertFalse(drk4.isSame(drk5)); }