AtomSignature extends AbstractVertexSignature { @Override protected String getEdgeLabel(int vertexIndex, int otherVertexIndex) { IAtom atomA = this.molecule.getAtom(vertexIndex); IAtom atomB = this.molecule.getAtom(otherVertexIndex); IBond bond = this.molecule.getBond(atomA, atomB); if (bond != null) { if (bond.getFlag(CDKConstants.ISAROMATIC)) { return "p"; } switch (bond.getOrder()) { case SINGLE: return ""; case DOUBLE: return "="; case TRIPLE: return "#"; case QUADRUPLE: return "$"; default: return ""; } } else { return ""; } } AtomSignature(int atomIndex, IAtomContainer molecule);  AtomSignature(IAtom atom, IAtomContainer molecule);  AtomSignature(int atomIndex, int height, IAtomContainer molecule);  AtomSignature(IAtom atom, int height, IAtomContainer molecule);  AtomSignature(int atomIndex, int height, InvariantType invariantType, IAtomContainer molecule);  AtomSignature(IAtom atom, int height, InvariantType invariantType, IAtomContainer molecule);   }
@Test public void getEdgeLabelTest() { Assert.assertEquals("=", atomSignature.getEdgeLabel(0, 1)); }
@Test public void getAromaticEdgeLabelTest() { IAtomContainer benzeneRing = builder.newInstance(IAtomContainer.class); for (int i = 0; i < 6; i++) { benzeneRing.addAtom(builder.newInstance(IAtom.class, "C")); } for (int i = 0; i < 6; i++) { IAtom a = benzeneRing.getAtom(i); IAtom b = benzeneRing.getAtom((i + 1) % 6); IBond bond = builder.newInstance(IBond.class, a, b); benzeneRing.addBond(bond); bond.setFlag(CDKConstants.ISAROMATIC, true); } AtomSignature signature = new AtomSignature(0, benzeneRing); for (int i = 0; i < 6; i++) { Assert.assertEquals("Failed for " + i, "p", signature.getEdgeLabel(i, (i + 1) % 6)); } }