MmffAromaticTypeMapping { static int indexOfHetro(int[] cycle, int[] contribution) { int index = -1; for (int i = 0; i < cycle.length - 1; i++) { if (contribution[cycle[i]] == 2) index = index == -1 ? i : -2; } return index; } MmffAromaticTypeMapping();   }
@Test public void indexOfHetroAt0() { int[] cycle = new int[]{3, 2, 1, 4, 5, 3}; int[] contr = new int[]{1, 1, 1, 1, 1, 1}; contr[cycle[0]] = 2; Assert.assertEquals(0, MmffAromaticTypeMapping.indexOfHetro(cycle, contr)); }
@Test public void indexOfHetroAt1() { int[] cycle = new int[]{3, 2, 1, 4, 5, 3}; int[] contr = new int[]{1, 1, 1, 1, 1, 1}; contr[cycle[1]] = 2; Assert.assertEquals(1, MmffAromaticTypeMapping.indexOfHetro(cycle, contr)); }
@Test public void indexOfHetroAt2() { int[] cycle = new int[]{3, 2, 1, 4, 5, 3}; int[] contr = new int[]{1, 1, 1, 1, 1, 1}; contr[cycle[2]] = 2; Assert.assertEquals(2, MmffAromaticTypeMapping.indexOfHetro(cycle, contr)); }
@Test public void indexOfHetroAt3() { int[] cycle = new int[]{3, 2, 1, 4, 5, 3}; int[] contr = new int[]{1, 1, 1, 1, 1, 1}; contr[cycle[3]] = 2; Assert.assertEquals(3, MmffAromaticTypeMapping.indexOfHetro(cycle, contr)); }
@Test public void indexOfHetroAt4() { int[] cycle = new int[]{3, 2, 1, 4, 5, 3}; int[] contr = new int[]{1, 1, 1, 1, 1, 1}; contr[cycle[4]] = 2; Assert.assertEquals(4, MmffAromaticTypeMapping.indexOfHetro(cycle, contr)); }
@Test public void indexOfNoHetroAtom() { int[] cycle = new int[]{3, 2, 1, 4, 5, 3}; int[] contr = new int[]{1, 1, 1, 1, 1, 1}; Assert.assertEquals(-1, MmffAromaticTypeMapping.indexOfHetro(cycle, contr)); }
@Test public void indexOfTwoHetroAtoms() { int[] cycle = new int[]{3, 2, 1, 4, 5, 3}; int[] contr = new int[]{1, 1, 1, 1, 1, 1}; contr[cycle[0]] = 2; contr[cycle[4]] = 2; Assert.assertEquals(-2, MmffAromaticTypeMapping.indexOfHetro(cycle, contr)); }